Class RemoteInfinispanSingleUseObjectProvider
java.lang.Object
org.keycloak.models.sessions.infinispan.remote.RemoteInfinispanSingleUseObjectProvider
- All Implemented Interfaces:
SingleUseObjectProvider,Provider
public class RemoteInfinispanSingleUseObjectProvider
extends Object
implements SingleUseObjectProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Field Summary
FieldsFields inherited from interface org.keycloak.models.SingleUseObjectProvider
REVOKED_KEY -
Constructor Summary
ConstructorsConstructorDescriptionRemoteInfinispanSingleUseObjectProvider(SingleUseObjectTransaction transaction, RemoteInfinispanSingleUseObjectProvider.RevokeTokenConsumer revokeTokenConsumer) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanChecks if there is a record in the store for the given key.Gets data associated with the given key.voidStores the given data and guarantees that data should be available in the store for at least the time specified bylifespanSecondsparameter.booleanputIfAbsent(String key, long lifespanInSeconds) Tries to put the key into the store.Returns data only if the removal was successful.booleanReplaces data associated with the given key in the store if the store contains the key.
-
Field Details
-
REVOKED_TOKEN_VALUE
-
-
Constructor Details
-
RemoteInfinispanSingleUseObjectProvider
public RemoteInfinispanSingleUseObjectProvider(SingleUseObjectTransaction transaction, RemoteInfinispanSingleUseObjectProvider.RevokeTokenConsumer revokeTokenConsumer)
-
-
Method Details
-
put
Description copied from interface:SingleUseObjectProviderStores the given data and guarantees that data should be available in the store for at least the time specified bylifespanSecondsparameter.- Specified by:
putin interfaceSingleUseObjectProvider- Parameters:
key- identifier for the single-use object. Must not benull.lifespanSeconds- minimum lifespan for which the key will be kept in the store. Must be positive.notes- data to associate with the key. For revoked tokens, this must be an empty Map.
-
get
Description copied from interface:SingleUseObjectProviderGets data associated with the given key.- Specified by:
getin interfaceSingleUseObjectProvider- Parameters:
key- identifier for the single-use object. Must not benull.- Returns:
- data associated with the given key, or
nullif there is no associated data.
-
remove
Description copied from interface:SingleUseObjectProviderReturns data only if the removal was successful. Implementations must guarantee that removal is single-use: if two threads (even on different cluster nodes or different multi-site nodes) callremove(key)concurrently, only one of them is allowed to succeed and return data. It must not happen that both succeed.- Specified by:
removein interfaceSingleUseObjectProvider- Parameters:
key- identifier for the single-use object. Must not benull.- Returns:
- context data associated with the key, or
nullif there is no context data available.
-
replace
Description copied from interface:SingleUseObjectProviderReplaces data associated with the given key in the store if the store contains the key.- Specified by:
replacein interfaceSingleUseObjectProvider- Parameters:
key- identifier for the single-use object. Must not benull.notes- new data to be stored.- Returns:
trueif the store contains the key and data was replaced, otherwisefalse.
-
putIfAbsent
Description copied from interface:SingleUseObjectProviderTries to put the key into the store. It will succeed only if the key is not already present.- Specified by:
putIfAbsentin interfaceSingleUseObjectProvider- Parameters:
key- identifier for the single-use object. Must not benull.lifespanInSeconds- minimum lifespan for which the key will be kept in the store. Must be positive.- Returns:
trueif the key was successfully put into the store, meaning the same key wasn't in the store before.
-
contains
Description copied from interface:SingleUseObjectProviderChecks if there is a record in the store for the given key.- Specified by:
containsin interfaceSingleUseObjectProvider- Parameters:
key- identifier for the single-use object. Must not benull.- Returns:
trueif the record is present in the store,falseotherwise.
-
close
public void close()
-