com.esri.arcgis.server
Class ServerCluster2

java.lang.Object
  extended by com.esri.arcgis.server.ServerCluster2
All Implemented Interfaces:
Serializable

public class ServerCluster2
extends Object
implements Serializable

Use this class to get a ServerConnection object or IServerObjectManager interface to a SOM machine based on the clustering configuration. You can choose between various types defined in ServerClusterType class. This class will attempt to give you a connection to SOM from the input list of SOM machines. This class is thread safe and does not block other threads for long periods of time which could be caused due to communication error.

See Also:
Serialized Form

Constructor Summary
ServerCluster2(Collection soms, ServerClusterType serverClusterType)
          Constructor that takes in a list of machine names and the clustering algorithm.
ServerCluster2(Collection soms, ServerClusterType serverClusterType, String domain, String username, String password)
          Constructor that takes in a list of machine names, the clustering algorithm and user credentials to use while attempting to connect to a SOM.
 
Method Summary
 void addSOM(String som)
          Add SOM to list
 int getReconnectTimeInMins()
          Function to get the time value in mins after which time this class will attempt to reconnect to a bad SOM.
 int getServerClusterSize()
          Returns the cluster size.
 ServerClusterType getServerClusterType()
          Return the ServerClusterType configured for this class.
 ServerConnection getServerConnection()
          Method that returns a connection to the SOM machine based on the ServerClusterType that has been configured on this class.
 String getUserDomain()
          Return the user domain that is used to connect to a SOM.
 String getUserName()
          Return the username that is used to connect to a SOM.
 String getUserPassword()
          Return the user password that is used to connect to a SOM.
 boolean hasServer()
          Returns true if there is atleast 1 SOM in the list.
 String peek()
          This method returns the name of the host to which this class will attempt to connect next (for any thread) based on the configured clustering algorithm without actually making a connection.
 void removeSOM(String som)
          Remove a SOM from the list
 void setConfigurationToCheck(String serverObjectName, String serverObjectType)
          Method to set configuration information to check when connected to SOMs.
 void setCredentials(String domain, String username, String password)
          Set the credentials to use while connecting to the SOM
 void setReconnectTimeInMins(int timeInMins)
          Function to set a time value in mins after which time this class will attempt to reconnect to a bad SOM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerCluster2

public ServerCluster2(Collection soms,
                      ServerClusterType serverClusterType)
Constructor that takes in a list of machine names and the clustering algorithm.

Parameters:
Collection - - list of SOM machine names
ServerClusterType - - clustering algorithm

ServerCluster2

public ServerCluster2(Collection soms,
                      ServerClusterType serverClusterType,
                      String domain,
                      String username,
                      String password)
Constructor that takes in a list of machine names, the clustering algorithm and user credentials to use while attempting to connect to a SOM.

Parameters:
soms - - list of SOM machines for clustering.
serverClusterType - - clustering algorithm.
domain - - String representing the domain of the user
username - - String representing the name of the user
password - - String representing the password of the user
Method Detail

setConfigurationToCheck

public void setConfigurationToCheck(String serverObjectName,
                                    String serverObjectType)
Method to set configuration information to check when connected to SOMs. While handing out connections to SOMs this class will test if the set configuration information is available with the SOM. If not, it will log an exception and search for the next SOM. If this information is not set, this class will not server for any configuration.

Parameters:
serverObjectName - - String representing the server object.
serverObjectType - - String representing the server object type.

setReconnectTimeInMins

public void setReconnectTimeInMins(int timeInMins)
Function to set a time value in mins after which time this class will attempt to reconnect to a bad SOM.


getReconnectTimeInMins

public int getReconnectTimeInMins()
Function to get the time value in mins after which time this class will attempt to reconnect to a bad SOM.

Returns:
int

getServerConnection

public ServerConnection getServerConnection()
                                     throws SOMNotAvailableException
Method that returns a connection to the SOM machine based on the ServerClusterType that has been configured on this class. If all the SOM machines in the cluster are down/cannot be reached this method will throw an exception.

Throws:
SOMNotAvailableException - - when there are no SOM machines to connect to.

peek

public String peek()
This method returns the name of the host to which this class will attempt to connect next (for any thread) based on the configured clustering algorithm without actually making a connection. However, the class does not guarantee that the next connection it will hand out will be to the same host that is returned by this method.

Returns:
String - name of the SOM machine to which it could attempt to connect next or returns null if no active SOM could be found.

addSOM

public void addSOM(String som)
            throws NullPointerException
Add SOM to list

Throws:
NullPointerException

removeSOM

public void removeSOM(String som)
               throws NullPointerException
Remove a SOM from the list

Throws:
NullPointerException

setCredentials

public void setCredentials(String domain,
                           String username,
                           String password)
Set the credentials to use while connecting to the SOM


getServerClusterType

public ServerClusterType getServerClusterType()
Return the ServerClusterType configured for this class.


getUserName

public String getUserName()
Return the username that is used to connect to a SOM.


getUserPassword

public String getUserPassword()
Return the user password that is used to connect to a SOM.


getUserDomain

public String getUserDomain()
Return the user domain that is used to connect to a SOM.


hasServer

public boolean hasServer()
Returns true if there is atleast 1 SOM in the list.


getServerClusterSize

public int getServerClusterSize()
Returns the cluster size.