Package org.rhq.enterprise.communications.command.client

Examples of org.rhq.enterprise.communications.command.client.RemoteCommunicator


                        if (!primaryAddress.equals(currentServerAddress) || primaryPort != currentServerPort) {
                            LOG.info(AgentI18NResourceKeys.NOT_TALKING_TO_PRIMARY_SERVER, primaryAddress, primaryPort,
                                currentServerAddress, currentServerPort);
                            // create our own comm so we ping in an isolated client - don't reuse the sender's comm for this
                            RemoteCommunicator comm = this.agent.createServerRemoteCommunicator(transport,
                                primaryAddress, primaryPort, transportParams);
                            if (ping(comm)) {
                                LOG.info(AgentI18NResourceKeys.PRIMARY_SERVER_UP, primaryAddress, primaryPort);
                                failoverList.resetIndex(); // so the failover method call starts at the top
                                this.agent.failoverToNewServer(sender.getRemoteCommunicator()); // note that we make sure we pass in the sender's comm
View Full Code Here


                out.println(MSG.getMsg(AgentI18NResourceKeys.HELP_SYNTAX_LABEL, getSyntax()));
            } else {
                ServerEndpoint serverEndpoint = AgentUtils.getServerEndpoint(agent.getConfiguration(), args[1]);

                // use the generic client utility to issue the command
                RemoteCommunicator rc = agent.createServerRemoteCommunicator(serverEndpoint.transport,
                    serverEndpoint.namePort.address, serverEndpoint.namePort.port, serverEndpoint.transportParams);
                GenericCommandClient client = new GenericCommandClient(rc);

                out.println(MSG.getMsg(AgentI18NResourceKeys.IDENTIFY_ASK_REMOTE_SERVER_FOR_ID, args[1]));
                sender.preprocessCommand(command);
View Full Code Here

        } catch (Exception e) {
            LOG.warn(AgentI18NResourceKeys.CANNOT_SWITCH_TO_INVALID_SERVER, server, ThrowableUtil.getAllMessages(e));
            return false;
        }

        RemoteCommunicator comm;

        try {
            comm = getClientCommandSender().getRemoteCommunicator();
            if (comm == null) {
                throw new IllegalStateException(); // i don't think this will ever happen, but just in case
            }
        } catch (Exception e) {
            LOG.warn(AgentI18NResourceKeys.CANNOT_SWITCH_NULL_COMMUNICATOR, server, ThrowableUtil.getAllMessages(e));
            return false;
        }

        // remember this in case we fail - we have to revert back to the original server we were talking to
        String originalServerEndpoint = comm.getRemoteEndpoint();

        // need to synch on last failover time so we don't clash with the real failover stuff
        synchronized (m_lastFailoverTime) {
            boolean ok = switchCommServer(comm, newServer.namePort, newServer.transport, newServer.transportParams);
            if (!ok) {
                try {
                    // we are switching back to the original server because our switch failed
                    comm.setRemoteEndpoint(originalServerEndpoint);
                    config.setServerLocatorUri(currentServerTransport, currentServerAddress, currentServerPort,
                        currentServerTransportParams);
                } catch (Exception e) {
                    // this should never happen
                    LOG.warn(AgentI18NResourceKeys.CANNOT_SWITCH_TO_INVALID_SERVER, originalServerEndpoint, e);
View Full Code Here

     * @return the client sender that was created
     *
     * @throws Exception if the configured server locator URI in malformed
     */
    private ClientCommandSender createClientCommandSender() throws Exception {
        RemoteCommunicator remote_comm = createServerRemoteCommunicator(null, true, true);
        ClientCommandSenderConfiguration config = m_configuration.getClientCommandSenderConfiguration();

        ClientCommandSender client_sender = new ClientCommandSender(remote_comm, config, m_previouslyQueueCommands);

        for (CommandPreprocessor preproc : client_sender.getCommandPreprocessors()) {
View Full Code Here

        long timeout = m_configuration.getClientSenderCommandTimeout();
        if (timeout > 0) {
            config.put("timeout", Long.toString(timeout));
        }

        RemoteCommunicator remote_comm = new JBossRemotingRemoteCommunicator(uri, config);
        if (withFailover) {
            remote_comm.setFailureCallback(new FailoverFailureCallback(this));
        }
        if (withInitializer) {
            remote_comm.setInitializeCallback(new ConnectAgentInitializeCallback(this));
        }

        return remote_comm;
    }
View Full Code Here

        ssl_config.put(SSLSocketBuilder.REMOTING_SERVER_AUTH_MODE, Boolean
            .toString(client_config.securityServerAuthMode));
        ssl_config.put(SSLSocketBuilder.REMOTING_SOCKET_USE_CLIENT_MODE, "true");

        try {
            RemoteCommunicator remote_comm = new JBossRemotingRemoteCommunicator(server_endpoint, ssl_config);

            for (ServiceContainerSenderCreationListener listener : m_senderCreationListeners) {
                listener.preCreate(this, remote_comm, client_config);
            }
View Full Code Here

                .toString(client_config.securityServerAuthMode));
            ssl_config.put(SSLSocketBuilder.REMOTING_SOCKET_USE_CLIENT_MODE, "true");
        }

        try {
            RemoteCommunicator remote_comm = new JBossRemotingRemoteCommunicator(server_endpoint, ssl_config);
            for (ServiceContainerSenderCreationListener listener : m_senderCreationListeners) {
                listener.preCreate(this, remote_comm, client_config);
            }

            ClientCommandSender sender = new ClientCommandSender(remote_comm, client_config);
View Full Code Here

        // install our streaming pojo in our server #2
        pojoImpl = new CommTestStreamPojo(this);
        serviceContainer2.addRemotePojo(pojoImpl, ICommTestStreamPojo.class);

        // setup the client to server #2
        RemoteCommunicator comm = new JBossRemotingRemoteCommunicator("socket://127.0.0.1:" +
            CommTestConstants.CONNECTOR2_BIND_PORT + "/?force_remote=true");
        ClientCommandSenderConfiguration config = new ClientCommandSenderConfiguration();
        config.maxConcurrent = Integer.MAX_VALUE; // let the sender send as fast as it can
        config.defaultTimeoutMillis = 60000L;
        config.commandSpoolFileName = null;
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.command.client.RemoteCommunicator

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.