@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<ModelNode> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); if(param == DomainServerProtocol.PARAM_OK) { final ModelNode operations = new ModelNode(); operations.readExternal(input); resultHandler.done(operations); } else { resultHandler.failed(new IOException()); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<ModelNode> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); if(param == DomainServerProtocol.PARAM_OK) { final ModelNode operations = new ModelNode(); operations.readExternal(input); resultHandler.done(operations); } else { resultHandler.failed(new IOException()); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<ModelNode> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); if(param == DomainServerProtocol.PARAM_OK) { final ModelNode operations = new ModelNode(); operations.readExternal(input); resultHandler.done(operations); } else { resultHandler.failed(new IOException()); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.didNotReadEntireFile(e.getMissing())); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerMessages.MESSAGES.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerMessages.MESSAGES.didNotReadEntireFile(e.getMissing())); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.didNotReadEntireFile(e.getMissing())); } } }
@Override public void handleFailed(final ManagementResponseHeader header, final ActiveOperation.ResultHandler<T> resultHandler) { resultHandler.failed(new IOException(header.getError())); }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<Void> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); // If it failed if(param != DomainControllerProtocol.PARAM_OK) { final byte errorCode = input.readByte(); final String message = input.readUTF(); resultHandler.failed(new SlaveRegistrationException(SlaveRegistrationException.ErrorCode.parseCode(errorCode), message)); return; } resultHandler.done(null); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<Void> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); // If it failed if(param != DomainControllerProtocol.PARAM_OK) { final byte errorCode = input.readByte(); final String message = input.readUTF(); resultHandler.failed(new SlaveRegistrationException(SlaveRegistrationException.ErrorCode.parseCode(errorCode), message)); return; } resultHandler.done(null); } }
@Override public void handleFailed(final ManagementResponseHeader header, final ActiveOperation.ResultHandler<T> resultHandler) { resultHandler.failed(new IOException(header.getError())); }
@Override public void handleFailed(final ManagementResponseHeader header, final ActiveOperation.ResultHandler<T> resultHandler) { resultHandler.failed(new IOException(header.getError())); }
@Override public boolean executeAsync(final AsyncTask<A> task, boolean cancellable, final Executor executor) { try { executor.execute(createAsyncTaskRunner(task, cancellable)); return true; } catch (RejectedExecutionException e) { if(support.getResultHandler().failed(e)) { AbstractMessageHandler.safeWriteErrorResponse(channel, header, e); } } return false; }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerMessages.MESSAGES.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerMessages.MESSAGES.didNotReadEntireFile(e.getMissing())); } } }
@Override public boolean executeAsync(final AsyncTask<A> task, boolean cancellable, final Executor executor) { try { executor.execute(createAsyncTaskRunner(task, cancellable)); return true; } catch (RejectedExecutionException e) { if(support.getResultHandler().failed(e)) { AbstractMessageHandler.safeWriteErrorResponse(channel, header, e); } } return false; }
@Override public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestContext<A> context) throws IOException { final Exception error = ProtocolMessages.MESSAGES.noSuchResponseHandler(Integer.toHexString(header.getRequestId())); if(resultHandler.failed(error)) { safeWriteErrorResponse(context.getChannel(), context.getRequestHeader(), error); } } };
@Override public void executeAsync(final AsyncTask<A> task, final Executor executor) { try { executor.execute(createAsyncTaskRunner(task)); } catch (RejectedExecutionException e) { if(resultHandler.failed(e)) { safeWriteErrorResponse(channel, header, e); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<ModelNode> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); if(param == DomainServerProtocol.PARAM_OK) { final ModelNode operations = new ModelNode(); operations.readExternal(input); resultHandler.done(operations); } else { resultHandler.failed(new IOException()); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<Void> resultHandler, ManagementRequestContext<Void> voidManagementRequestContext) throws IOException { final byte param = input.readByte(); // If it failed if(param != DomainControllerProtocol.PARAM_OK) { final byte errorCode = input.readByte(); final String message = input.readUTF(); resultHandler.failed(new SlaveRegistrationException(SlaveRegistrationException.ErrorCode.parseCode(errorCode), message)); return; } resultHandler.done(null); } }
private void done(boolean commit) { final byte status = commit ? ModelControllerProtocol.PARAM_COMMIT : ModelControllerProtocol.PARAM_ROLLBACK; try { // Send the CompleteTxRequest channelAssociation.executeRequest(context.getOperationId(), new CompleteTxRequest(status)); } catch (Exception e) { resultHandler.failed(e); } } }, response);
private void done(boolean commit) { final byte status = commit ? ModelControllerProtocol.PARAM_COMMIT : ModelControllerProtocol.PARAM_ROLLBACK; try { // Send the CompleteTxRequest channelAssociation.executeRequest(context.getOperationId(), new CompleteTxRequest(status)); } catch (Exception e) { resultHandler.failed(e); } } }, response);