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 void
cleanup()
void
clear()
Clear sessionsvoid
doRemove(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.String
getApplicationId()
Session
getSession(byte[] state, long version)
BaseCache
getSessions()
int
getSize()
return the size of the store cache will be over-ridden in subclassesprotected long
getUniqueId()
protected boolean
isReplicationCompressionEnabled()
String[]
keys()
Return an array containing the session identifiers of all Sessions currently saved in this Store.Session
load(String id)
Load and return the Session associated with the specified session identifier from this Store, without removing it.Session
load(String id, String version)
Load and return the Session associated with the specified session identifier from this Store, without removing it.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 expiredvoid
removeSynchronized(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
setSessions(BaseCache sesstable)
void
stop()
Gracefully terminate the active use of the public methods of this component.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
-
-
-
-
Constructor Detail
-
ReplicationStore
public ReplicationStore(JavaEEIOUtils ioUtils)
Creates a new instance of ReplicationStore
-
-
Method Detail
-
getApplicationId
public String getApplicationId()
- Overrides:
getApplicationId
in 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:StoreBase
Gracefully 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 IOException
Clear 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:
doRemove
in 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:
removeSynchronized
in 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:
processExpires
in 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:StoreBase
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
.- Overrides:
load
in 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 IOException
Description copied from class:HAStoreBase
return the size of the store cache will be over-ridden in subclasses- Specified by:
getSize
in interfaceStore
- Overrides:
getSize
in 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
-
-