Class MemcachedSessionDataMap
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.memcached.session.MemcachedSessionDataMap
- All Implemented Interfaces:
SessionDataMap,LifeCycle
@ManagedObject
public class MemcachedSessionDataMap
extends AbstractLifeCycle
implements SessionDataMap
MemcachedSessionDataMap
Uses memcached as a cache for SessionData.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSessionDataTranscoder We override memcached deserialization to use our classloader-aware ObjectInputStream.Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.rubyeye.xmemcached.XMemcachedClientBuilderprotected net.rubyeye.xmemcached.MemcachedClientprotected SessionContextprotected intprotected booleanstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionMemcachedSessionDataMap(String host, String port) MemcachedSessionDataMap(List<InetSocketAddress> addresses) MemcachedSessionDataMap(List<InetSocketAddress> addresses, int[] weights) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDelete session dataprotected voiddoStop()Method to override to stop the lifecyclenet.rubyeye.xmemcached.XMemcachedClientBuilderintExpiry time for memached entries.voidinitialize(SessionContext context) Initialize this data map for the given context.booleanRead in session data.voidsetExpirySec(int sec) voidsetHeartbeats(boolean heartbeats) voidstore(String id, SessionData data) Store the session data.Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, doStart, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addEventListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, start, stop
-
Field Details
-
DEFAULT_HOST
- See Also:
-
DEFAULT_PORT
- See Also:
-
_client
protected net.rubyeye.xmemcached.MemcachedClient _client -
_expirySec
protected int _expirySec -
_heartbeats
protected boolean _heartbeats -
_builder
protected net.rubyeye.xmemcached.XMemcachedClientBuilder _builder -
_context
-
-
Constructor Details
-
MemcachedSessionDataMap
- Parameters:
host- address of memcache serverport- address of memcache server
-
MemcachedSessionDataMap
-
MemcachedSessionDataMap
-
-
Method Details
-
getBuilder
public net.rubyeye.xmemcached.XMemcachedClientBuilder getBuilder()- Returns:
- the builder
-
setExpirySec
public void setExpirySec(int sec) - Parameters:
sec- the expiry to use in seconds
-
getExpirySec
Expiry time for memached entries.- Returns:
- memcached expiry time in sec
-
isHeartbeats
-
setHeartbeats
public void setHeartbeats(boolean heartbeats) -
initialize
Description copied from interface:SessionDataMapInitialize this data map for the given context. A SessionDataMap can only be used by one context(/session manager).- Specified by:
initializein interfaceSessionDataMap- Parameters:
context- context associated
-
load
Description copied from interface:SessionDataMapRead in session data.- Specified by:
loadin interfaceSessionDataMap- Parameters:
id- identity of session to load- Returns:
- the SessionData matching the id
- Throws:
Exception- if unable to load session data
-
store
Description copied from interface:SessionDataMapStore the session data.- Specified by:
storein interfaceSessionDataMap- Parameters:
id- identity of session to storedata- info of session to store- Throws:
Exception- if unable to write session data
-
delete
Description copied from interface:SessionDataMapDelete session data- Specified by:
deletein interfaceSessionDataMap- Parameters:
id- identity of session to delete- Returns:
- true if the session was deleted
- Throws:
Exception- if unable to delete session data
-
doStop
Description copied from class:AbstractLifeCycleMethod to override to stop the lifecycle- Overrides:
doStopin classAbstractLifeCycle- Throws:
Exception- If there was a problem stopping. Will cause a transition to FAILED state
-