de.javakaffee.web.msm
Class MemcachedBackupSessionManager

java.lang.Object
  extended by org.apache.catalina.util.LifecycleBase
      extended by org.apache.catalina.util.LifecycleMBeanBase
          extended by org.apache.catalina.session.ManagerBase
              extended by de.javakaffee.web.msm.MemcachedBackupSessionManager
All Implemented Interfaces:
MemcachedSessionService.SessionManager, PropertyChangeListener, EventListener, MBeanRegistration, org.apache.catalina.Lifecycle, org.apache.catalina.Manager
Direct Known Subclasses:
DummyMemcachedBackupSessionManager

public class MemcachedBackupSessionManager
extends org.apache.catalina.session.ManagerBase
implements org.apache.catalina.Lifecycle, PropertyChangeListener, MemcachedSessionService.SessionManager

This Manager stores session in configured memcached nodes after the response is finished (committed).

Use this session manager in a Context element, like this

 <Context path="/foo">
     <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
         memcachedNodes="n1.localhost:11211 n2.localhost:11212" failoverNodes="n2"
         connectionType="SASL" non-required
         username="username" non-required
         password="password" non-required
         requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$" />
 </Context>
 

Version:
$Id$
Author:
Martin Grotzke

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.catalina.session.ManagerBase
org.apache.catalina.session.ManagerBase.SessionTiming
 
Field Summary
protected  org.apache.juli.logging.Log _log
           
protected  MemcachedSessionService _msm
           
protected static String NAME
           
 
Fields inherited from class org.apache.catalina.session.ManagerBase
container, distributable, duplicates, expiredSessions, maxActive, maxActiveSessions, maxInactiveInterval, processExpiresFrequency, processingTime, rejectedSessions, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdGenerator, sessionIdLength, sessionMaxAliveTime, sessions, sm, support, TIMING_STATS_CACHE_SIZE
 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserver
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
MemcachedBackupSessionManager()
           
 
Method Summary
 void backgroundProcess()
          
 void changeSessionId(org.apache.catalina.Session session)
           
 MemcachedBackupSession createEmptySession()
           
 MemcachedBackupSession createSession(String sessionId)
           
 void expireSession(String sessionId)
          
 org.apache.catalina.Session findSession(String id)
          Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
 String generateSessionId()
          
 int getBackupThreadCount()
          The number of threads to use for session backup if session backup shall be done asynchronously.
 String getFailoverNodes()
          The memcached failover nodes configuration as provided in the server.xml/context.xml.
 String getInfo()
          Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
 String getMemcachedNodes()
          The memcached nodes configuration as provided in the server.xml/context.xml.
 MemcachedSessionService getMemcachedSessionService()
           
 String[] getMsmStatAttributesSerializationInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that took the attributes serialization.
 String[] getMsmStatBackupInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that session backups took (excluding backups where a session was relocated).
 String[] getMsmStatCachedDataSizeInfo()
          Returns a string array with labels and values of count, min, avg and max of the size of the data that was sent to memcached.
 String[] getMsmStatEffectiveBackupInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that session backups took in the request thread (including omitted session backups e.g.
 String[] getMsmStatMemcachedUpdateInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that storing data in memcached took (excluding serialization, including compression).
 String[] getMsmStatNonStickyAcquireLockFailureInfo()
          Lock acquiration in non-sticky session mode.
 String[] getMsmStatNonStickyAcquireLockInfo()
          Info about locks acquired in non-sticky mode.
 String[] getMsmStatNonStickyAfterBackupInfo()
          Tasks executed for non-sticky sessions after session backup (ping session, store validity info / meta data, store additional backup in secondary memcached).
 String[] getMsmStatNonStickyAfterDeleteFromMemcachedInfo()
          Tasks executed for non-sticky sessions after a session was deleted from memcached (delete validity info and backup data).
 String[] getMsmStatNonStickyAfterLoadFromMemcachedInfo()
          Tasks executed for non-sticky sessions after a session was loaded from memcached (load validity info / meta data).
 String[] getMsmStatNonStickyOnBackupWithoutLoadedSessionInfo()
          Tasks executed (in the request thread) for non-sticky sessions at the end of requests that did not access the session (validity load/update, ping session, ping 2nd session backup, update validity backup).
 String[] getMsmStatNonStickyReleaseLockInfo()
          Lock release in non-sticky session mode.
 long getMsmStatNumBackupFailures()
           
 long getMsmStatNumMemcachedFailover()
           
 long getMsmStatNumNoAttributesAccess()
           
 long getMsmStatNumNonStickySessionsPingFailed()
           
 long getMsmStatNumNonStickySessionsReadOnlyRequest()
           
 long getMsmStatNumNoSessionAccess()
           
 long getMsmStatNumNoSessionModification()
           
 long getMsmStatNumRequestsWithoutSession()
           
 long getMsmStatNumRequestsWithSession()
           
 long getMsmStatNumTomcatFailover()
           
 String[] getMsmStatSessionDeserializationInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that deserialization of session data took.
 String[] getMsmStatSessionsDeletedFromMemcachedInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that deleting sessions from memcached took.
 String[] getMsmStatSessionsLoadedFromMemcachedInfo()
          Returns a string array with labels and values of count, min, avg and max of the time that loading sessions from memcached took (including deserialization).
 String getName()
          Return the descriptive short name of this Manager implementation.
 long getOperationTimeout()
           
 String getSessionAttributeFilter()
          Return the string pattern used for including session attributes to a session-backup.
 long getSessionBackupTimeout()
          The timeout in milliseconds after that a session backup is considered as beeing failed when #getSessionBackupAsync()) is false.
 String getSessionCookieName()
           
 MemcachedBackupSession getSessionInternal(String sessionId)
           
 Map<String,org.apache.catalina.Session> getSessionsInternal()
           
 String getString(String key)
           
 String getString(String key, Object... args)
           
 void incrementRejectedSessions()
           
 void incrementSessionCounter()
           
 boolean isEnabled()
          Specifies, if msm is enabled or not.
 boolean isInitialized()
           
 boolean isSessionBackupAsync()
          Specifies if the session shall be stored asynchronously in memcached as MemcachedClient.set(String, int, Object) supports it.
 boolean isSticky()
           
 void load()
          
 MemcachedBackupSession newMemcachedBackupSession()
           
 Principal readPrincipal(ObjectInputStream ois)
           
 void remove(org.apache.catalina.Session session, boolean update)
          
 void removeInternal(org.apache.catalina.Session session, boolean update)
           
 void setBackupThreadCount(int backupThreadCount)
          Specifies the number of threads that are used if setSessionBackupAsync(boolean) is set to true.
 void setCopyCollectionsForSerialization(boolean copyCollectionsForSerialization)
          Specifies, if iterating over collection elements shall be done on a copy of the collection or on the collection itself.
 void setCustomConverter(String customConverterClassNames)
          Custom converter allow you to provide custom serialization of application specific types.
 void setEnabled(boolean enabled)
          Enable/disable memcached-session-manager (default true / enabled).
 void setEnableStatistics(boolean enableStatistics)
          Specifies if statistics (like number of requests with/without session) shall be gathered.
 void setFailoverNodes(String failoverNodes)
          The node ids of memcached nodes, that shall only be used for session backup by this tomcat/manager, if there are no other memcached nodes left.
 void setLockingMode(LockingStrategy.LockingMode lockingMode, Pattern uriPattern, boolean storeSecondaryBackup)
           
 void setLockingMode(String lockingMode)
          Sets the session locking mode.
 void setMemcachedNodes(String memcachedNodes)
          Set the memcached nodes space or comma separated.
 void setMemcachedProtocol(String memcachedProtocol)
          Specifies the memcached protocol to use, either "text" (default) or "binary".
 void setOperationTimeout(long operationTimeout)
           
 void setPassword(String password)
           
 void setRequestUriIgnorePattern(String requestUriIgnorePattern)
          Set the regular expression for request uris to ignore for session backup.
 void setSessionAttributeFilter(String sessionAttributeFilter)
          Set the pattern used for including session attributes to a session-backup.
 void setSessionBackupAsync(boolean sessionBackupAsync)
          Specifies if the session shall be stored asynchronously in memcached as MemcachedClient.set(String, int, Object) supports it.
 void setSessionBackupTimeout(int sessionBackupTimeout)
          The timeout in milliseconds after that a session backup is considered as beeing failed.
 void setSticky(boolean sticky)
           
 void setTranscoderFactoryClass(String transcoderFactoryClassName)
          The class of the factory that creates the Transcoder to use for serializing/deserializing sessions to/from memcached (requires a default/no-args constructor).
 void setUsername(String username)
           
 void startInternal()
          
 void stopInternal()
          
 void unload()
          
 
Methods inherited from class org.apache.catalina.session.ManagerBase
add, addPropertyChangeListener, findSessions, getActiveSessions, getClassName, getContainer, getCreationTime, getCreationTimestamp, getDistributable, getDomainInternal, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getMaxInactiveInterval, getNewSession, getObjectNameKeyProperties, getProcessExpiresFrequency, getProcessingTime, getRejectedSessions, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdLength, getSessionMaxAliveTime, getThisAccessedTime, getThisAccessedTimestamp, initInternal, listSessionIds, processExpires, propertyChange, remove, removePropertyChangeListener, setContainer, setDistributable, setDuplicates, setExpiredSessions, setMaxActive, setMaxActiveSessions, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, toString, updateSessionMaxAliveTime
 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
 
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Lifecycle
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface de.javakaffee.web.msm.MemcachedSessionService.SessionManager
getContainer, getJvmRoute, getMaxActiveSessions, setProcessExpiresFrequency
 
Methods inherited from interface org.apache.catalina.Manager
add, addPropertyChangeListener, findSessions, getActiveSessions, getDistributable, getExpiredSessions, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdLength, getSessionMaxAliveTime, remove, removePropertyChangeListener, setContainer, setDistributable, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime
 

Field Detail

NAME

protected static final String NAME

_log

protected final org.apache.juli.logging.Log _log

_msm

protected MemcachedSessionService _msm
Constructor Detail

MemcachedBackupSessionManager

public MemcachedBackupSessionManager()
Method Detail

getInfo

public String getInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface org.apache.catalina.Manager
Overrides:
getInfo in class org.apache.catalina.session.ManagerBase
Returns:
the info string

getName

public String getName()
Return the descriptive short name of this Manager implementation.

Overrides:
getName in class org.apache.catalina.session.ManagerBase
Returns:
the short name

load

public void load()
          throws ClassNotFoundException,
                 IOException

Specified by:
load in interface org.apache.catalina.Manager
Throws:
ClassNotFoundException
IOException

unload

public void unload()
            throws IOException

Specified by:
unload in interface org.apache.catalina.Manager
Throws:
IOException

createSession

public MemcachedBackupSession createSession(String sessionId)
Specified by:
createSession in interface org.apache.catalina.Manager
Overrides:
createSession in class org.apache.catalina.session.ManagerBase

createEmptySession

public MemcachedBackupSession createEmptySession()
Specified by:
createEmptySession in interface org.apache.catalina.Manager
Overrides:
createEmptySession in class org.apache.catalina.session.ManagerBase

newMemcachedBackupSession

public MemcachedBackupSession newMemcachedBackupSession()
Specified by:
newMemcachedBackupSession in interface MemcachedSessionService.SessionManager

generateSessionId

public String generateSessionId()

Specified by:
generateSessionId in interface MemcachedSessionService.SessionManager
Overrides:
generateSessionId in class org.apache.catalina.session.ManagerBase

expireSession

public void expireSession(String sessionId)

Specified by:
expireSession in interface MemcachedSessionService.SessionManager
Overrides:
expireSession in class org.apache.catalina.session.ManagerBase

remove

public void remove(org.apache.catalina.Session session,
                   boolean update)

Specified by:
remove in interface org.apache.catalina.Manager
Overrides:
remove in class org.apache.catalina.session.ManagerBase

removeInternal

public void removeInternal(org.apache.catalina.Session session,
                           boolean update)
Specified by:
removeInternal in interface MemcachedSessionService.SessionManager

findSession

public org.apache.catalina.Session findSession(String id)
                                        throws IOException
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.

Specified by:
findSession in interface org.apache.catalina.Manager
Overrides:
findSession in class org.apache.catalina.session.ManagerBase
Parameters:
id - The session id for the session to be returned
Returns:
the session or null if no session was found locally or in memcached.
Throws:
IllegalStateException - if a new session cannot be instantiated for any reason
IOException - if an input/output error occurs while processing this request

changeSessionId

public void changeSessionId(org.apache.catalina.Session session)
Specified by:
changeSessionId in interface org.apache.catalina.Manager
Overrides:
changeSessionId in class org.apache.catalina.session.ManagerBase

setMemcachedNodes

public void setMemcachedNodes(String memcachedNodes)
Set the memcached nodes space or comma separated.

E.g. n1.localhost:11211 n2.localhost:11212

When the memcached nodes are set when this manager is already initialized, the new configuration will be loaded.

Specified by:
setMemcachedNodes in interface MemcachedSessionService.SessionManager
Parameters:
memcachedNodes - the memcached node definitions, whitespace or comma separated

getMemcachedNodes

public String getMemcachedNodes()
The memcached nodes configuration as provided in the server.xml/context.xml.

This getter is there to make this configuration accessible via jmx.

Returns:
the configuration string for the memcached nodes.

setFailoverNodes

public void setFailoverNodes(String failoverNodes)
The node ids of memcached nodes, that shall only be used for session backup by this tomcat/manager, if there are no other memcached nodes left. Node ids are separated by whitespace or comma.

E.g. n1 n2

When the failover nodes are set when this manager is already initialized, the new configuration will be loaded.

Specified by:
setFailoverNodes in interface MemcachedSessionService.SessionManager
Parameters:
failoverNodes - the failoverNodes to set, whitespace or comma separated

getFailoverNodes

public String getFailoverNodes()
The memcached failover nodes configuration as provided in the server.xml/context.xml.

This getter is there to make this configuration accessible via jmx.

Returns:
the configuration string for the failover nodes.

setRequestUriIgnorePattern

public void setRequestUriIgnorePattern(String requestUriIgnorePattern)
Set the regular expression for request uris to ignore for session backup. This should include static resources like images, in the case they are served by tomcat.

E.g. .*\.(png|gif|jpg|css|js)$

Parameters:
requestUriIgnorePattern - the requestUriIgnorePattern to set

getSessionAttributeFilter

@CheckForNull
public String getSessionAttributeFilter()
Return the string pattern used for including session attributes to a session-backup.

Returns:
the sessionAttributeFilter

setSessionAttributeFilter

public void setSessionAttributeFilter(@Nullable
                                      String sessionAttributeFilter)
Set the pattern used for including session attributes to a session-backup. If not set, all session attributes will be part of the session-backup.

E.g. ^(userName|sessionHistory)$

Parameters:
sessionAttributeFilter - the sessionAttributeNames to set

setTranscoderFactoryClass

public void setTranscoderFactoryClass(String transcoderFactoryClassName)
The class of the factory that creates the Transcoder to use for serializing/deserializing sessions to/from memcached (requires a default/no-args constructor). The default value is the JavaSerializationTranscoderFactory class (used if this configuration attribute is not specified).

After the TranscoderFactory instance was created from the specified class, TranscoderFactory.setCopyCollectionsForSerialization(boolean) will be invoked with the currently set copyCollectionsForSerialization propery, which has either still the default value (false) or the value provided via setCopyCollectionsForSerialization(boolean).

Parameters:
transcoderFactoryClassName - the TranscoderFactory class name.

setCopyCollectionsForSerialization

public void setCopyCollectionsForSerialization(boolean copyCollectionsForSerialization)
Specifies, if iterating over collection elements shall be done on a copy of the collection or on the collection itself. The default value is false (used if this configuration attribute is not specified).

This option can be useful if you have multiple requests running in parallel for the same session (e.g. AJAX) and you are using non-thread-safe collections (e.g. ArrayList or HashMap). In this case, your application might modify a collection while it's being serialized for backup in memcached.

Note: This must be supported by the TranscoderFactory specified via setTranscoderFactoryClass(String): after the TranscoderFactory instance was created from the specified class, TranscoderFactory.setCopyCollectionsForSerialization(boolean) will be invoked with the provided copyCollectionsForSerialization value.

Parameters:
copyCollectionsForSerialization - true, if iterating over collection elements shall be done on a copy of the collection, false if the collections own iterator shall be used.

setCustomConverter

public void setCustomConverter(String customConverterClassNames)
Custom converter allow you to provide custom serialization of application specific types. Multiple converter classes are separated by comma (with optional space following the comma).

This option is useful if reflection based serialization is very verbose and you want to provide a more efficient serialization for a specific type.

Note: This must be supported by the TranscoderFactory specified via setTranscoderFactoryClass(String): after the TranscoderFactory instance was created from the specified class, TranscoderFactory.setCustomConverterClassNames(String[]) is invoked with the provided custom converter class names.

Requirements regarding the specific custom converter classes depend on the actual serialization strategy, but a common requirement would be that they must provide a default/no-args constructor.
For more details have a look at SerializationStrategies.

Parameters:
customConverterClassNames - a list of class names separated by comma

setEnableStatistics

public void setEnableStatistics(boolean enableStatistics)
Specifies if statistics (like number of requests with/without session) shall be gathered. Default value of this property is true.

Statistics will be available via jmx and the Manager mbean ( e.g. in the jconsole mbean tab open the attributes node of the Catalina/Manager/<context-path>/<host name> mbean and check for msmStat* values.

Parameters:
enableStatistics - true if statistics shall be gathered.

setBackupThreadCount

public void setBackupThreadCount(int backupThreadCount)
Specifies the number of threads that are used if setSessionBackupAsync(boolean) is set to true.

Parameters:
backupThreadCount - the number of threads to use for session backup.

getBackupThreadCount

public int getBackupThreadCount()
The number of threads to use for session backup if session backup shall be done asynchronously.

Returns:
the number of threads for session backup.

setMemcachedProtocol

public void setMemcachedProtocol(String memcachedProtocol)
Specifies the memcached protocol to use, either "text" (default) or "binary".

Parameters:
memcachedProtocol - one of "text" or "binary".

setEnabled

public void setEnabled(boolean enabled)
                throws IllegalStateException
Enable/disable memcached-session-manager (default true / enabled). If disabled, sessions are neither looked up in memcached nor stored in memcached.

Specified by:
setEnabled in interface MemcachedSessionService.SessionManager
Parameters:
enabled - specifies if msm shall be disabled or not.
Throws:
IllegalStateException - it's not allowed to disable this session manager when running in non-sticky mode.

isEnabled

public boolean isEnabled()
Specifies, if msm is enabled or not.

Returns:
true if enabled, otherwise false.

setSticky

public void setSticky(boolean sticky)
Specified by:
setSticky in interface MemcachedSessionService.SessionManager

isSticky

public boolean isSticky()

setOperationTimeout

public void setOperationTimeout(long operationTimeout)
Specified by:
setOperationTimeout in interface MemcachedSessionService.SessionManager

getOperationTimeout

public long getOperationTimeout()

setLockingMode

public void setLockingMode(@Nullable
                           String lockingMode)
Sets the session locking mode. Possible values:

Specified by:
setLockingMode in interface MemcachedSessionService.SessionManager

setLockingMode

public void setLockingMode(@Nullable
                           LockingStrategy.LockingMode lockingMode,
                           @Nullable
                           Pattern uriPattern,
                           boolean storeSecondaryBackup)
Specified by:
setLockingMode in interface MemcachedSessionService.SessionManager

setUsername

public void setUsername(String username)
Specified by:
setUsername in interface MemcachedSessionService.SessionManager

setPassword

public void setPassword(String password)
Specified by:
setPassword in interface MemcachedSessionService.SessionManager

startInternal

public void startInternal()
                   throws org.apache.catalina.LifecycleException

Overrides:
startInternal in class org.apache.catalina.session.ManagerBase
Throws:
org.apache.catalina.LifecycleException

stopInternal

public void stopInternal()
                  throws org.apache.catalina.LifecycleException

Overrides:
stopInternal in class org.apache.catalina.session.ManagerBase
Throws:
org.apache.catalina.LifecycleException

backgroundProcess

public void backgroundProcess()

Specified by:
backgroundProcess in interface org.apache.catalina.Manager
Overrides:
backgroundProcess in class org.apache.catalina.session.ManagerBase

setSessionBackupAsync

public void setSessionBackupAsync(boolean sessionBackupAsync)
Specifies if the session shall be stored asynchronously in memcached as MemcachedClient.set(String, int, Object) supports it. If this is false, the timeout set via setSessionBackupTimeout(int) is evaluated. If this is true, the setBackupThreadCount(int) is evaluated.

By default this property is set to true - the session backup is performed asynchronously.

Parameters:
sessionBackupAsync - the sessionBackupAsync to set

isSessionBackupAsync

public boolean isSessionBackupAsync()
Specifies if the session shall be stored asynchronously in memcached as MemcachedClient.set(String, int, Object) supports it. If this is false, the timeout from getSessionBackupTimeout() is evaluated.


setSessionBackupTimeout

public void setSessionBackupTimeout(int sessionBackupTimeout)
The timeout in milliseconds after that a session backup is considered as beeing failed.

This property is only evaluated if sessions are stored synchronously (set via setSessionBackupAsync(boolean)).

The default value is 100 millis.

Parameters:
sessionBackupTimeout - the sessionBackupTimeout to set (milliseconds)

getSessionBackupTimeout

public long getSessionBackupTimeout()
The timeout in milliseconds after that a session backup is considered as beeing failed when #getSessionBackupAsync()) is false.


getMsmStatNumBackupFailures

public long getMsmStatNumBackupFailures()
Returns:
See Also:
Statistics.getRequestsWithBackupFailure()

getMsmStatNumTomcatFailover

public long getMsmStatNumTomcatFailover()
Returns:
See Also:
Statistics.getRequestsWithMemcachedFailover()

getMsmStatNumMemcachedFailover

public long getMsmStatNumMemcachedFailover()
Returns:
See Also:
Statistics.getRequestsWithMemcachedFailover()

getMsmStatNumRequestsWithoutSession

public long getMsmStatNumRequestsWithoutSession()
Returns:
See Also:
Statistics.getRequestsWithoutSession()

getMsmStatNumNoSessionAccess

public long getMsmStatNumNoSessionAccess()
Returns:
See Also:
Statistics.getRequestsWithoutSessionAccess()

getMsmStatNumNoAttributesAccess

public long getMsmStatNumNoAttributesAccess()
Returns:
See Also:
Statistics.getRequestsWithoutAttributesAccess()

getMsmStatNumNoSessionModification

public long getMsmStatNumNoSessionModification()
Returns:
See Also:
Statistics.getRequestsWithoutSessionModification()

getMsmStatNumRequestsWithSession

public long getMsmStatNumRequestsWithSession()
Returns:
See Also:
Statistics.getRequestsWithSession()

getMsmStatNumNonStickySessionsPingFailed

public long getMsmStatNumNonStickySessionsPingFailed()

getMsmStatNumNonStickySessionsReadOnlyRequest

public long getMsmStatNumNonStickySessionsReadOnlyRequest()

getMsmStatAttributesSerializationInfo

public String[] getMsmStatAttributesSerializationInfo()
Returns a string array with labels and values of count, min, avg and max of the time that took the attributes serialization.

Returns:
a String array for statistics inspection via jmx.

getMsmStatEffectiveBackupInfo

public String[] getMsmStatEffectiveBackupInfo()
Returns a string array with labels and values of count, min, avg and max of the time that session backups took in the request thread (including omitted session backups e.g. because the session attributes were not accessed). This time was spent in the request thread.

Returns:
a String array for statistics inspection via jmx.

getMsmStatBackupInfo

public String[] getMsmStatBackupInfo()
Returns a string array with labels and values of count, min, avg and max of the time that session backups took (excluding backups where a session was relocated). This time was spent in the request thread if session backup is done synchronously, otherwise another thread used this time.

Returns:
a String array for statistics inspection via jmx.

getMsmStatSessionsLoadedFromMemcachedInfo

public String[] getMsmStatSessionsLoadedFromMemcachedInfo()
Returns a string array with labels and values of count, min, avg and max of the time that loading sessions from memcached took (including deserialization).

Returns:
a String array for statistics inspection via jmx.
See Also:
getMsmStatSessionDeserializationInfo(), getMsmStatNonStickyAfterLoadFromMemcachedInfo()

getMsmStatSessionsDeletedFromMemcachedInfo

public String[] getMsmStatSessionsDeletedFromMemcachedInfo()
Returns a string array with labels and values of count, min, avg and max of the time that deleting sessions from memcached took.

Returns:
a String array for statistics inspection via jmx.
See Also:
getMsmStatNonStickyAfterDeleteFromMemcachedInfo()

getMsmStatSessionDeserializationInfo

public String[] getMsmStatSessionDeserializationInfo()
Returns a string array with labels and values of count, min, avg and max of the time that deserialization of session data took.

Returns:
a String array for statistics inspection via jmx.

getMsmStatCachedDataSizeInfo

public String[] getMsmStatCachedDataSizeInfo()
Returns a string array with labels and values of count, min, avg and max of the size of the data that was sent to memcached.

Returns:
a String array for statistics inspection via jmx.

getMsmStatMemcachedUpdateInfo

public String[] getMsmStatMemcachedUpdateInfo()
Returns a string array with labels and values of count, min, avg and max of the time that storing data in memcached took (excluding serialization, including compression).

Returns:
a String array for statistics inspection via jmx.

getMsmStatNonStickyAcquireLockInfo

public String[] getMsmStatNonStickyAcquireLockInfo()
Info about locks acquired in non-sticky mode.


getMsmStatNonStickyAcquireLockFailureInfo

public String[] getMsmStatNonStickyAcquireLockFailureInfo()
Lock acquiration in non-sticky session mode.


getMsmStatNonStickyReleaseLockInfo

public String[] getMsmStatNonStickyReleaseLockInfo()
Lock release in non-sticky session mode.


getMsmStatNonStickyOnBackupWithoutLoadedSessionInfo

public String[] getMsmStatNonStickyOnBackupWithoutLoadedSessionInfo()
Tasks executed (in the request thread) for non-sticky sessions at the end of requests that did not access the session (validity load/update, ping session, ping 2nd session backup, update validity backup).


getMsmStatNonStickyAfterBackupInfo

public String[] getMsmStatNonStickyAfterBackupInfo()
Tasks executed for non-sticky sessions after session backup (ping session, store validity info / meta data, store additional backup in secondary memcached).


getMsmStatNonStickyAfterLoadFromMemcachedInfo

public String[] getMsmStatNonStickyAfterLoadFromMemcachedInfo()
Tasks executed for non-sticky sessions after a session was loaded from memcached (load validity info / meta data).


getMsmStatNonStickyAfterDeleteFromMemcachedInfo

public String[] getMsmStatNonStickyAfterDeleteFromMemcachedInfo()
Tasks executed for non-sticky sessions after a session was deleted from memcached (delete validity info and backup data).


getSessionCookieName

public String getSessionCookieName()
Specified by:
getSessionCookieName in interface MemcachedSessionService.SessionManager

getSessionInternal

public MemcachedBackupSession getSessionInternal(String sessionId)
Specified by:
getSessionInternal in interface MemcachedSessionService.SessionManager

getSessionsInternal

public Map<String,org.apache.catalina.Session> getSessionsInternal()
Specified by:
getSessionsInternal in interface MemcachedSessionService.SessionManager

getString

public String getString(String key)
Specified by:
getString in interface MemcachedSessionService.SessionManager

incrementSessionCounter

public void incrementSessionCounter()
Specified by:
incrementSessionCounter in interface MemcachedSessionService.SessionManager

incrementRejectedSessions

public void incrementRejectedSessions()
Specified by:
incrementRejectedSessions in interface MemcachedSessionService.SessionManager

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface MemcachedSessionService.SessionManager

getString

public String getString(String key,
                        Object... args)
Specified by:
getString in interface MemcachedSessionService.SessionManager

readPrincipal

public Principal readPrincipal(ObjectInputStream ois)
                        throws ClassNotFoundException,
                               IOException
Specified by:
readPrincipal in interface MemcachedSessionService.SessionManager
Throws:
ClassNotFoundException
IOException

getMemcachedSessionService

public MemcachedSessionService getMemcachedSessionService()
Specified by:
getMemcachedSessionService in interface MemcachedSessionService.SessionManager


Copyright © 2009-2012. All Rights Reserved.