Package org.jboss.remoting3.HandleableCloseable

Examples of org.jboss.remoting3.HandleableCloseable.Key


    public static DomainControllerClientConfig create(final ExecutorService executorService) throws IOException {
        return create(executorService, false);
    }

    static DomainControllerClientConfig create(final ExecutorService executorService, boolean destroyExecutor) throws IOException {
        final Endpoint endpoint = Remoting.createEndpoint(ENDPOINT_NAME, OptionMap.EMPTY);
        endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(), OptionMap.EMPTY);
        return new DomainControllerClientConfig(endpoint, executorService, destroyExecutor);
    }
View Full Code Here


                }
            }
        }

        private void doProcessRequest() {
            final Key closeKey = getChannel().addCloseHandler(new CloseHandler<Channel>() {
                public void handleClose(final Channel closed, final IOException exception) {
                    asynchRequests.remove(getHeader().getBatchId());
                }
            });
            OperationAttachmentsProxy attachmentsProxy = new OperationAttachmentsProxy(getChannel(), batchId, attachmentsLength);
            try {
                try {
                    log.tracef("Executing client request %d(%d)", batchId, getHeader().getRequestId());
                    if (asynch) {
                        //register the cancel handler
                        asynchRequests.put(batchId, Thread.currentThread());
                    }
                    result = controller.execute(
                            operation,
                            new OperationMessageHandlerProxy(getChannel(), batchId),
                            ModelController.OperationTransactionControl.COMMIT,
                            attachmentsProxy);
                } catch (Exception e) {
                    final ModelNode failure = new ModelNode();
                    failure.get(OUTCOME).set(FAILED);
                    failure.get(FAILURE_DESCRIPTION).set(e.getClass().getName() + ":" + e.getMessage());
                    result = failure;
                    attachmentsProxy.shutdown(e);
                } finally {
                    log.tracef("Executed client request %d", batchId);
                }
            } finally {
                if (asynch) {
                    asynchRequests.remove(batchId);
                }
                closeKey.remove();
            }
        }
View Full Code Here

                }
            }
        }

        private void doProcessRequest() {
            final Key closeKey = getChannel().addCloseHandler(new CloseHandler<Channel>() {
                public void handleClose(final Channel closed, final IOException exception) {
                    asynchRequests.remove(getHeader().getBatchId());
                }
            });
            OperationAttachmentsProxy attachmentsProxy = new OperationAttachmentsProxy(getChannel(), batchId, attachmentsLength);
            try {
                try {
                    ROOT_LOGGER.tracef("Executing client request %d(%d)", batchId, getHeader().getRequestId());
                    if (asynch) {
                        //register the cancel handler
                        asynchRequests.put(batchId, Thread.currentThread());
                    }
                    result = controller.execute(
                            operation,
                            new OperationMessageHandlerProxy(getChannel(), batchId),
                            ModelController.OperationTransactionControl.COMMIT,
                            attachmentsProxy);
                } catch (Exception e) {
                    final ModelNode failure = new ModelNode();
                    failure.get(OUTCOME).set(FAILED);
                    failure.get(FAILURE_DESCRIPTION).set(e.getClass().getName() + ":" + e.getMessage());
                    result = failure;
                    attachmentsProxy.shutdown(e);
                } finally {
                    ROOT_LOGGER.tracef("Executed client request %d", batchId);
                }
            } finally {
                if (asynch) {
                    asynchRequests.remove(batchId);
                }
                closeKey.remove();
            }
        }
View Full Code Here

        }
    }

    protected static void writeResponse(final Channel channel, final ManagementRequestHeader header, final Exception error) throws IOException {
        final ManagementResponseHeader response = ManagementResponseHeader.create(header, error);
        final MessageOutputStream output = channel.writeMessage();
        try {
            writeHeader(response, output);
            output.write(ManagementProtocol.RESPONSE_END);
            output.close();
        } finally {
            StreamUtils.safeClose(output);
        }
    }
View Full Code Here

        }
    }

    protected static void writeResponse(final Channel channel, final ManagementRequestHeader header, final byte param) throws IOException {
        final ManagementResponseHeader response = ManagementResponseHeader.create(header);
        final MessageOutputStream output = channel.writeMessage();
        try {
            writeHeader(response, output);
            output.write(param);
            output.write(ManagementProtocol.RESPONSE_END);
            output.close();
        } finally {
            StreamUtils.safeClose(output);
        }
    }
View Full Code Here

                    getExecutor().execute(runner);
                }

                @Override
                public FlushableDataOutput writeMessage(final ManagementProtocolHeader header) throws IOException {
                    final MessageOutputStream os = channel.writeMessage();
                    return writeHeader(header, os);
                }
            });

        } catch (Exception e) {
View Full Code Here

                    getExecutor().execute(runner);
                }

                @Override
                public FlushableDataOutput writeMessage(final ManagementProtocolHeader header) throws IOException {
                    final MessageOutputStream os = channel.writeMessage();
                    return writeHeader(header, os);
                }

            });
        } catch (Exception e) {
View Full Code Here

     * @param error the error
     * @throws IOException
     */
    protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Exception error) throws IOException {
        final ManagementResponseHeader response = ManagementResponseHeader.create(header, error);
        final MessageOutputStream output = channel.writeMessage();
        try {
            writeHeader(response, output);
            output.close();
        } finally {
            StreamUtils.safeClose(output);
        }
    }
View Full Code Here

     * @param header the protocol header
     * @throws IOException for any error
     */
    protected static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {
        final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());
        final MessageOutputStream output = channel.writeMessage();
        try {
            writeHeader(response, output);
            output.close();
        } finally {
            StreamUtils.safeClose(output);
        }
    }
View Full Code Here

    protected void writeException(final ChannelAssociation channelAssociation, final MarshallerFactory marshallerFactory,
                                  final short invocationId, final Throwable t,
                                  final Map<String, Object> attachments) throws IOException {
        final DataOutputStream outputStream;
        final MessageOutputStream messageOutputStream;
        try {
            messageOutputStream = channelAssociation.acquireChannelMessageOutputStream();
        } catch (Exception e) {
            throw EjbMessages.MESSAGES.failedToOpenMessageOutputStream(e);
        }
View Full Code Here

TOP

Related Classes of org.jboss.remoting3.HandleableCloseable.Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.