Class ClusterStateService
- java.lang.Object
-
- com.sun.identity.common.GeneralTaskRunnable
-
- com.iplanet.dpro.session.service.cluster.ClusterStateService
-
- All Implemented Interfaces:
TaskRunnable,Runnable
public class ClusterStateService extends GeneralTaskRunnable
TheClusterStateServicemonitors the state of Server instances that are part of the current Site. It also monitors the state of remote Sites via the same mechanism. This functionality is used as part of making "internal request routing" requests. Note: This service will monitor all provided Sites regardless of whether they are the same Site as the current Server.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_PERIODdefault StateInfo check time 10 millisecondsstatic intDEFAULT_TIMEOUTindividual server wait default time out 10 millisecondsstatic DebugsessionDebugService Globals-
Fields inherited from class com.sun.identity.common.GeneralTaskRunnable
headTask, nextTask, previousTask
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddElement(Object obj)Implements for GeneralTaskRunnable.protected Set<String>getDownServersAndSites()Get Server and Site IDs which are in a Down State.protected StringgetLocalServerId()Get our Local Server IdlonggetRunPeriod()Implements for GeneralTaskRunnableprotected Map<String,com.iplanet.dpro.session.service.cluster.ClusterStateService.StateInfo>getServers()Get Servers within Clusterprotected com.iplanet.dpro.session.service.cluster.ClusterStateService.StateInfo[]getServerSelectionList()Get the Server Selection List, common to all Servers in Cluster.booleanisEmpty()Implements for GeneralTaskRunnable.protected booleanisLocalServerId(String serverId)Is Specified ServerId our Local Server Id?booleanisSiteUp(String siteId)Indicates the state of a given Site ID.booleanremoveElement(Object obj)Implements for GeneralTaskRunnable.voidrun()Monitoring logic used by background threadStringtoString()-
Methods inherited from class com.sun.identity.common.GeneralTaskRunnable
cancel, getHeadTask, isScheduled, next, previous, scheduledExecutionTime, setHeadTask, setNext, setPrevious
-
-
-
-
Field Detail
-
sessionDebug
public static Debug sessionDebug
Service Globals
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
individual server wait default time out 10 milliseconds- See Also:
- Constant Field Values
-
DEFAULT_PERIOD
public static final long DEFAULT_PERIOD
default StateInfo check time 10 milliseconds- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClusterStateService
protected ClusterStateService(String localServerId, int timeout, long period, Map<String,String> serverMembers, Map<String,String> siteMembers) throws Exception
Constructs an instance for the cluster service- Parameters:
localServerId- id of the server instance in which this ClusterStateService instance is runningtimeout- timeout for waiting on an individual server (millisec)period- checking cycle period (millisecs)serverMembers- map of Server ID to URL for all cluster Server members.siteMembers- Mapping of Site ID to URL for all Sites.- Throws:
Exception- If there was an unexpected error initialising the ClusterStateService.
-
-
Method Detail
-
getServers
protected Map<String,com.iplanet.dpro.session.service.cluster.ClusterStateService.StateInfo> getServers()
Get Servers within Cluster- Returns:
- Map
-
getDownServersAndSites
protected Set<String> getDownServersAndSites()
Get Server and Site IDs which are in a Down State.- Returns:
- Possibly empty set of IDs.
-
getServerSelectionList
protected com.iplanet.dpro.session.service.cluster.ClusterStateService.StateInfo[] getServerSelectionList()
Get the Server Selection List, common to all Servers in Cluster.- Returns:
- StateInfo[] Array of Servers in Selection list in proper order.
-
getLocalServerId
protected String getLocalServerId()
Get our Local Server Id- Returns:
- String of Local Server Id.
-
isLocalServerId
protected boolean isLocalServerId(String serverId)
Is Specified ServerId our Local Server Id?- Parameters:
serverId-- Returns:
- boolean indicating true if the serverId matches the local server ID.
-
isSiteUp
public boolean isSiteUp(String siteId)
Indicates the state of a given Site ID. This method functions in the same way asisUp(String)however, it actively validates that the ID provided is a Site ID.
-
getRunPeriod
public long getRunPeriod()
Implements for GeneralTaskRunnable- Returns:
- The run period of the task.
-
addElement
public boolean addElement(Object obj)
Implements for GeneralTaskRunnable.- Parameters:
obj- Element to be added to this TaskRunnable- Returns:
- false since this class will not be used as container.
-
removeElement
public boolean removeElement(Object obj)
Implements for GeneralTaskRunnable.- Parameters:
obj- Element to be removed from this TaskRunnable- Returns:
- false since this class will not be used as container.
-
isEmpty
public boolean isEmpty()
Implements for GeneralTaskRunnable.- Returns:
- true since this class will not be used as container.
-
run
public void run()
Monitoring logic used by background thread
-
-