Class TransactionHandler
java.lang.Object
com.loomcache.server.transaction.TransactionHandler
Dispatches TX_* wire messages to the
TransactionManager.
Wire protocol
All transaction messages identify a transaction via the message'smapName field (UUID string).
- TX_BEGIN - legacy stateful begin; request key bytes carry the timeout
in milliseconds (ASCII digits). Response is
RESPONSE_OKwith value = UUID string of the new transaction. - TX_OPERATION - legacy stateful buffering; request
mapName= transaction UUID, value = a singleTransactionOpCode.encode(byte, String, String, String)payload. - TX_LOCK_KEY - replicated getForUpdate; request
mapName= transaction UUID, value = aTransactionOpCode.MAP_LOCK_KEYpayload. Response isRESPONSE_OKwith 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 viaTransactionOpCode.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 Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault transaction timeout (60s) when the client does not provide one. -
Constructor Summary
ConstructorsConstructorDescriptionTransactionHandler(TransactionManager transactionManager, int instanceNumber) TransactionHandler(TransactionManager transactionManager, int instanceNumber, @Nullable BiFunction<Message, MessageType, @Nullable Message> leaderRedirectSupplier) -
Method Summary
-
Field Details
-
DEFAULT_TIMEOUT_MILLIS
public static final long DEFAULT_TIMEOUT_MILLISDefault transaction timeout (60s) when the client does not provide one.- See Also:
-
-
Constructor Details
-
TransactionHandler
-
TransactionHandler
public TransactionHandler(TransactionManager transactionManager, int instanceNumber, @Nullable BiFunction<Message, MessageType, @Nullable Message> leaderRedirectSupplier)
-
-
Method Details
-
handle
-