/** * Receive a notification that the channel was closed. * * This is used for the {@link ManagementClientChannelStrategy.Establishing} since it might use multiple channels. * * @param closed the closed resource * @param e the exception which occurred during close, if any */ public void handleChannelClosed(final Channel closed, final IOException e) { for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { if (activeOperation.getChannel() == closed) { // Only call cancel, to also interrupt still active threads activeOperation.getResultHandler().cancel(); } } }
/** * Receive a notification that the channel was closed. * * This is used for the {@link ManagementClientChannelStrategy.Establishing} since it might use multiple channels. * * @param closed the closed resource * @param e the exception which occurred during close, if any */ public void handleChannelClosed(final Channel closed, final IOException e) { for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { if (activeOperation.getChannel() == closed) { // Only call cancel, to also interrupt still active threads activeOperation.getResultHandler().cancel(); } } }
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<ModelNode> resultHandler, final ManagementRequestContext<Void> context) throws IOException { ControllerLogger.MGMT_OP_LOGGER.tracef("Cancellation of %d requested", context.getOperationId()); context.executeAsync(new ManagementRequestContext.AsyncTask<Void>() { @Override public void execute(ManagementRequestContext<Void> context) throws Exception { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } } }, false); resultHandler.cancel(); } }
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<ModelNode> resultHandler, final ManagementRequestContext<Void> context) throws IOException { context.executeAsync(new ManagementRequestContext.AsyncTask<Void>() { @Override public void execute(ManagementRequestContext<Void> context) throws Exception { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } } }); resultHandler.cancel(); } }
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<ModelNode> resultHandler, final ManagementRequestContext<Void> context) throws IOException { ControllerLogger.MGMT_OP_LOGGER.tracef("Cancellation of %d requested", context.getOperationId()); context.executeAsync(new ManagementRequestContext.AsyncTask<Void>() { @Override public void execute(ManagementRequestContext<Void> context) throws Exception { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } } }, false); resultHandler.cancel(); } }
@Override public void handleRequest(final DataInput input, final ActiveOperation.ResultHandler<ModelNode> resultHandler, final ManagementRequestContext<Void> context) throws IOException { context.executeAsync(new ManagementRequestContext.AsyncTask<Void>() { @Override public void execute(ManagementRequestContext<Void> context) throws Exception { final ManagementResponseHeader response = ManagementResponseHeader.create(context.getRequestHeader()); final FlushableDataOutput output = context.writeMessage(response); try { output.writeByte(ManagementProtocol.RESPONSE_END); output.close(); } finally { StreamUtils.safeClose(output); } } }); resultHandler.cancel(); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<ModelNode> resultHandler, ManagementRequestContext<OperationExecutionContext> context) throws IOException { // Once the remote operation returns, we can set the cancelled status resultHandler.cancel(); } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<ModelNode> resultHandler, ManagementRequestContext<OperationExecutionContext> context) throws IOException { // Once the remote operation returns, we can set the cancelled status resultHandler.cancel(); } }