Package org.infinispan.cache.impl
Class InvocationHelper
java.lang.Object
org.infinispan.cache.impl.InvocationHelper
- All Implemented Interfaces:
TransactionResourceConverter
It invokes the
VisitableCommand through this cache AsyncInterceptorChain.
It creates injected transactions and auto commits them, if the cache is transactional.
- Since:
- 11.0
- Author:
- Pedro Ruivo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BatchContainerprotected BlockingManagerprotected Configurationprotected InvocationContextFactoryprotected AsyncInterceptorChainprotected javax.transaction.TransactionManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertSynchronization(javax.transaction.Synchronization synchronization) convertXaResource(XAResource resource) createInvocationContextWithImplicitTransaction(int keyCount, boolean forceCreateTransaction) Creates an invocation context with an implicit transaction if it is required.<T> Tinvoke(ContextBuilder builder, VisitableCommand command, int keyCount) Same asinvoke(InvocationContext, VisitableCommand)but usingbuilderto build theInvocationContextto use.<T> Tinvoke(VisitableCommand command, int keyCount) Same asinvoke(ContextBuilder, VisitableCommand, int)but using the defaultContextBuilder.<T> Tinvoke(InvocationContext context, VisitableCommand command) Invokes thecommandusingcontext.<T> CompletableFuture<T>invokeAsync(ContextBuilder builder, VisitableCommand command, int keyCount) Same asinvoke(InvocationContext, VisitableCommand)but using theInvocationContextcreated bybuilder.<T> CompletableFuture<T>invokeAsync(VisitableCommand command, int keyCount) Same asinvoke(ContextBuilder, VisitableCommand, int)but using the defaultContextBuilder.<T> CompletableFuture<T>invokeAsync(InvocationContext context, VisitableCommand command) toString()
-
Field Details
-
invoker
-
invocationContextFactory
-
transactionManager
protected javax.transaction.TransactionManager transactionManager -
config
-
batchContainer
-
blockingManager
-
-
Constructor Details
-
InvocationHelper
public InvocationHelper()
-
-
Method Details
-
invoke
Same asinvoke(ContextBuilder, VisitableCommand, int)but using the defaultContextBuilder.- Type Parameters:
T- The return type.- Parameters:
command- TheVisitableCommandto invoke.keyCount- The number of keys affected by thecommand.- Returns:
- The invocation result.
-
invoke
Same asinvoke(InvocationContext, VisitableCommand)but usingbuilderto build theInvocationContextto use.- Type Parameters:
T- The return type.- Parameters:
builder- TheContextBuilderto create theInvocationContextto use.command- TheVisitableCommandto invoke.keyCount- The number of keys affected by thecommand.- Returns:
- The invocation result.
-
invoke
Invokes thecommandusingcontext.This method blocks until the
commandfinishes. UseinvokeAsync(InvocationContext, VisitableCommand)for non-blocking.- Type Parameters:
T- The return type.- Parameters:
context- TheInvocationContextto use.command- TheVisitableCommandto invoke.- Returns:
- The invocation result.
-
invokeAsync
Same asinvoke(ContextBuilder, VisitableCommand, int)but using the defaultContextBuilder.- Type Parameters:
T- The return type.- Parameters:
command- TheVisitableCommandto invoke.keyCount- The number of keys affected by thecommand.- Returns:
- A
CompletableFuturewith the result.
-
invokeAsync
public <T> CompletableFuture<T> invokeAsync(ContextBuilder builder, VisitableCommand command, int keyCount) Same asinvoke(InvocationContext, VisitableCommand)but using theInvocationContextcreated bybuilder.- Type Parameters:
T- The return type.- Parameters:
builder- TheContextBuilderto create theInvocationContextto use.command- TheVisitableCommandto invoke.keyCount- The number of keys affected by thecommand.- Returns:
- A
CompletableFuturewith the result.
-
invokeAsync
Invokes thecommandusingcontextand returns aCompletableFuture.The
CompletableFutureis completed with the return value of the invocation.- Type Parameters:
T- The return type.- Parameters:
context- TheInvocationContextto use.command- TheVisitableCommandto invoke.- Returns:
- A
CompletableFuturewith the result.
-
createInvocationContextWithImplicitTransaction
public InvocationContext createInvocationContextWithImplicitTransaction(int keyCount, boolean forceCreateTransaction) Creates an invocation context with an implicit transaction if it is required. An implicit transaction is created if there is no current transaction and autoCommit is enabled.- Parameters:
keyCount- how many keys are expected to be changed- Returns:
- the invocation context
-
toString
-
convertSynchronization
public AsyncSynchronization convertSynchronization(javax.transaction.Synchronization synchronization) - Specified by:
convertSynchronizationin interfaceTransactionResourceConverter- Parameters:
synchronization- TheSynchronizationto convert.- Returns:
- An
AsyncSynchronizationinstance ofsynchronization.
-
convertXaResource
- Specified by:
convertXaResourcein interfaceTransactionResourceConverter- Parameters:
resource- TheXAResourceto convert.- Returns:
- An
AsyncXaResourceinstance ofresource.
-