Class BaseUpdater<K,V>
java.lang.Object
org.keycloak.models.sessions.infinispan.changes.remote.updater.BaseUpdater<K,V>
- Type Parameters:
K
- The type of the Infinispan cache key.V
- The type of the Infinispan cache value.
- All Implemented Interfaces:
BiFunction<K,
,V, V> Updater<K,
V>
- Direct Known Subclasses:
AuthenticatedClientSessionUpdater
,LoginFailuresUpdater
,RootAuthenticationSessionUpdater
,UserSessionUpdater
Base functionality of an
Updater
implementation.
It stores the Infinispan cache key, value, version, and it states. However, it does not keep track of the changed fields in the cache value, and it is the responsibility of the implementation to do that.
Implement the method isUnchanged()
to signal if the entity was modified or not.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.keycloak.models.sessions.infinispan.changes.remote.updater.Updater
NO_VERSION
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseUpdater
(K cacheKey, V cacheValue, long versionRead, BaseUpdater.UpdaterState state) -
Method Summary
Modifier and TypeMethodDescriptionboolean
final K
getKey()
final V
getValue()
final long
int
hashCode()
final boolean
final boolean
final boolean
boolean
protected abstract boolean
final void
Marks the entity as deleted.protected final void
Resets theBaseUpdater.UpdaterState
to its initial value.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen, apply
Methods inherited from interface org.keycloak.models.sessions.infinispan.changes.remote.updater.Updater
computeExpiration, hasVersion
-
Constructor Details
-
BaseUpdater
-
-
Method Details
-
getKey
-
getValue
-
getVersionRead
public final long getVersionRead()- Specified by:
getVersionRead
in interfaceUpdater<K,
V> - Returns:
- The entity version when reading for the first time from Infinispan.
-
isDeleted
public final boolean isDeleted() -
isCreated
public final boolean isCreated() -
isReadOnly
public final boolean isReadOnly()- Specified by:
isReadOnly
in interfaceUpdater<K,
V> - Returns:
true
if the entity was not changed.
-
markDeleted
public final void markDeleted()Description copied from interface:Updater
Marks the entity as deleted.- Specified by:
markDeleted
in interfaceUpdater<K,
V>
-
isTransient
public boolean isTransient()- Specified by:
isTransient
in interfaceUpdater<K,
V> - Returns:
true
if the entity is transient and shouldn't be stored in the Infinispan cache.
-
equals
-
hashCode
public int hashCode() -
toString
-
resetState
protected final void resetState()Resets theBaseUpdater.UpdaterState
to its initial value. -
isUnchanged
protected abstract boolean isUnchanged()- Returns:
true
if the entity was changed after being created/read.
-