org.glassfish.web.ha.session.management
Class ReplicationStore

java.lang.Object
  extended by org.apache.catalina.session.StoreBase
      extended by org.glassfish.web.ha.session.management.HAStoreBase
          extended by org.glassfish.web.ha.session.management.ReplicationStore
All Implemented Interfaces:
Lifecycle, Store
Direct Known Subclasses:
ReplicationAttributeStore

public class ReplicationStore
extends HAStoreBase

Author:
Larry White, Rajiv Mordani

Field Summary
protected static java.util.logging.Logger _logger
          The logger to use for logging ALL web container related messages.
 
Fields inherited from class org.glassfish.web.ha.session.management.HAStoreBase
_debug, _logLevel, applicationId, clusterId, ioUtils, serverConfigLookup
 
Fields inherited from class org.apache.catalina.session.StoreBase
debug, info, lifecycle, manager, sm, started, storeName, support
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
ReplicationStore(ServerConfigLookup serverConfigLookup, JavaEEIOUtils ioUtils)
          Creates a new instance of ReplicationStore
 
Method Summary
 void clear()
          Clear sessions
 void doRemove(java.lang.String id)
          Remove the Session with the specified session identifier from this Store, if present.
 void doSave(Session session)
          Save the specified Session into this Store.
 void doValveSave(Session session)
          Save the specified Session into this Store.
 java.lang.String getApplicationId()
           
 Session getSession(byte[] state, long version)
           
 int getSize()
          return the size of the store cache will be over-ridden in subclasses
protected  boolean isReplicationCompressionEnabled()
           
 java.lang.String[] keys()
          Return an array containing the session identifiers of all Sessions currently saved in this Store.
 Session load(java.lang.String id)
          Load and return the Session associated with the specified session identifier from this Store, without removing it.
 Session load(java.lang.String id, java.lang.String version)
           
 Session loadFromBackingStore(java.lang.String id, java.lang.String version)
           
 void processExpires()
          Called by our background reaper thread to remove expired sessions in the replica - this can be done on the same instance - i.e.
 int removeExpiredSessions()
          This method deletes all the sessions corresponding to the "appId" that should be expired
 void removeSynchronized(java.lang.String id)
          Remove the Session with the specified session identifier from this Store, if present.
 void save(Session session)
          Save the specified Session into this Store.
 void stop()
           
 void updateLastAccessTime(Session session)
          update the lastaccess time of the specified Session into this Store.
 void valveSave(Session session)
          Save the specified Session into this Store.
 
Methods inherited from class org.glassfish.web.ha.session.management.HAStoreBase
debug, getByteArray, getByteArray, getClusterId, getClusterIdFromConfig, remove, setLogLevel
 
Methods inherited from class org.apache.catalina.session.StoreBase
addLifecycleListener, addPropertyChangeListener, doProcessExpires, findLifecycleListeners, getDebug, getInfo, getManager, getStoreName, log, readSession, removeFromStoreCache, removeLifecycleListener, removePropertyChangeListener, setDebug, setManager, start, writeSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected static final java.util.logging.Logger _logger
The logger to use for logging ALL web container related messages.

Constructor Detail

ReplicationStore

public ReplicationStore(ServerConfigLookup serverConfigLookup,
                        JavaEEIOUtils ioUtils)
Creates a new instance of ReplicationStore

Method Detail

getApplicationId

public java.lang.String getApplicationId()
Overrides:
getApplicationId in class HAStoreBase

valveSave

public void valveSave(Session session)
               throws java.io.IOException
Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.

Parameters:
session - Session to be saved
Throws:
java.io.IOException - if an input/output error occurs

doValveSave

public void doValveSave(Session session)
                 throws java.io.IOException
Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.

Parameters:
session - Session to be saved
Throws:
java.io.IOException - if an input/output error occurs

stop

public void stop()
Specified by:
stop in interface Lifecycle
Overrides:
stop in class StoreBase

save

public void save(Session session)
          throws java.io.IOException
Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.

Parameters:
session - Session to be saved
Throws:
java.io.IOException - if an input/output error occurs

isReplicationCompressionEnabled

protected boolean isReplicationCompressionEnabled()

doSave

public void doSave(Session session)
            throws java.io.IOException
Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.

Parameters:
session - Session to be saved
Throws:
java.io.IOException - if an input/output error occurs

clear

public void clear()
           throws java.io.IOException
Clear sessions

Throws:
java.io.IOException - if an input/output error occurs

doRemove

public void doRemove(java.lang.String id)
              throws java.io.IOException
Remove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.

Overrides:
doRemove in class HAStoreBase
Parameters:
id - Session identifier of the Session to be removed
Throws:
java.io.IOException - if an input/output error occurs

removeSynchronized

public void removeSynchronized(java.lang.String id)
                        throws java.io.IOException
Remove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.

Overrides:
removeSynchronized in class HAStoreBase
Parameters:
id - Session identifier of the Session to be removed
Throws:
java.io.IOException - if an input/output error occurs

processExpires

public void processExpires()
Called by our background reaper thread to remove expired sessions in the replica - this can be done on the same instance - i.e. each instance will do its own

Overrides:
processExpires in class StoreBase

removeExpiredSessions

public int removeExpiredSessions()
This method deletes all the sessions corresponding to the "appId" that should be expired

Returns:
number of removed sessions

load

public Session load(java.lang.String id)
             throws java.lang.ClassNotFoundException,
                    java.io.IOException
Load and return the Session associated with the specified session identifier from this Store, without removing it. If there is no such stored Session, return null.

Parameters:
id - Session identifier of the session to load
Throws:
java.lang.ClassNotFoundException - if a deserialization error occurs
java.io.IOException - if an input/output error occurs

load

public Session load(java.lang.String id,
                    java.lang.String version)
             throws java.lang.ClassNotFoundException,
                    java.io.IOException
Overrides:
load in class StoreBase
Throws:
java.lang.ClassNotFoundException
java.io.IOException

loadFromBackingStore

public Session loadFromBackingStore(java.lang.String id,
                                    java.lang.String version)
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException,
                                    org.glassfish.ha.store.api.BackingStoreException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
org.glassfish.ha.store.api.BackingStoreException

updateLastAccessTime

public void updateLastAccessTime(Session session)
                          throws java.io.IOException
update the lastaccess time of the specified Session into this Store.

Parameters:
session - Session to be saved
Throws:
java.io.IOException - if an input/output error occurs

keys

public java.lang.String[] keys()
                        throws java.io.IOException
Return an array containing the session identifiers of all Sessions currently saved in this Store. If there are no such Sessions, a zero-length array is returned.

Throws:
java.io.IOException - if an input/output error occurred

getSize

public int getSize()
            throws java.io.IOException
Description copied from class: HAStoreBase
return the size of the store cache will be over-ridden in subclasses

Specified by:
getSize in interface Store
Overrides:
getSize in class HAStoreBase
Throws:
java.io.IOException

getSession

public Session getSession(byte[] state,
                          long version)
                   throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.