org.apache.geronimo.clustering
Interface Session

All Known Implementing Classes:
WADISessionAdaptor

public interface Session

Represents a clustered session.

A Session is created by a SessionManager and is uniquely identified by its sessionId. More accurately, this sessionId is unique within the set of SessionManagers from which this Session has been sourced. If two Sessions have the same sessionId, then a client can be sure that they have been created from two distinct set of SessionManagers.

A Session provides Map like contracts to manipulate state information. State information must be Serializable as it may be marshalled automatically by the underpinning local SessionManager. At any given point of time, a Session is uniquely "instantiated" once cluster wide. Also, cluster wide accesses to a given Session are ensured to be serialized by the set of SessionManagers from which the Session has been sourced. The interposition of a ClusteredInvocation between a client and the Session this client would like to access enforces unique instantiation and access serialization cluster wide for a given Session.


Method Summary
 Object addState(String key, Object value)
          Map like contract to manipulate state information.
 String getSessionId()
          Gets the sessionId.
 Map getState()
          Map like contract to manipulate state information.
 Object getState(String key)
          Map like contract to manipulate state information.
 void onEndAccess()
          Notifies the session that state accesses are now completed.
 void release()
          Releases the session.
 Object removeState(String key)
          Map like contract to manipulate state information.
 

Method Detail

getSessionId

String getSessionId()
Gets the sessionId.

Returns:
sessionId.

addState

Object addState(String key,
                Object value)
Map like contract to manipulate state information.


getState

Object getState(String key)
Map like contract to manipulate state information.


removeState

Object removeState(String key)
Map like contract to manipulate state information.


getState

Map getState()
Map like contract to manipulate state information.

The returned Map is mutable and is backed by the session.


release

void release()
Releases the session.

When a Session is released, it is released from the underlying set of SessionManagers. In other words, its sessionId is unknown and its state is permanently lost. After the release of a Session, the behavior of the other methods is undefined.


onEndAccess

void onEndAccess()
Notifies the session that state accesses are now completed.

When state accesses end, the underlying local SessionManager may decide to replicate synchronously or asynchronously the current state to remote SessionManagers.



Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.