public class AgentAutoDiscoveryListener extends Object implements AutoDiscoveryListener
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.
| Constructor and Description |
|---|
AgentAutoDiscoveryListener(AgentMain agent,
RemoteCommunicator communicator)
Constructor for
AgentAutoDiscoveryListener that is given the agent that created this listener. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public AgentAutoDiscoveryListener(AgentMain agent, RemoteCommunicator communicator)
AgentAutoDiscoveryListener that is given the agent that created this listener.agent - communicator - a communicator that we can use to send commands directly to the server that we are listening
forpublic void serverOnline(org.jboss.remoting.InvokerLocator locator)
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.
serverOnline in interface AutoDiscoveryListenerAutoDiscoveryListener.serverOnline(InvokerLocator)public void serverOffline(org.jboss.remoting.InvokerLocator locator)
serverOffline in interface AutoDiscoveryListenerAutoDiscoveryListener.serverOffline(InvokerLocator)Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.