Package org.jboss.as.protocol.mgmt

Examples of org.jboss.as.protocol.mgmt.ManagementChannelHandler


    private final ManagementChannelHandler channelAssociation;
    private final ModelControllerClientConfiguration clientConfiguration;
    private final StackTraceElement[] allocationStackTrace;

    public RemotingModelControllerClient(final ModelControllerClientConfiguration configuration) {
        this.channelAssociation = new ManagementChannelHandler(new ManagementClientChannelStrategy() {
            @Override
            public Channel getChannel() throws IOException {
                return getOrCreateChannel();
            }
View Full Code Here


        this.domainController = domainController;
    }

    @Override
    public Channel.Key startReceiving(final Channel channel) {
        final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor());
        // Assemble the request handlers for the domain channel
        handler.addHandlerFactory(new HostControllerRegistrationHandler(handler, getController(), domainController));
        handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler));
        handler.addHandlerFactory(new MasterDomainControllerOperationHandlerImpl(domainController));
        final Channel.Key key = channel.addCloseHandler(new CloseHandler<Channel>() {
            @Override
            public void handleClose(Channel closed, IOException exception) {
                handler.shutdown();
                try {
                    handler.awaitCompletion(100, TimeUnit.MILLISECONDS);
                } catch (Exception e) {
                    ROOT_LOGGER.serviceShutdownIncomplete(e);
                } finally {
                    handler.shutdownNow();
                }
            }
        });
        channel.receiveMessage(handler.getReceiver());
        return key;
    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public synchronized void start(StartContext context) throws StartException {
        final RemoteDomainConnection connection;
        final ManagementChannelHandler handler;
        try {

            // Include additional local host information when registering at the DC
            final ModelNode hostInfo = createLocalHostHostInfo(localHostInfo, productConfig);

View Full Code Here

        this.localHostName = localHostName;
        this.localHostInfo = localHostInfo;
        this.configuration = configuration;
        this.realm = realm;
        this.executorService = executorService;
        this.channelHandler = new ManagementChannelHandler(this, executorService);
    }
View Full Code Here

                final Runnable task = new Runnable() {
                    @Override
                    public void run() {
                        CONTROLLER_MANAGEMENT_LOGGER.serverRegistered(serverName, channel);
                        // Create the server mgmt handler
                        final ManagementChannelHandler handler = new ManagementChannelHandler(channel, executorService, new ServerHandlerFactory(serverName));
                        // Register the communication channel
                        inventory.serverCommunicationRegistered(serverName, handler);
                        // Send the response once the server is fully registered
                        safeWriteResponse(channel, header, null);
                        // Onto the next message
                        channel.receiveMessage(handler.getReceiver());
                    }
                };
                executorService.execute(task);
            // Handle the server reconnect request
            } else if(type == DomainServerProtocol.SERVER_RECONNECT_REQUEST) {
                expectHeader(input, DomainServerProtocol.PARAM_SERVER_NAME);
                final String serverName = input.readUTF();
                final Runnable task = new Runnable() {
                    @Override
                    public void run() {
                        CONTROLLER_MANAGEMENT_LOGGER.serverRegistered(serverName, channel);
                        // Create the server mgmt handler
                        final ManagementChannelHandler handler = new ManagementChannelHandler(channel, executorService, new ServerHandlerFactory(serverName));
                        // Check if the server is still in sync with the domain model
                        final byte param;
                        if(inventory.serverReconnected(serverName, handler)) {
                            param = DomainServerProtocol.PARAM_OK;
                        } else {
                            param = DomainServerProtocol.PARAM_RESTART_REQUIRED;
                        }
                        // Notify the server whether configuration is still in sync or it requires a reload
                        safeWriteResponse(channel, header, param);
                        // Onto the next message
                        channel.receiveMessage(handler.getReceiver());
                    }
                };
                executorService.execute(task);
            } else {
                safeWriteResponse(channel, header, MESSAGES.unrecognizedType(type));
View Full Code Here

    private final ManagementChannelHandler channelAssociation;
    private final ModelControllerClientConfiguration clientConfiguration;

    public RemotingModelControllerClient(final ModelControllerClientConfiguration configuration) {
        this.channelAssociation = new ManagementChannelHandler(new ManagementClientChannelStrategy() {
            @Override
            public Channel getChannel() throws IOException {
                return getOrCreateChannel();
            }
View Full Code Here

    private ModelControllerClient setupTestClient(final ModelController controller) throws IOException {
        try {
            channels.setupRemoting(new ManagementChannelInitialization() {
                @Override
                public HandleableCloseable.Key startReceiving(Channel channel) {
                    final ManagementChannelHandler support = new ManagementChannelHandler(channel, channels.getExecutorService());
                    support.addHandlerFactory(new ModelControllerClientOperationHandler(controller, support));
                    channel.receiveMessage(support.getReceiver());
                    return null;
                }
            });
            channels.startClientConnetion();
        } catch (Exception e) {
View Full Code Here

                final Runnable task = new Runnable() {
                    @Override
                    public void run() {
                        CONTROLLER_MANAGEMENT_LOGGER.serverRegistered(serverName, channel);
                        // Create the server mgmt handler
                        final ManagementChannelHandler handler = new ManagementChannelHandler(channel, executorService, new ServerHandlerFactory(serverName));
                        // Register the communication channel
                        inventory.serverCommunicationRegistered(serverName, handler);
                        // Send the response once the server is fully registered
                        safeWriteResponse(channel, header, null);
                        // Onto the next message
                        channel.receiveMessage(handler.getReceiver());
                    }
                };
                executorService.execute(task);
            // Handle the server reconnect request
            } else if(type == DomainServerProtocol.SERVER_RECONNECT_REQUEST) {
                expectHeader(input, DomainServerProtocol.PARAM_SERVER_NAME);
                final String serverName = input.readUTF();
                final Runnable task = new Runnable() {
                    @Override
                    public void run() {
                        CONTROLLER_MANAGEMENT_LOGGER.serverRegistered(serverName, channel);
                        // Create the server mgmt handler
                        final ManagementChannelHandler handler = new ManagementChannelHandler(channel, executorService, new ServerHandlerFactory(serverName));
                        // Check if the server is still in sync with the domain model
                        final byte param;
                        if(inventory.serverReconnected(serverName, handler)) {
                            param = DomainServerProtocol.PARAM_OK;
                        } else {
                            param = DomainServerProtocol.PARAM_RESTART_REQUIRED;
                        }
                        // Notify the server whether configuration is still in sync or it requires a reload
                        safeWriteResponse(channel, header, param);
                        // Onto the next message
                        channel.receiveMessage(handler.getReceiver());
                    }
                };
                executorService.execute(task);
            } else {
                safeWriteResponse(channel, header, MESSAGES.unrecognizedType(type));
View Full Code Here

        this.localHostName = localHostName;
        this.localHostInfo = localHostInfo;
        this.configuration = configuration;
        this.realm = realm;
        this.executorService = executorService;
        this.channelHandler = new ManagementChannelHandler(this, executorService);
    }
View Full Code Here

        try {
            channels = new RemoteChannelPairSetup();
            channels.setupRemoting(new ManagementChannelInitialization() {
                @Override
                public HandleableCloseable.Key startReceiving(Channel channel) {
                    final ManagementChannelHandler support = new ManagementChannelHandler(channel, channels.getExecutorService());
                    support.addHandlerFactory(new TransactionalModelControllerOperationHandler(proxiedController, support));
                    channel.addCloseHandler(new CloseHandler<Channel>() {
                        @Override
                        public void handleClose(Channel closed, IOException exception) {
                            support.shutdownNow();
                        }
                    });
                    channel.receiveMessage(support.getReceiver());
                    return null;
                }
            });
            channels.startClientConnetion();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        final Channel clientChannel = channels.getClientChannel();
        final ManagementChannelHandler support = new ManagementChannelHandler(clientChannel, channels.getExecutorService());
        final RemoteProxyController proxyController = RemoteProxyController.create(support, proxyNodeAddress, ProxyOperationAddressTranslator.SERVER);
        clientChannel.addCloseHandler(new CloseHandler<Channel>() {
            @Override
            public void handleClose(Channel closed, IOException exception) {
                support.shutdownNow();
            }
        });
        clientChannel.receiveMessage(support.getReceiver());
        return proxyController;
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.protocol.mgmt.ManagementChannelHandler

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.