@ThreadSafeAfterInit
public class ReplayCache
extends net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
This class is thread-safe and uses a synchronized method to prevent race conditions within the underlying store (lacking an atomic "check and insert" operation).
| Modifier and Type | Field and Description |
|---|---|
private net.shibboleth.utilities.java.support.codec.StringDigester |
digester
Digester if key is too long.
|
private Logger |
log
Logger.
|
private StorageService |
storage
Backing storage for the replay cache.
|
private boolean |
strict
Flag controlling behavior on storage failure.
|
| Constructor and Description |
|---|
ReplayCache() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
check(String context,
String s,
long expires)
Returns true iff the check value is not found in the cache, and stores it.
|
void |
doInitialize() |
StorageService |
getStorage()
Get the backing store for the cache.
|
boolean |
isStrict()
Get the strictness flag.
|
void |
setStorage(StorageService storageService)
Set the backing store for the cache.
|
void |
setStrict(boolean flag)
Set the strictness flag.
|
setIdgetIddestroy, doDestroy, initialize, isDestroyed, isInitializedprivate final Logger log
@NonnullAfterInit private StorageService storage
@NonnullAfterInit private net.shibboleth.utilities.java.support.codec.StringDigester digester
private boolean strict
@NonnullAfterInit public StorageService getStorage()
public void setStorage(@Nonnull StorageService storageService)
storageService - backing store to usepublic boolean isStrict()
public void setStrict(boolean flag)
flag - true iff we should treat storage failures as a replaypublic void doInitialize()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponentnet.shibboleth.utilities.java.support.component.ComponentInitializationExceptionpublic boolean check(@Nonnull@NotEmpty String context, @Nonnull@NotEmpty String s, long expires)
context - a context label to subdivide the caches - value to checkexpires - time (in milliseconds since beginning of epoch) for disposal of value from cacheCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.