public class DistributedCacheManager<T extends OutgoingDistributableSessionData> extends Object implements DistributedCacheManager<T>, SessionOwnershipSupport
SessionOwnershipSupport.LockResult
Constructor and Description |
---|
DistributedCacheManager(LocalDistributableSessionManager manager,
org.infinispan.Cache<String,Map<Object,Object>> cache,
Registry<String,Void> registry,
SharedLocalYieldingClusterLockManager lockManager,
SessionAttributeStorage<T> attributeStorage,
BatchingManager batchingManager,
CacheInvoker invoker) |
Modifier and Type | Method and Description |
---|---|
SessionOwnershipSupport.LockResult |
acquireSessionOwnership(String sessionId,
boolean newLock)
Attempt to take ownership of the session identified by the given id.
|
void |
activated(org.infinispan.notifications.cachelistener.event.CacheEntryActivatedEvent<String,Map<Object,Object>> event) |
void |
evictSession(String sessionId)
Evict a session from the in-memory portion of the distributed cache, on this node only.
|
void |
evictSession(String sessionId,
String dataOwner)
Evict a non-locally-active session from the in-memory portion of the distributed cache, on this node only.
|
BatchingManager |
getBatchingManager()
Gets the BatchingManager.
|
IncomingDistributableSessionData |
getSessionData(String sessionId,
boolean initialLoad)
Get the
IncomingDistributableSessionData that encapsulates the distributed cache's information about the given
session. |
IncomingDistributableSessionData |
getSessionData(String sessionId,
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.
|
SessionOwnershipSupport |
getSessionOwnershipSupport()
Returns the session ownership support for this distributed cache manager.
|
boolean |
isLocal(String sessionId)
Indicates whether a session with the specified identifier will cache locally.
|
boolean |
isPassivationEnabled()
Gets whether the underlying cache supports passivation.
|
String |
locate(String sessionId)
Returns the jvm route of a node on which the specified session id is cached.
|
void |
modified(org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent<String,Map<Object,Object>> event) |
void |
relinquishSessionOwnership(String sessionId,
boolean remove)
Releases ownership of a session, thus making it possible for other nodes to acquire it.
|
void |
removed(org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent<String,Map<Object,Object>> event) |
void |
removeSession(String sessionId)
Globally remove a session from the distributed cache.
|
void |
removeSessionLocal(String sessionId)
Remove a session from the distributed cache on this node only.
|
void |
removeSessionLocal(String sessionId,
String dataOwner)
Remove a non-locally active session from the distributed cache, but on this node only.
|
void |
sessionCreated(String sessionId)
Notification to the distributed cache that a session has been newly created.
|
void |
setForceSynchronous(boolean forceSynchronous)
Toggles whether or not to force cache into synchronous mode.
|
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.
|
public DistributedCacheManager(LocalDistributableSessionManager manager, org.infinispan.Cache<String,Map<Object,Object>> cache, Registry<String,Void> registry, SharedLocalYieldingClusterLockManager lockManager, SessionAttributeStorage<T> attributeStorage, BatchingManager batchingManager, CacheInvoker invoker)
public void start()
start
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
DistributedCacheManager.start()
public void stop()
stop
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
DistributedCacheManager.stop()
public BatchingManager getBatchingManager()
getBatchingManager
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
DistributedCacheManager.getBatchingManager()
public void sessionCreated(String sessionId)
sessionCreated
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session id with any appended jvmRoute info removedDistributedCacheManager.sessionCreated(String)
public void storeSessionData(T sessionData)
storeSessionData
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionData
- the sessionDistributedCacheManager.storeSessionData(org.jboss.as.clustering.web.OutgoingDistributableSessionData)
public IncomingDistributableSessionData getSessionData(String sessionId, boolean initialLoad)
IncomingDistributableSessionData
that encapsulates the distributed cache's information about the given
session.getSessionData
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRouteinitialLoad
- true
if this is the first access of this session's data on this nodeDistributedCacheManager.getSessionData(String, boolean)
public IncomingDistributableSessionData getSessionData(String sessionId, String dataOwner, boolean includeAttributes)
IncomingDistributableSessionData
that encapsulates the distributed cache's information about the given
session.getSessionData
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRoutedataOwner
- identifier of node where the session is active; null
if locally active or location where
active is unknownincludeAttributes
- should IncomingDistributableSessionData.providesSessionAttributes()
return true
?DistributedCacheManager.getSessionData(String, boolean)
public void removeSession(String sessionId)
removeSession
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRouteDistributedCacheManager.removeSession(String)
public void removeSessionLocal(String sessionId)
removeSessionLocal
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRouteDistributedCacheManager.removeSessionLocal(String)
public void removeSessionLocal(String sessionId, String dataOwner)
removeSessionLocal
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRoutedataOwner
- identifier of node where the session is activeDistributedCacheManager.removeSession(String)
public void evictSession(String sessionId)
evictSession
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRouteDistributedCacheManager.evictSession(String)
public void evictSession(String sessionId, String dataOwner)
evictSession
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- the session's id, excluding any jvmRoutedataOwner
- identifier of node where the session is activeDistributedCacheManager.evictSession(String, String)
public Map<String,String> getSessionIds()
getSessionIds
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
null
value if buddy
replication is not enabled.) Will not return null
.DistributedCacheManager.getSessionIds()
public boolean isPassivationEnabled()
isPassivationEnabled
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
DistributedCacheManager.isPassivationEnabled()
public void setForceSynchronous(boolean forceSynchronous)
setForceSynchronous
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
forceSynchronous
- true, if cache should force synchronous mode, false otherwiseDistributedCacheManager.setForceSynchronous(boolean)
public SessionOwnershipSupport getSessionOwnershipSupport()
getSessionOwnershipSupport
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
DistributedCacheManager.getSessionOwnershipSupport()
public SessionOwnershipSupport.LockResult acquireSessionOwnership(String sessionId, boolean newLock) throws TimeoutException, InterruptedException
SessionOwnershipSupport
acquireSessionOwnership
in interface SessionOwnershipSupport
sessionId
- the session's id, excluding any jvmRoutenewLock
- true
if the caller knows this is a new session that doesn't exist elsewhere in the cluster,
and thus acquiring ownership does not require any cluster-wide callTimeoutException
InterruptedException
public void relinquishSessionOwnership(String sessionId, boolean remove)
SessionOwnershipSupport
relinquishSessionOwnership
in interface SessionOwnershipSupport
sessionId
- the session's id, excluding any jvmRouteremove
- true
if this release is associated with a session removal, in which case the distributed cache
manager can stop tracking ownershippublic boolean isLocal(String sessionId)
isLocal
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- a session identifierDistributedCacheManager.isLocal(String)
public String locate(String sessionId)
locate
in interface DistributedCacheManager<T extends OutgoingDistributableSessionData>
sessionId
- a session identifierDistributedCacheManager.locate(String)
public void removed(org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent<String,Map<Object,Object>> event)
public void modified(org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent<String,Map<Object,Object>> event)
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.