Package org.rhq.enterprise.server.core.comm

Examples of org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceMBean


        LOG.info("Removed agent: " + agent);
    }

    @ExcludeDefaultInterceptors
    public void destroyAgentClient(Agent agent) {
        ServerCommunicationsServiceMBean bootstrap = ServerCommunicationsServiceUtil.getService();
        try {
            // note, this destroys the KnownAgentClient on this HA node only.  It will leave other HA nodes "dirty", but
            // that is OK as there is logic in place to handle dirty entries.
            bootstrap.destroyKnownAgentClient(agent);
            if (LOG.isDebugEnabled()) {
                LOG.debug("agent client destroyed for agent: " + agent);
            }
        } catch (Exception e) {
            // certain unit tests won't create the agentClient
View Full Code Here


    @ExcludeDefaultInterceptors
    public AgentClient getAgentClient(Agent agent) {
        AgentClient client = null;

        try {
            ServerCommunicationsServiceMBean bootstrap = ServerCommunicationsServiceUtil.getService();
            client = bootstrap.getKnownAgentClient(agent);

            if (client != null) {
                // We assume the caller is asking for a client so it can send the agent messages,
                // so let's start the sender automatically for the caller so it doesn't need to remember to do it
                client.startSending();
View Full Code Here

    @Asynchronous
    @ExcludeDefaultInterceptors
    public void agentIsShuttingDown(String agentName) {
        Agent downedAgent = getAgentByName(agentName);

        ServerCommunicationsServiceMBean server_bootstrap = ServerCommunicationsServiceUtil.getService();
        server_bootstrap.removeDownedAgent(downedAgent.getRemoteEndpoint());
        LOG.info("Agent with name [" + agentName + "] just went down");

        agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), agentName, downedAgent.getId());
        return;
    }
View Full Code Here

        // so we can use this to our benefit.  Since we got a message from the given agent,
        // we know it is up!  So this is a simple way for us to detect agents coming online
        // without us having to periodically poll each and every agent.

        try {
            ServerCommunicationsServiceMBean server_comm = ServerCommunicationsServiceUtil.getService();
            server_comm.addStartedAgent(agent);
        } catch (Exception e) {
            LOG.info("Cannot flag the agent as started for some reason", e);
        }

        return;
View Full Code Here

        Query q = entityManager.createNamedQuery(Agent.QUERY_FIND_ALL_SUSPECT_AGENTS);
        q.setParameter("dateThreshold", nowEpoch - maximumQuietTimeAllowed);
        records = q.getResultList();

        ServerCommunicationsServiceMBean serverComm = null;

        for (AgentLastAvailabilityPingComposite record : records) {
            long lastReport = record.getLastAvailabilityPing();
            long timeSinceLastReport = nowEpoch - lastReport;

            // Only show this message a few times so we do not flood the log with the same message if the agent is down a long time
            // we show it as soon as we detect it going down (within twice max quiet time allowed) or we show it
            // after every 6th hour it's detected to be down (again, within twice max quiet time).  Effectively, you'll see
            // this message appear about 4 times per 6-hours for a downed agent if using the default max quiet time.
            // Note that in here we also make sure the agent client is shutdown. We do it here because, even if the agent
            // was already backfilled, we still want to do this in case somehow the client was started again.
            if ((timeSinceLastReport % 21600000L) < (maximumQuietTimeAllowed * 2L)) {
                if (serverComm == null) {
                    serverComm = ServerCommunicationsServiceUtil.getService();
                }

                serverComm.removeDownedAgent(record.getRemoteEndpoint());
            }

            // we can avoid doing this over and over again for agents that are down a long time by seeing if it's
            // already backfilled.  Note that we do not log the above warn message down here in this if-statement,
            // because I think we still want to log that we think an agent is down periodically.
View Full Code Here

            log.error(err_string);
            throw new IllegalArgumentException(err_string);
        }

        try {
            ServerCommunicationsServiceMBean sc = ServerCommunicationsServiceUtil.getService();

            String dir = sc.getConfiguration().getAgentFilesDirectory();
            File file_to_stream = new File(dir, file);

            // Make sure file_to_stream exists - its possible another server deployed this
            // but our server hasn't had a chance to download it from the database yet.
            // If this file does not exist, we need to immediately perform an agent scan
View Full Code Here

    private void pingEndpoint(String endpoint) throws AgentRegistrationException {
        AgentRegistrationException failure = null;

        try {
            ServerCommunicationsServiceMBean sc = ServerCommunicationsServiceUtil.getService();
            boolean ping = sc.pingEndpoint(endpoint, 10000L);

            if (!ping) {
                // this is mainly to support agentspawn environments but I suppose this could happen
                // on "real" systems.  If the agent's machine is heavily loaded, it is possible that
                // the agent wasn't given enough time to respond to the ping.  Let's at least try
                // one more time, because once this ping failure is confirmed, it means the agent
                // will be dead in the water and hang until an admin can reconfigure it (a second
                // failure probably means it really is a configuration problem)
                ping = sc.pingEndpoint(endpoint, 20000L);

                if (!ping) {
                    failure = new AgentRegistrationException("Server cannot ping the agent's endpoint. "
                        + "The agent's endpoint is probably invalid "
                        + "or there is a firewall preventing the server from connecting to the agent. " + "Endpoint: "
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceMBean

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.