|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jboss.ha.hasessionstate.server.HASessionStateImpl
Default implementation of HASessionState
Revisions:
2002/01/09: billb
HASessionState| Nested Class Summary |
| Nested classes inherited from class org.jboss.ha.hasessionstate.interfaces.HASessionState |
HASessionState.HASessionStateListener |
| Field Summary | |
protected String |
_sessionStateName
|
protected Hashtable |
appSessions
|
protected long |
beanCleaningDelay
|
protected String |
DEFAULT_PARTITION_JNDI_NAME
|
protected static String |
HA_SESSION_STATE_STATE_TRANSFER
|
protected String |
haPartitionJndiName
|
protected String |
haPartitionName
|
protected HAPartition |
hapGeneral
|
protected String |
JNDI_FOLDER_NAME_FOR_HAPARTITION
|
protected String |
JNDI_FOLDER_NAME_FOR_HASESSIONSTATE
|
protected Hashtable |
listeners
|
protected Object |
lockAppSession
|
protected HashMap |
locks
|
protected org.jboss.logging.Logger |
log
|
protected long |
MAX_DELAY_BEFORE_CLEANING_UNRECLAIMED_STATE
|
protected String |
myNodeName
|
protected String |
sessionStateIdentifier
|
| Constructor Summary | |
HASessionStateImpl()
|
|
HASessionStateImpl(String sessionStateName,
String mainHAPartitionName,
long beanCleaningDelay)
|
|
| Method Summary | |
PackagedSessionImpl |
_createSession(String appName,
Object keyId)
|
void |
_removeSession(String appName,
Object keyId)
|
Boolean |
_setOwnership(String appName,
Object keyId,
String newOwner,
Long remoteVersion)
|
void |
_setState(String appName,
PackagedSession session)
|
protected void |
bind(String jndiName,
Object who,
Class classType,
Context ctx)
|
void |
createSession(String appName,
Object keyId)
Share a new session state in the sub-partition of this cluster |
protected byte[] |
deflate(Object object)
|
HAPartition |
getCurrentHAPartition()
|
Serializable |
getCurrentState()
Called when a new node need to be initialized. |
protected Hashtable |
getHashtableForApp(String appName)
|
protected EDU.oswego.cs.dl.util.concurrent.Mutex |
getLock(String appName,
Object key)
|
String |
getNodeName()
Return the name of this node as used in the computations |
PackagedSession |
getState(String appName,
Object keyId)
Get a particular state |
PackagedSession |
getStateWithOwnership(String appName,
Object keyId)
Get a state and, if it is not already the case, takes its ownership (a state is always owned by a node) |
protected Object |
inflate(byte[] compressedContent)
|
void |
init()
|
PackagedSession |
localTakeOwnership(String appName,
Object keyId)
|
protected boolean |
lockExists(String appName,
Object key)
|
void |
ownedObjectExternallyModified(String appName,
Object key,
PackagedSession oldSession,
PackagedSession newSession)
|
void |
purgeState()
|
protected void |
removeLock(String appName,
Object key)
|
void |
removeSession(String appName,
Object keyId)
Remove a session from the sub-partition |
void |
setCurrentState(Serializable newState)
This callback method is called when a new service starts on a new node: the state that it should hold is transfered to it through this callback |
void |
setState(String appName,
Object keyId,
byte[] state)
Modifies a state already shared |
void |
start()
|
void |
stop()
|
void |
subscribe(String appName,
HASessionState.HASessionStateListener listener)
Subscribe to receive notifications when objects gets modified on another node. |
void |
takeOwnership(String appName,
Object keyId)
Take ownership of a state. |
void |
unsubscribe(String appName,
HASessionState.HASessionStateListener listener)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected String _sessionStateName
protected org.jboss.logging.Logger log
protected HAPartition hapGeneral
protected String sessionStateIdentifier
protected String myNodeName
protected long beanCleaningDelay
protected String haPartitionName
protected String haPartitionJndiName
protected final String DEFAULT_PARTITION_JNDI_NAME
protected final String JNDI_FOLDER_NAME_FOR_HASESSIONSTATE
protected final String JNDI_FOLDER_NAME_FOR_HAPARTITION
protected final long MAX_DELAY_BEFORE_CLEANING_UNRECLAIMED_STATE
protected static final String HA_SESSION_STATE_STATE_TRANSFER
protected HashMap locks
protected Hashtable appSessions
protected Object lockAppSession
protected Hashtable listeners
| Constructor Detail |
public HASessionStateImpl()
public HASessionStateImpl(String sessionStateName, String mainHAPartitionName, long beanCleaningDelay)
| Method Detail |
public void init()
throws Exception
init in interface HASessionStateExceptionprotected void bind(String jndiName, Object who, Class classType, Context ctx) throws Exception
Exception
public void start()
throws Exception
start in interface HASessionStateException
public void stop()
throws Exception
Exceptionpublic String getNodeName()
HASessionState
getNodeName in interface HASessionStatepublic Serializable getCurrentState()
HAPartition.HAPartitionStateTransfer
getCurrentState in interface HAPartition.HAPartitionStateTransferpublic void setCurrentState(Serializable newState)
HAPartition.HAPartitionStateTransfer
setCurrentState in interface HAPartition.HAPartitionStateTransfernewState - The serialized representation of the state of the new service.public void purgeState()
protected byte[] deflate(Object object) throws IOException
IOExceptionprotected Object inflate(byte[] compressedContent) throws IOException
IOExceptionprotected Hashtable getHashtableForApp(String appName)
public void createSession(String appName, Object keyId)
HASessionState
createSession in interface HASessionStateappName - Application name for which is state is sharedkeyId - Key identifier of the statepublic PackagedSessionImpl _createSession(String appName, Object keyId)
public void setState(String appName, Object keyId, byte[] state) throws RemoteException
HASessionState
setState in interface HASessionStateappName - Application name hosting this statekeyId - Key identifier of the state to modifystate - New state
RemoteExceptionpublic void _setState(String appName, PackagedSession session)
public PackagedSession getState(String appName, Object keyId)
HASessionState
getState in interface HASessionStateappName - Application hosting the statekeyId - Key identifier of the state
public PackagedSession getStateWithOwnership(String appName, Object keyId) throws RemoteException
HASessionState
getStateWithOwnership in interface HASessionStateappName - Application hosting the statekeyId - Key identifier of the state
RemoteException - Thrown if an exception occurs while getting the ownership of the statepublic PackagedSession localTakeOwnership(String appName, Object keyId) throws RemoteException
RemoteExceptionpublic Boolean _setOwnership(String appName, Object keyId, String newOwner, Long remoteVersion)
public void takeOwnership(String appName, Object keyId) throws RemoteException
HASessionState
takeOwnership in interface HASessionStateappName - Application hosting the statekeyId - Key identifier of the state
RemoteException - Trown if a communication exception occurs while asking other node to get the ownershippublic void removeSession(String appName, Object keyId)
HASessionState
removeSession in interface HASessionStateappName - Application hosting the statekeyId - Key identifier of the statepublic void _removeSession(String appName, Object keyId)
public void subscribe(String appName, HASessionState.HASessionStateListener listener)
HASessionState
subscribe in interface HASessionStatepublic void unsubscribe(String appName, HASessionState.HASessionStateListener listener)
unsubscribe in interface HASessionStatepublic void ownedObjectExternallyModified(String appName, Object key, PackagedSession oldSession, PackagedSession newSession)
public HAPartition getCurrentHAPartition()
getCurrentHAPartition in interface HASessionStateprotected boolean lockExists(String appName, Object key)
protected EDU.oswego.cs.dl.util.concurrent.Mutex getLock(String appName, Object key)
protected void removeLock(String appName, Object key)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||