org.jboss.ha.hasessionstate.interfaces
Interface HASessionState

All Known Implementing Classes:
HASessionStateImpl (src)

public interface HASessionState

Interface for services providing clustered state session availability

See Also:
HASessionStateImpl (src)

Nested Class Summary
static interface HASessionState.HASessionStateListener (src)
          Information that can be used to clean a cache for example.
 
Method Summary
 void createSession(java.lang.String appName, java.lang.Object keyId)
          Share a new session state in the sub-partition of this cluster
 HAPartition (src) getCurrentHAPartition()
           
 java.lang.String getNodeName()
          Return the name of this node as used in the computations
 PackagedSession (src) getState(java.lang.String appName, java.lang.Object keyId)
          Get a particular state
 PackagedSession (src) getStateWithOwnership(java.lang.String appName, java.lang.Object keyId)
          Get a state and, if it is not already the case, takes its ownership (a state is always owned by a node)
 void init()
           
 void removeSession(java.lang.String appName, java.lang.Object keyId)
          Remove a session from the sub-partition
 void setState(java.lang.String appName, java.lang.Object keyId, byte[] state)
          Modifies a state already shared
 void start()
           
 void subscribe(java.lang.String appName, HASessionState.HASessionStateListener (src)  listener)
          Subscribe to receive notifications when objects gets modified on another node.
 void takeOwnership(java.lang.String appName, java.lang.Object keyId)
          Take ownership of a state.
 void unsubscribe(java.lang.String appName, HASessionState.HASessionStateListener (src)  listener)
           
 

Method Detail

init

public void init()
          throws java.lang.Exception
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

subscribe

public void subscribe(java.lang.String appName,
                      HASessionState.HASessionStateListener (src)  listener)
Subscribe to receive notifications when objects gets modified on another node.


unsubscribe

public void unsubscribe(java.lang.String appName,
                        HASessionState.HASessionStateListener (src)  listener)

getCurrentHAPartition

public HAPartition (src)  getCurrentHAPartition()

getNodeName

public java.lang.String getNodeName()
Return the name of this node as used in the computations


createSession

public void createSession(java.lang.String appName,
                          java.lang.Object keyId)
Share a new session state in the sub-partition of this cluster

Parameters:
appName - Application name for which is state is shared
keyId - Key identifier of the state

setState

public void setState(java.lang.String appName,
                     java.lang.Object keyId,
                     byte[] state)
              throws java.rmi.RemoteException
Modifies a state already shared

Parameters:
appName - Application name hosting this state
keyId - Key identifier of the state to modify
state - New state
Throws:
java.rmi.RemoteException

getState

public PackagedSession (src)  getState(java.lang.String appName,
                                java.lang.Object keyId)
Get a particular state

Parameters:
appName - Application hosting the state
keyId - Key identifier of the state
Returns:
The state value

getStateWithOwnership

public PackagedSession (src)  getStateWithOwnership(java.lang.String appName,
                                             java.lang.Object keyId)
                                      throws java.rmi.RemoteException
Get a state and, if it is not already the case, takes its ownership (a state is always owned by a node)

Parameters:
appName - Application hosting the state
keyId - Key identifier of the state
Returns:
The state value
Throws:
java.rmi.RemoteException - Thrown if an exception occurs while getting the ownership of the state

takeOwnership

public void takeOwnership(java.lang.String appName,
                          java.lang.Object keyId)
                   throws java.rmi.RemoteException
Take ownership of a state. Each state is owned by a node.

Parameters:
appName - Application hosting the state
keyId - Key identifier of the state
Throws:
java.rmi.RemoteException - Trown if a communication exception occurs while asking other node to get the ownership

removeSession

public void removeSession(java.lang.String appName,
                          java.lang.Object keyId)
Remove a session from the sub-partition

Parameters:
appName - Application hosting the state
keyId - Key identifier of the state