protected FlushableDataOutput writeGenericResponseHeader(final ManagementRequestContext<Void> context) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); return context.writeMessage(header); }
protected static void safeWriteResponse(final ManagementRequestContext<?> context, final Exception error) { safeWriteResponse(context.getChannel(), context.getRequestHeader(), error); }
public static <A> void writeResponse(final ResponseWriter writer, final ManagementRequestContext<A> context) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); writeResponse(writer, context, header); }
public static <A> void writeResponse(final ResponseWriter writer, final ManagementRequestContext<A> context) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); writeResponse(writer, context, header); }
protected FlushableDataOutput writeGenericResponseHeader(final ManagementRequestContext<Void> context) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); return context.writeMessage(header); }
protected FlushableDataOutput writeGenericResponseHeader(final ManagementRequestContext<Void> context) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); return context.writeMessage(header); }
protected static void safeWriteResponse(final ManagementRequestContext<?> context, final Exception error) { safeWriteResponse(context.getChannel(), context.getRequestHeader(), error); }
public static <A> void writeResponse(final ResponseWriter writer, final ManagementRequestContext<A> context) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); writeResponse(writer, context, header); }
protected static void safeWriteResponse(final ManagementRequestContext<?> context, final Exception error) { safeWriteResponse(context.getChannel(), context.getRequestHeader(), error); }
@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); } } };
/** * Send an operation response. * * @param context the request context * @param responseType the response type * @param response the operation response * @throws IOException for any error */ static void sendResponse(final ManagementRequestContext<RegistrationContext> context, final byte responseType, final ModelNode response) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(header); try { sendResponse(output, responseType, response); } finally { StreamUtils.safeClose(output); } }
/** * Send a operation response. * * @param context the request context * @param responseType the response type * @param response the operation response * @throws IOException for any error */ static void sendResponse(final ManagementRequestContext<RegistrationContext> context, final byte responseType, final ModelNode response) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(header); try { sendResponse(output, responseType, response); } finally { StreamUtils.safeClose(output); } }
/** * Send an operation response. * * @param context the request context * @param responseType the response type * @param response the operation response * @throws IOException for any error */ static void sendResponse(final ManagementRequestContext<RegistrationContext> context, final byte responseType, final ModelNode response) throws IOException { final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(header); try { sendResponse(output, responseType, response); } finally { StreamUtils.safeClose(output); } }
@Override public void sendRequest(final ActiveOperation.ResultHandler<T> resultHandler, final ManagementRequestContext<A> context) throws IOException { final FlushableDataOutput output = context.writeMessage(context.getRequestHeader()); try { sendRequest(resultHandler, context, output); output.writeByte(ManagementProtocol.REQUEST_END); output.close(); } finally { StreamUtils.safeClose(output); } }
@Override public void sendRequest(final ActiveOperation.ResultHandler<T> resultHandler, final ManagementRequestContext<A> context) throws IOException { final FlushableDataOutput output = context.writeMessage(context.getRequestHeader()); try { sendRequest(resultHandler, context, output); output.writeByte(ManagementProtocol.REQUEST_END); output.close(); } finally { StreamUtils.safeClose(output); } }
@Override public void sendRequest(final ActiveOperation.ResultHandler<T> resultHandler, final ManagementRequestContext<A> context) throws IOException { final FlushableDataOutput output = context.writeMessage(context.getRequestHeader()); try { sendRequest(resultHandler, context, output); output.writeByte(ManagementProtocol.REQUEST_END); output.close(); } finally { StreamUtils.safeClose(output); } }
@Override public void execute(final ManagementRequestContext<ExecuteRequestContext> context) throws Exception { FlushableDataOutput output = null; try { MGMT_OP_LOGGER.tracef("Transmitting response for %d", context.getOperationId()); final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader()); output = context.writeMessage(header); // response type output.writeByte(responseType); // operation result response.writeExternal(output); // response end output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } catch (IOException toCache) { exceptionHolder.exception = toCache; } finally { StreamUtils.safeClose(output); latch.countDown(); } } }, false);
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<Void> context) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.write(ManagementProtocol.TYPE_PONG); output.writeLong(connectionId); output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } resultHandler.done(null); }
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<Void> context) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.write(ManagementProtocol.TYPE_PONG); output.writeLong(connectionId); output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } resultHandler.done(null); }
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<Void> context) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.write(ManagementProtocol.TYPE_PONG); output.writeLong(connectionId); output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } resultHandler.done(null); }