Class TransactionContext

java.lang.Object
org.infinispan.server.resp.tx.TransactionContext

public final class TransactionContext extends Object
Delimit the context of commands run by an EXEC command.

In a transaction execution, the commands are queued and executed (in order) after receiving an EXEC command. This context provides delimitation of the transaction execution so commands are aware whether they are running from inside a transaction.

Since:
15.1
  • Method Details

    • startTransactionContext

      public static void startTransactionContext(io.netty.channel.ChannelHandlerContext ctx)
      Start the transaction context.
      Parameters:
      ctx - The client context executing the transaction.
      Throws:
      IllegalStateException - in case another context is in place.
    • endTransactionContext

      public static void endTransactionContext(io.netty.channel.ChannelHandlerContext ctx)
      Finish the transaction context.
      Parameters:
      ctx - The client context executing the transaction.
      Throws:
      IllegalStateException - in case no transaction context is in place.
    • isInTransactionContext

      public static boolean isInTransactionContext(io.netty.channel.ChannelHandlerContext ctx)
      Verify whether the current client is in a transactional context.
      Parameters:
      ctx - The client context to verify.
      Returns:
      true if running from a transaction, false, otherwise.