Package org.infinispan.cache.impl
Class InvocationHelper
- java.lang.Object
-
- org.infinispan.cache.impl.InvocationHelper
-
public class InvocationHelper extends Object
It invokes theVisitableCommandthrough this cacheAsyncInterceptorChain.It creates injected transactions and auto commits them, if the cache is transactional.
- Since:
- 11.0
- Author:
- Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description protected BatchContainerbatchContainerprotected BlockingManagerblockingManagerprotected Configurationconfigprotected InvocationContextFactoryinvocationContextFactoryprotected AsyncInterceptorChaininvokerprotected TransactionManagertransactionManager
-
Constructor Summary
Constructors Constructor Description InvocationHelper()
-
Method Summary
-
-
-
Field Detail
-
invoker
protected AsyncInterceptorChain invoker
-
invocationContextFactory
protected InvocationContextFactory invocationContextFactory
-
transactionManager
protected TransactionManager transactionManager
-
config
protected Configuration config
-
batchContainer
protected BatchContainer batchContainer
-
blockingManager
protected BlockingManager blockingManager
-
-
Method Detail
-
invoke
public <T> T invoke(VisitableCommand command, int keyCount)
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
public <T> T invoke(ContextBuilder builder, VisitableCommand command, int keyCount)
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
public <T> T invoke(InvocationContext context, VisitableCommand command)
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
public <T> CompletableFuture<T> invokeAsync(VisitableCommand command, int keyCount)
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
public <T> CompletableFuture<T> invokeAsync(InvocationContext context, VisitableCommand command)
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.
-
defaultContextBuilderForWrite
public ContextBuilder defaultContextBuilderForWrite()
- Returns:
- The default
ContextBuilderimplementation for write operations.
-
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
-
-