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 TypeMethodDescriptionvoid
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.void
clear()
Clears any pending blocking changes.boolean
Checks if this instance support non-blocking writes.void
registerChange
(Map.Entry<K, SessionUpdatesList<V>> entry, MergedUpdate<V> merged) It queues a database write to be applied at a future invocation.void
write
(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:
true
if 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
CompletionStage
into theAggregateCompletionStage
.- Parameters:
stage
- TheAggregateCompletionStage
to collect theCompletionStage
.entry
- TheMap.Entry
with the ID and the session.merged
- TheMergedUpdate
to 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.Entry
with the ID and the session.merged
- TheMergedUpdate
to 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
- TheKeycloakSession
to access the database.
-
clear
public void clear()Clears any pending blocking changes.- Throws:
UnsupportedOperationException
- if this instance does not support blocking writes.
-