Package org.opensaml.storage.impl

# Class MemoryStorageService

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
org.opensaml.storage.AbstractStorageService
org.opensaml.storage.AbstractMapBackedStorageService
org.opensaml.storage.impl.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

Fields
Modifier and Type
Field
Description
`private Map<String,Map<String,MutableStorageRecord<?>>>`
`contextMap`
Map of contexts.
`private ReadWriteLock`
`lock`
A shared lock to synchronize access.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`MemoryStorageService()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doDestroy()`
`protected void`
`doInitialize()`
`protected TimerTask`
`getCleanupTask()`
Returns a cleanup task function to schedule for background cleanup.
`protected Map<String,Map<String,MutableStorageRecord<?>>>`
`getContextMap()`
Get the map of contexts to manipulate during operations.
`protected ReadWriteLock`
`getLock()`
Get the shared lock to synchronize access.
`boolean`
`isClustered()`
Returns true iff the storage implementation manages data independent of a single server node.
`boolean`
`isServerSide()`
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 log
Class logger.

### contextMap

@NonnullAfterInit private Map<String,Map<String,MutableStorageRecord<?>>> contextMap
Map of contexts.

### lock

@NonnullAfterInit private ReadWriteLock 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 interface `StorageCapabilities`
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 interface `StorageCapabilities`
Returns:
  true iff the storage implementation manages data independent of a single server node

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractStorageService`
Throws:
  `ComponentInitializationException`

### doDestroy

protected void doDestroy()

Overrides:
  `doDestroy` in class `AbstractStorageService`

### getContextMap

@Nonnull @Live protected Map<String,Map<String,MutableStorageRecord<?>>> 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 class `AbstractMapBackedStorageService`
Returns:
  map of contexts to manipulate

### getLock

@Nonnull protected ReadWriteLock getLock()
Get the shared lock to synchronize access.

Specified by:
  `getLock` in class `AbstractMapBackedStorageService`
Returns:
  shared lock

### getCleanupTask

@Nullable protected TimerTask getCleanupTask()
Returns a cleanup task function to schedule for background cleanup.

The default implementation does not supply one.

Overrides:
  `getCleanupTask` in class `AbstractStorageService`
Returns:
  a task object, or null