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
Modifier and TypeFieldDescriptionprotected BatchContainer
protected BlockingManager
protected Configuration
protected InvocationContextFactory
protected AsyncInterceptorChain
protected jakarta.transaction.TransactionManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvertSynchronization
(jakarta.transaction.Synchronization synchronization) convertXaResource
(XAResource resource) createInvocationContextWithImplicitTransaction
(int keyCount, boolean forceCreateTransaction) Creates an invocation context with an implicit transaction if it is required.<T> T
invoke
(ContextBuilder builder, VisitableCommand command, int keyCount) Same asinvoke(InvocationContext, VisitableCommand)
but usingbuilder
to build theInvocationContext
to use.<T> T
invoke
(VisitableCommand command, int keyCount) Same asinvoke(ContextBuilder, VisitableCommand, int)
but using the defaultContextBuilder
.<T> T
invoke
(InvocationContext context, VisitableCommand command) Invokes thecommand
usingcontext
.<T> CompletableFuture
<T> invokeAsync
(ContextBuilder builder, VisitableCommand command, int keyCount) Same asinvoke(InvocationContext, VisitableCommand)
but using theInvocationContext
created 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 jakarta.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
- TheVisitableCommand
to invoke.keyCount
- The number of keys affected by thecommand
.- Returns:
- The invocation result.
-
invoke
Same asinvoke(InvocationContext, VisitableCommand)
but usingbuilder
to build theInvocationContext
to use.- Type Parameters:
T
- The return type.- Parameters:
builder
- TheContextBuilder
to create theInvocationContext
to use.command
- TheVisitableCommand
to invoke.keyCount
- The number of keys affected by thecommand
.- Returns:
- The invocation result.
-
invoke
Invokes thecommand
usingcontext
.This method blocks until the
command
finishes. UseinvokeAsync(InvocationContext, VisitableCommand)
for non-blocking.- Type Parameters:
T
- The return type.- Parameters:
context
- TheInvocationContext
to use.command
- TheVisitableCommand
to invoke.- Returns:
- The invocation result.
-
invokeAsync
Same asinvoke(ContextBuilder, VisitableCommand, int)
but using the defaultContextBuilder
.- Type Parameters:
T
- The return type.- Parameters:
command
- TheVisitableCommand
to invoke.keyCount
- The number of keys affected by thecommand
.- Returns:
- A
CompletableFuture
with the result.
-
invokeAsync
public <T> CompletableFuture<T> invokeAsync(ContextBuilder builder, VisitableCommand command, int keyCount) Same asinvoke(InvocationContext, VisitableCommand)
but using theInvocationContext
created bybuilder
.- Type Parameters:
T
- The return type.- Parameters:
builder
- TheContextBuilder
to create theInvocationContext
to use.command
- TheVisitableCommand
to invoke.keyCount
- The number of keys affected by thecommand
.- Returns:
- A
CompletableFuture
with the result.
-
invokeAsync
Invokes thecommand
usingcontext
and returns aCompletableFuture
.The
CompletableFuture
is completed with the return value of the invocation.- Type Parameters:
T
- The return type.- Parameters:
context
- TheInvocationContext
to use.command
- TheVisitableCommand
to invoke.- Returns:
- A
CompletableFuture
with 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(jakarta.transaction.Synchronization synchronization) - Specified by:
convertSynchronization
in interfaceTransactionResourceConverter
- Parameters:
synchronization
- TheSynchronization
to convert.- Returns:
- An
AsyncSynchronization
instance ofsynchronization
.
-
convertXaResource
- Specified by:
convertXaResource
in interfaceTransactionResourceConverter
- Parameters:
resource
- TheXAResource
to convert.- Returns:
- An
AsyncXaResource
instance ofresource
.
-