Package org.opensaml.storage.impl
Class MemoryStorageService
- All Implemented Interfaces:
Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,EnumeratableStorageService
,StorageCapabilities
,StorageService
public class MemoryStorageService
extends AbstractMapBackedStorageService
implements StorageCapabilities
Implementation of
AbstractMapBackedStorageService
that stores data in-memory in a shared data structure
with no persistence.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<String,
Map<String, MutableStorageRecord<?>>> Map of contexts.private ReadWriteLock
A shared lock to synchronize access.private final org.slf4j.Logger
Class logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected TimerTask
Returns a cleanup task function to schedule for background cleanup.protected Map<String,
Map<String, MutableStorageRecord<?>>> Get the map of contexts to manipulate during operations.protected ReadWriteLock
getLock()
Get the shared lock to synchronize access.boolean
Returns true iff the storage implementation manages data independent of a single server node.boolean
Returns true iff the storage implementation manages data independent of the client.Methods inherited from class org.opensaml.storage.AbstractMapBackedStorageService
create, delete, deleteContext, deleteImpl, deleteWithVersion, getContextKeys, read, read, readImpl, reap, reapWithLock, setDirty, update, updateContextExpiration, updateExpiration, updateImpl, updateWithVersion
Methods inherited from class org.opensaml.storage.AbstractStorageService
create, create, delete, deleteWithVersion, getCapabilities, getCleanupInterval, getCleanupTaskTimer, getContextSize, getKeySize, getValueSize, read, setCleanupInterval, setCleanupTaskTimer, setContextSize, setKeySize, setValueSize, update, update, updateExpiration, updateWithVersion, updateWithVersion
Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException
Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
Methods inherited from interface org.opensaml.storage.StorageCapabilities
getContextSize, getKeySize, getValueSize
Methods inherited from interface org.opensaml.storage.StorageService
create, create, delete, deleteWithVersion, getCapabilities, read, update, update, updateExpiration, updateWithVersion, updateWithVersion
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
contextMap
Map of contexts. -
lock
A shared lock to synchronize access.
-
-
Constructor Details
-
MemoryStorageService
public MemoryStorageService()
-
-
Method Details
-
isServerSide
public boolean isServerSide()Returns true iff the storage implementation manages data independent of the client.- Specified by:
isServerSide
in interfaceStorageCapabilities
- Returns:
- true iff the storage implementation manages data independent of the client
-
isClustered
public boolean isClustered()Returns true iff the storage implementation manages data independent of a single server node.- Specified by:
isClustered
in interfaceStorageCapabilities
- Returns:
- true iff the storage implementation manages data independent of a single server node
-
doInitialize
- Overrides:
doInitialize
in classAbstractStorageService
- Throws:
ComponentInitializationException
-
doDestroy
protected void doDestroy()- Overrides:
doDestroy
in classAbstractStorageService
-
getContextMap
Get the map of contexts to manipulate during operations.This method is guaranteed to be called under cover the lock returned by {
AbstractMapBackedStorageService.getLock()
.- Specified by:
getContextMap
in classAbstractMapBackedStorageService
- Returns:
- map of contexts to manipulate
-
getLock
Get the shared lock to synchronize access.- Specified by:
getLock
in classAbstractMapBackedStorageService
- Returns:
- shared lock
-
getCleanupTask
Returns a cleanup task function to schedule for background cleanup.The default implementation does not supply one.
- Overrides:
getCleanupTask
in classAbstractStorageService
- Returns:
- a task object, or null
-