org.rhq.enterprise.agent
Class AgentAutoDiscoveryListener

java.lang.Object
  extended by org.rhq.enterprise.agent.AgentAutoDiscoveryListener
All Implemented Interfaces:
AutoDiscoveryListener

public class AgentAutoDiscoveryListener
extends Object
implements AutoDiscoveryListener

This is the agent's listener that will get notified when new RHQ Servers come on and offline.

Because a remoting server's invoker locator representation may differ slightly on the client-side, this listener performs some additional work to try to determine what the RHQ Server calls itself (as opposed to what the agent calls the server). Otherwise, we may get a notification about the RHQ Server and not realize it because we will be looking for one invoker locator representation when the notification will have a slightly different one (this illustrates a slight hole in the InvokerLocator.equals() implementation). If we cannot determine what the RHQ Server's true locator is, then when we compare the locator in the notification with the one we are looking for, they may look like different locators when they are actually referring to the same server endpoint.

Author:
John Mazzitelli

Constructor Summary
AgentAutoDiscoveryListener(AgentMain agent, RemoteCommunicator communicator)
          Constructor for AgentAutoDiscoveryListener that is given the agent that created this listener.
 
Method Summary
 void serverOffline(org.jboss.remoting.InvokerLocator locator)
          If the auto-detected endpoint is the server we are looking for, this tells the agent to stop sending messages.
 void serverOnline(org.jboss.remoting.InvokerLocator locator)
          If the auto-detected endpoint is the RHQ Server we are looking for, enable the agent to start sending messages to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentAutoDiscoveryListener

public AgentAutoDiscoveryListener(AgentMain agent,
                                  RemoteCommunicator communicator)
Constructor for AgentAutoDiscoveryListener that is given the agent that created this listener.

Parameters:
agent -
communicator - a communicator that we can use to send commands directly to the server that we are listening for
Method Detail

serverOnline

public void serverOnline(org.jboss.remoting.InvokerLocator locator)
If the auto-detected endpoint is the RHQ Server we are looking for, enable the agent to start sending messages to it.

If this listener does not yet know what the RHQ Server calls itself, then we assume the new remote server coming online is our server and so we attempt to directly send our server an IdentifyCommand to ask it for its true invoker locator representation. If our server is online, then the identify command's response will contain the server's true invoker locator and we will use it rather than the locator as configured in the agent.

Specified by:
serverOnline in interface AutoDiscoveryListener
See Also:
AutoDiscoveryListener.serverOnline(InvokerLocator)

serverOffline

public void serverOffline(org.jboss.remoting.InvokerLocator locator)
If the auto-detected endpoint is the server we are looking for, this tells the agent to stop sending messages.

Specified by:
serverOffline in interface AutoDiscoveryListener
See Also:
AutoDiscoveryListener.serverOffline(InvokerLocator)


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.