Class TransactionHandler

java.lang.Object
com.loomcache.server.transaction.TransactionHandler

public final class TransactionHandler extends Object
Dispatches TX_* wire messages to the TransactionManager.

Wire protocol

All transaction messages identify a transaction via the message's mapName field (UUID string).
  • TX_BEGIN - legacy stateful begin; request key bytes carry the timeout in milliseconds (ASCII digits). Response is RESPONSE_OK with value = UUID string of the new transaction.
  • TX_OPERATION - legacy stateful buffering; request mapName = transaction UUID, value = a single TransactionOpCode.encode(byte, String, String, String) payload.
  • TX_LOCK_KEY - replicated getForUpdate; request mapName = transaction UUID, value = a TransactionOpCode.MAP_LOCK_KEY payload. Response is RESPONSE_OK with the current serialized map value when present.
  • TX_COMMIT - request mapName = transaction UUID. Empty payload commits a legacy stateful server-side transaction session; non-empty payload commits a stateless client-buffered transaction encoded via TransactionOpCode.encodeBatch(List).
  • TX_ROLLBACK - legacy stateful rollback; request mapName = transaction UUID.

Scope: Legacy TX_BEGIN/TX_OPERATION sessions remain available for backwards compatibility. Current clients can instead buffer operations locally and submit a single stateless TX_COMMIT, avoiding loss of the transaction when leadership changes before commit.

Since:
2.0
  • Field Details

    • DEFAULT_TIMEOUT_MILLIS

      public static final long DEFAULT_TIMEOUT_MILLIS
      Default transaction timeout (60s) when the client does not provide one.
      See Also:
  • Constructor Details

  • Method Details

    • handle

      public Message handle(Message msg)
      Dispatch an incoming TX_* message. Returns a response message (never null).
      Parameters:
      msg - the incoming message (must have a TX_* type)
      Returns:
      a response message; never null