com.andreani.xtol.proxy
Class ServerManager

java.lang.Object
  |
  +--com.andreani.xtol.proxy.ServerManager
All Implemented Interfaces:
ServiceDiscoveryListener

public class ServerManager
extends Object
implements ServiceDiscoveryListener

This class manages the list of available servers. This class is thread safe.

Version:
1.0
Author:
Stefano Andreani

Field Summary
protected  Category cat
          Log handler (Log4Java)
 
Constructor Summary
ServerManager()
          Constructor for the ServerManager object
 
Method Summary
 String findNextServer()
          This method returns the address of an available server.
 void serviceAdded(ServiceDiscoveryEvent evt)
          Method used by the ServiceDiscoveryListener interface to signal the presence of a new server.
 void serviceChanged(ServiceDiscoveryEvent evt)
          Method used by the ServiceDiscoveryListener interface to signal the change of a server.
 void serviceFailure(String failedAddr)
          Method invoked by the proxy if it noticed a server is not accessible
 void serviceRemoved(ServiceDiscoveryEvent evt)
          Method used by the ServiceDiscoveryListener interface to signal the leaving of a server.
 void terminate()
          Clear termination of the manager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected Category cat
Log handler (Log4Java)
Constructor Detail

ServerManager

public ServerManager()
Constructor for the ServerManager object
Method Detail

findNextServer

public String findNextServer()
This method returns the address of an available server. It follows a round robin rule. This is the method to override if you want to change manager policy.
Returns:
address of the next server to invoke

serviceAdded

public void serviceAdded(ServiceDiscoveryEvent evt)
Method used by the ServiceDiscoveryListener interface to signal the presence of a new server.
Specified by:
serviceAdded in interface ServiceDiscoveryListener
Parameters:
evt - signaling event

serviceRemoved

public void serviceRemoved(ServiceDiscoveryEvent evt)
Method used by the ServiceDiscoveryListener interface to signal the leaving of a server. This method does nothing if the server has been already removed from the managed lists.
Specified by:
serviceRemoved in interface ServiceDiscoveryListener
Parameters:
evt - signaling event

serviceFailure

public void serviceFailure(String failedAddr)
Method invoked by the proxy if it noticed a server is not accessible
Parameters:
failedAddr - address of the failed server

serviceChanged

public void serviceChanged(ServiceDiscoveryEvent evt)
Method used by the ServiceDiscoveryListener interface to signal the change of a server.
Specified by:
serviceChanged in interface ServiceDiscoveryListener
Parameters:
evt - signaling event

terminate

public void terminate()
Clear termination of the manager


Copyright © 2001 Stefano Andreani - No Rights Reserved ;-)