Class ReplicationStore
- java.lang.Object
-
- org.apache.catalina.session.StoreBase
-
- org.glassfish.web.ha.session.management.HAStoreBase
-
- org.glassfish.web.ha.session.management.ReplicationStore
-
- Direct Known Subclasses:
ReplicationAttributeStore
public class ReplicationStore extends HAStoreBase
- Author:
- Larry White, Rajiv Mordani
-
-
Field Summary
-
Fields inherited from class org.glassfish.web.ha.session.management.HAStoreBase
_debug, _logLevel, applicationId, clusterId, ioUtils
-
Fields inherited from class org.apache.catalina.session.StoreBase
debug, info, lifecycle, manager, 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
Constructors Constructor Description ReplicationStore(JavaEEIOUtils ioUtils)Creates a new instance of ReplicationStore
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()voidclear()Clear sessionsvoiddoRemove(String id)Remove the Session with the specified session identifier from this Store, if present.voiddoSave(Session session)Save the specified Session into this Store.voiddoValveSave(Session session)Save the specified Session into this Store.StringgetApplicationId()SessiongetSession(byte[] state, long version)BaseCachegetSessions()intgetSize()return the size of the store cache will be over-ridden in subclassesprotected longgetUniqueId()protected booleanisReplicationCompressionEnabled()String[]keys()Return an array containing the session identifiers of all Sessions currently saved in this Store.Sessionload(String id)Load and return the Session associated with the specified session identifier from this Store, without removing it.Sessionload(String id, String version)Load and return the Session associated with the specified session identifier from this Store, without removing it.voidprocessExpires()Called by our background reaper thread to remove expired sessions in the replica - this can be done on the same instance - i.e.intremoveExpiredSessions()This method deletes all the sessions corresponding to the "appId" that should be expiredvoidremoveSynchronized(String id)Remove the Session with the specified session identifier from this Store, if present.voidsave(Session session)Save the specified Session into this Store.voidsetSessions(BaseCache sesstable)voidstop()Gracefully terminate the active use of the public methods of this component.voidupdateLastAccessTime(Session session)update the lastaccess time of the specified Session into this Store.voidvalveSave(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
-
-
-
-
Constructor Detail
-
ReplicationStore
public ReplicationStore(JavaEEIOUtils ioUtils)
Creates a new instance of ReplicationStore
-
-
Method Detail
-
getApplicationId
public String getApplicationId()
- Overrides:
getApplicationIdin classHAStoreBase
-
valveSave
public void valveSave(Session session) throws 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:
IOException- if an input/output error occurs
-
doValveSave
public void doValveSave(Session session) throws 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:
IOException- if an input/output error occurs
-
cleanup
public void cleanup()
-
getSessions
public BaseCache getSessions()
-
setSessions
public void setSessions(BaseCache sesstable)
-
stop
public void stop()
Description copied from class:StoreBaseGracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
-
save
public void save(Session session) throws 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:
IOException- if an input/output error occurs
-
isReplicationCompressionEnabled
protected boolean isReplicationCompressionEnabled()
-
doSave
public void doSave(Session session) throws 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:
IOException- if an input/output error occurs
-
clear
public void clear() throws IOExceptionClear sessions- Throws:
IOException- if an input/output error occurs
-
doRemove
public void doRemove(String id) throws 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:
doRemovein classHAStoreBase- Parameters:
id- Session identifier of the Session to be removed- Throws:
IOException- if an input/output error occurs
-
removeSynchronized
public void removeSynchronized(String id) throws 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:
removeSynchronizedin classHAStoreBase- Parameters:
id- Session identifier of the Session to be removed- Throws:
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:
processExpiresin classStoreBase
-
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(String id) throws ClassNotFoundException, 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, returnnull.- Parameters:
id- Session identifier of the session to load- Throws:
ClassNotFoundException- if a deserialization error occursIOException- if an input/output error occurs
-
load
public Session load(String id, String version) throws ClassNotFoundException, IOException
Description copied from class:StoreBaseLoad and return the Session associated with the specified session identifier from this Store, without removing it. If there is no such stored Session, returnnull.- Overrides:
loadin classStoreBase- Parameters:
id- Session identifier of the session to loadversion- The requested session version- Throws:
ClassNotFoundException- if a deserialization error occursIOException- if an input/output error occurs
-
updateLastAccessTime
public void updateLastAccessTime(Session session) throws IOException
update the lastaccess time of the specified Session into this Store.- Parameters:
session- Session to be saved- Throws:
IOException- if an input/output error occurs
-
keys
public String[] keys() throws 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:
IOException- if an input/output error occurred
-
getSize
public int getSize() throws IOExceptionDescription copied from class:HAStoreBasereturn the size of the store cache will be over-ridden in subclasses- Specified by:
getSizein interfaceStore- Overrides:
getSizein classHAStoreBase- Throws:
IOException- if an input/output error occurs
-
getUniqueId
protected long getUniqueId()
-
getSession
public Session getSession(byte[] state, long version) throws IOException
- Throws:
IOException
-
-