Class JpaChangesPerformer<K,V extends SessionEntity>
java.lang.Object
org.keycloak.models.sessions.infinispan.changes.JpaChangesPerformer<K,V>
-
Constructor Summary
ConstructorsConstructorDescriptionJpaChangesPerformer(String cacheName, ArrayBlockingQueue<PersistentUpdate> batchingQueue) -
Method Summary
Modifier and TypeMethodDescriptionvoidasyncWrite(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage, Map.Entry<K, SessionUpdatesList<V>> entry, MergedUpdate<V> merged) Performs a non-blocking write into the database.voidclear()Clears any pending blocking changes.booleanChecks if this instance support non-blocking writes.voidregisterChange(Map.Entry<K, SessionUpdatesList<V>> entry, MergedUpdate<V> merged) It queues a database write to be applied at a future invocation.voidwrite(KeycloakSession session) Applies all the pending write operation into the database.
-
Constructor Details
-
JpaChangesPerformer
-
-
Method Details
-
isNonBlocking
public boolean isNonBlocking()Checks if this instance support non-blocking writes.If this instance is non-blocking, the invoker must use
asyncWrite(AggregateCompletionStage, Map.Entry, MergedUpdate).Otherwise, the implementation must support
registerChange(Map.Entry, MergedUpdate)andwrite(KeycloakSession). The invoker should register the change using the first method and applied them in a blocking way using the later method.- Returns:
trueif this instance is non-blocking.- See Also:
-
asyncWrite
public void asyncWrite(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage, Map.Entry<K, SessionUpdatesList<V>> entry, MergedUpdate<V> merged) Performs a non-blocking write into the database.The implementation should register the
CompletionStageinto theAggregateCompletionStage.- Parameters:
stage- TheAggregateCompletionStageto collect theCompletionStage.entry- TheMap.Entrywith the ID and the session.merged- TheMergedUpdateto be applied to the existing session.- Throws:
NullPointerException- if this instance does not support non-blocking writes.- See Also:
-
registerChange
It queues a database write to be applied at a future invocation.- Parameters:
entry- TheMap.Entrywith the ID and the session.merged- TheMergedUpdateto be applied to the existing session.- Throws:
UnsupportedOperationException- if this instance does not support blocking writes.- See Also:
-
write
Applies all the pending write operation into the database.- Parameters:
session- TheKeycloakSessionto access the database.
-
clear
public void clear()Clears any pending blocking changes.- Throws:
UnsupportedOperationException- if this instance does not support blocking writes.
-