@Override public boolean failed(Exception e) { try { boolean failed = ActiveOperationImpl.this.setFailed(e); if(failed) { ProtocolLogger.ROOT_LOGGER.debugf(e, "active-op (%d) failed %s", operationId, attachment); } return failed; } finally { removeActiveOperation(operationId); } }
@Override public synchronized void failed(Exception e) { if(prepared) { final ModelController.OperationTransaction transaction = activeTx; if(transaction != null) { transaction.rollback(); txCompletedLatch.countDown(); } } else if (responseChannel != null) { rollbackOnPrepare = true; // Failed in a step before prepare, send error response final String message = e.getMessage() != null ? e.getMessage() : "failure before rollback " + e.getClass().getName(); final ModelNode response = new ModelNode(); response.get(OUTCOME).set(FAILED); response.get(FAILURE_DESCRIPTION).set(message); try { sendResponse(responseChannel, ModelControllerProtocol.PARAM_OPERATION_FAILED, response); } catch (IOException ignored) { ProtocolLogger.ROOT_LOGGER.debugf(ignored, "failed to process message"); } } }
void sendCompletedMessage() { if(completed.compareAndSet(false, true)) { try { sendResponse(responseChannel, DomainControllerProtocol.PARAM_OK, null); } catch (IOException e) { ProtocolLogger.ROOT_LOGGER.debugf(e, "failed to process message"); } activeOperation.getResultHandler().done(null); } }
synchronized void completed(final ModelNode response) { assert prepared; assert responseChannel != null; try { // 4) operation-completed (done) sendResponse(responseChannel, ModelControllerProtocol.PARAM_OPERATION_COMPLETED, response); } catch (IOException e) { ProtocolLogger.ROOT_LOGGER.debugf(e, "failed to process message"); } finally { getResultHandler().done(null); } }
synchronized void completed(final ModelNode response) { assert prepared; assert responseChannel != null; try { // 4) operation-completed (done) sendResponse(responseChannel, ModelControllerProtocol.PARAM_OPERATION_COMPLETED, response); } catch (IOException e) { ProtocolLogger.ROOT_LOGGER.debugf(e, "failed to process message"); } finally { getResultHandler().done(null); } }
void failed(byte errorCode, String message) { if(completed.compareAndSet(false, true)) { failed = true; final IOTask<?> task = this.task; if(task != null) { task.setFailed(); } try { sendFailedResponse(responseChannel, errorCode, message); } catch (IOException e) { ProtocolLogger.ROOT_LOGGER.debugf(e, "failed to process message"); } activeOperation.getResultHandler().done(null); } }
@Override public void handleCancelled(AsyncFuture<? extends T> asyncFuture, Object attachment) { removeActiveOperation(operationId); callback.cancelled(); ProtocolLogger.ROOT_LOGGER.debugf("cancelled operation (%d) attachment: (%s) this: %s.", getOperationId(), getAttachment(), ActiveOperationSupport.this); } }, null);
synchronized void failed(final ModelNode response) { if(prepared) { // in case commit or rollback throws an exception, to conform with the API we still send a operation-completed message completed(response); } else { assert responseChannel != null; try { // 2) send the operation-failed message (done) sendResponse(responseChannel, ModelControllerProtocol.PARAM_OPERATION_FAILED, response); } catch (IOException e) { ProtocolLogger.ROOT_LOGGER.debugf(e, "failed to process message"); } finally { getResultHandler().done(null); } } }
synchronized void failed(final ModelNode response) { if(prepared) { // in case commit or rollback throws an exception, to conform with the API we still send an operation-completed message completed(response); } else { assert responseChannel != null; try { // 2) send the operation-failed message (done) sendResponse(responseChannel, ModelControllerProtocol.PARAM_OPERATION_FAILED, response); } catch (IOException e) { ProtocolLogger.ROOT_LOGGER.debugf(e, "failed to process message"); } finally { getResultHandler().done(null); } } }