@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).
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.
|
setId
getId
destroy, doDestroy, initialize, isDestroyed, isInitialized
@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.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.ComponentInitializationException
public 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 © 2018. All rights reserved.