public class InfinispanSessionManager<V,L> extends Object implements SessionManager<L>, org.infinispan.affinity.KeyGenerator<String>, Batcher, org.infinispan.notifications.KeyFilter
Constructor and Description |
---|
InfinispanSessionManager(SessionContext context,
SessionIdentifierFactory idFactory,
org.infinispan.Cache<String,V> cache,
SessionFactory<V,L> factory,
KeyAffinityServiceFactory affinityFactory,
Registry<String,Void> registry,
NodeFactory<org.infinispan.remoting.transport.Address> nodeFactory,
org.jboss.metadata.web.jboss.JBossWebMetaData metaData) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Object key) |
void |
activated(org.infinispan.notifications.cachelistener.event.CacheEntryActivatedEvent<String,?> event) |
boolean |
containsSession(String id)
Indicates whether or not the session with the specified identifier is known to this session manager.
|
Session<L> |
createSession(String id)
Returns the session with the specified identifier, creating one if necessary
Sessions returned by this method must be closed via
Session.close() . |
String |
createSessionId()
Generates a new web session identifier.
|
Session<L> |
findSession(String id)
Returns the session with the specified identifier, or null if none exists.
|
Set<String> |
getActiveSessions()
Returns the identifiers of those sessions that are active on this node.
|
Batcher |
getBatcher()
Exposes the batching mechanism used by this session manager.
|
long |
getDefaultMaxInactiveInterval(TimeUnit unit)
Returns the default maximum inactive interval, using the specified unit, for all sessions created by this session manager.
|
String |
getKey() |
Set<String> |
getLocalSessions()
Returns the identifiers of all sessions on this node, including both active and passive sessions.
|
String |
locate(String sessionId)
Returns the route identifier most appropriate for the specified session identifier.
|
void |
passivated(org.infinispan.notifications.cachelistener.event.CacheEntryPassivatedEvent<String,?> event) |
void |
removed(org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent<String,?> event) |
void |
setDefaultMaxInactiveInterval(long value,
TimeUnit unit)
Set the default maximum inactive interval, using the specified unit, for all sessions created by this session manager.
|
void |
start()
Invoked prior to applicaion deployment.
|
Batch |
startBatch()
Starts a batch.
|
void |
stop()
Invoked prior to application undeployment.
|
void |
topologyChanged(org.infinispan.notifications.cachelistener.event.TopologyChangedEvent<String,?> event) |
ImmutableSession |
viewSession(String id)
Returns a read-only view of the session with the specified identifier.
|
public InfinispanSessionManager(SessionContext context, SessionIdentifierFactory idFactory, org.infinispan.Cache<String,V> cache, SessionFactory<V,L> factory, KeyAffinityServiceFactory affinityFactory, Registry<String,Void> registry, NodeFactory<org.infinispan.remoting.transport.Address> nodeFactory, org.jboss.metadata.web.jboss.JBossWebMetaData metaData)
public void start()
SessionManager
start
in interface SessionManager<L>
public void stop()
SessionManager
stop
in interface SessionManager<L>
public boolean accept(Object key)
accept
in interface org.infinispan.notifications.KeyFilter
public Batch startBatch()
Batcher
startBatch
in interface Batcher
public String locate(String sessionId)
RouteLocator
locate
in interface RouteLocator
sessionId
- a unique session identifierpublic Batcher getBatcher()
SessionManager
getBatcher
in interface SessionManager<L>
public long getDefaultMaxInactiveInterval(TimeUnit unit)
SessionManager
getDefaultMaxInactiveInterval
in interface SessionManager<L>
unit
- a time unitpublic void setDefaultMaxInactiveInterval(long value, TimeUnit unit)
SessionManager
setDefaultMaxInactiveInterval
in interface SessionManager<L>
unit
- a time unitpublic String getKey()
getKey
in interface org.infinispan.affinity.KeyGenerator<String>
public String createSessionId()
SessionIdentifierFactory
createSessionId
in interface SessionIdentifierFactory
public boolean containsSession(String id)
SessionManager
containsSession
in interface SessionManager<L>
id
- a unique session identifierpublic Session<L> findSession(String id)
SessionManager
Session.close()
.
This method is intended to be invoked within the context of a batch.findSession
in interface SessionManager<L>
id
- a session identifierpublic Session<L> createSession(String id)
SessionManager
Session.close()
.
This method is intended to be invoked within the context of a batch.createSession
in interface SessionManager<L>
id
- a session identifierpublic ImmutableSession viewSession(String id)
SessionManager
viewSession
in interface SessionManager<L>
id
- a unique session identifierpublic Set<String> getActiveSessions()
SessionManager
getActiveSessions
in interface SessionManager<L>
public Set<String> getLocalSessions()
SessionManager
getLocalSessions
in interface SessionManager<L>
public void activated(org.infinispan.notifications.cachelistener.event.CacheEntryActivatedEvent<String,?> event)
public void passivated(org.infinispan.notifications.cachelistener.event.CacheEntryPassivatedEvent<String,?> event)
public void removed(org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent<String,?> event)
public void topologyChanged(org.infinispan.notifications.cachelistener.event.TopologyChangedEvent<String,?> event)
Copyright © 2013 JBoss by Red Hat. All rights reserved.