org.jboss.web.tomcat.service.session.distributedcache.spi
Interface DistributedCacheManager<T extends OutgoingDistributableSessionData>


public interface DistributedCacheManager<T extends OutgoingDistributableSessionData>

SPI implemented by the distributed caching layer.

Version:
$Revision: $
Author:
Brian Stansberry

Method Summary
 void evictSession(String realId)
          Evict a session from the in-memory portion of the distributed cache, on this node only.
 void evictSession(String realId, String dataOwner)
          Evict a non-locally-active session from the in-memory portion of the distributed cache, on this node only.
 Object getAttribute(String realId, String key)
          Get the value of the attribute with the given key from the given session.
 Set<String> getAttributeKeys(String realId)
          Obtain the attribute keys associated with this session.
 Map<String,Object> getAttributes(String realId)
          Return all attributes associated with this session id.
 BatchingManager getBatchingManager()
          Gets the BatchingManager.
 IncomingDistributableSessionData getSessionData(String realId, boolean initialLoad)
          Get the IncomingDistributableSessionData that encapsulates the distributed cache's information about the given session.
 IncomingDistributableSessionData getSessionData(String realId, String dataOwner, boolean includeAttributes)
          Get the IncomingDistributableSessionData that encapsulates the distributed cache's information about the given session.
 Map<String,String> getSessionIds()
          Gets the ids of all sessions in the underlying cache.
 boolean getSupportsAttributeOperations()
          Gets whether this DistributedCacheManager supports operations on session attributes; if false the various attribute operations in will throw UnsupportedOperationException.
 boolean isPassivationEnabled()
          Gets whether the underlying cache supports passivation.
 void putAttribute(String realId, Map<String,Object> map)
          Stores the given map of attribute key/value pairs in the given session.
 void putAttribute(String realId, String key, Object value)
          Stores the given value under the given key in the given session.
 Object removeAttribute(String realId, String key)
          Removes the attribute with the given key from the given session.
 void removeAttributeLocal(String realId, String key)
          Removes the attribute with the given key from the given session, but only on the local node.
 void removeSession(String realId)
          Globally remove a session from the distributed cache.
 void removeSessionLocal(String realId)
          Remove a session from the distributed cache on this node only.
 void removeSessionLocal(String realId, String dataOwner)
          Remove a non-locally active session from the distributed cache, but on this node only.
 void sessionCreated(String realId)
          Notification to the distributed cache that a session has been newly created.
 void start()
          Starts the distributed caching layer.
 void stop()
          Stops the distributed caching layer.
 void storeSessionData(T sessionData)
          Store or update a session in the distributed cache.
 

Method Detail

start

void start()
Starts the distributed caching layer.


stop

void stop()
Stops the distributed caching layer.


getBatchingManager

BatchingManager getBatchingManager()
Gets the BatchingManager.


sessionCreated

void sessionCreated(String realId)
Notification to the distributed cache that a session has been newly created.

Parameters:
realId - the session id with any appended jvmRoute info removed

storeSessionData

void storeSessionData(T sessionData)
Store or update a session in the distributed cache.

Parameters:
session - the session

removeSession

void removeSession(String realId)
Globally remove a session from the distributed cache.

Parameters:
realId - the session's id, excluding any jvmRoute

removeSessionLocal

void removeSessionLocal(String realId)
Remove a session from the distributed cache on this node only.

Parameters:
realId - the session's id, excluding any jvmRoute

removeSessionLocal

void removeSessionLocal(String realId,
                        String dataOwner)
Remove a non-locally active session from the distributed cache, but on this node only.

Parameters:
realId - the session's id, excluding any jvmRoute
dataOwner - identifier of node where the session is active

evictSession

void evictSession(String realId)
Evict a session from the in-memory portion of the distributed cache, on this node only.

Parameters:
realId - the session's id, excluding any jvmRoute

evictSession

void evictSession(String realId,
                  String dataOwner)
Evict a non-locally-active session from the in-memory portion of the distributed cache, on this node only.

Parameters:
realId - the session's id, excluding any jvmRoute
dataOwner - identifier of node where the session is active

getSessionData

IncomingDistributableSessionData getSessionData(String realId,
                                                boolean initialLoad)
Get the IncomingDistributableSessionData that encapsulates the distributed cache's information about the given session.

Parameters:
realId - the session's id, excluding any jvmRoute
initialLoad - true if this is the first access of this session's data on this node
Returns:
the session data

getSessionData

IncomingDistributableSessionData getSessionData(String realId,
                                                String dataOwner,
                                                boolean includeAttributes)
Get the IncomingDistributableSessionData that encapsulates the distributed cache's information about the given session.

Parameters:
realId - the session's id, excluding any jvmRoute
dataOwner - identifier of node where the session is active; null if locally active or location where active is unknown
includeAttributes - should
Returns:
the session data

getSessionIds

Map<String,String> getSessionIds()
Gets the ids of all sessions in the underlying cache.

Returns:
Map containing all of the session ids of sessions in the cache (with any jvmRoute removed) as keys, and the identifier of the data owner for the session as value (or a null value if buddy replication is not enabled.) Will not return null.

isPassivationEnabled

boolean isPassivationEnabled()
Gets whether the underlying cache supports passivation.


getSupportsAttributeOperations

boolean getSupportsAttributeOperations()
Gets whether this DistributedCacheManager supports operations on session attributes; if false the various attribute operations in will throw UnsupportedOperationException.


getAttribute

Object getAttribute(String realId,
                    String key)
Get the value of the attribute with the given key from the given session.

Parameters:
realId - the session id with any jvmRoute removed
key - the attribute key
Returns:
the attribute value, or null
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false

putAttribute

void putAttribute(String realId,
                  String key,
                  Object value)
Stores the given value under the given key in the given session.

Parameters:
realId - the session id with any jvmRoute removed
key - the attribute key
value - the previous attribute value, or null
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false

putAttribute

void putAttribute(String realId,
                  Map<String,Object> map)
Stores the given map of attribute key/value pairs in the given session.

Parameters:
realId - the session id with any jvmRoute removed
map -
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false

removeAttribute

Object removeAttribute(String realId,
                       String key)
Removes the attribute with the given key from the given session.

Parameters:
realId - the session id with any jvmRoute removed
key - the attribute key
Returns:
the previous attribute value, or null
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false

removeAttributeLocal

void removeAttributeLocal(String realId,
                          String key)
Removes the attribute with the given key from the given session, but only on the local node.

Parameters:
realId - the session id with any jvmRoute removed
key - the attribute key
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false

getAttributeKeys

Set<String> getAttributeKeys(String realId)
Obtain the attribute keys associated with this session.

Parameters:
realId - the session id with any jvmRoute removed
Returns:
the attribute keys or an empty Set if none are found
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false

getAttributes

Map<String,Object> getAttributes(String realId)
Return all attributes associated with this session id.

Parameters:
realId - the session id with any jvmRoute removed
Returns:
the attributes, or any empty Map if none are found.
Throws:
UnsupportedOperationException - if getSupportsAttributeOperations() would return false


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.