Class BatchExecutionHandler
java.lang.Object
com.loomcache.server.handler.BatchExecutionHandler
Server-side handler for
MessageType.BATCH_EXECUTE messages.
Supports three execution modes:
- Sequential — operations execute one by one; partial results on failure.
- Atomic — operations are buffered and applied atomically; any failure rolls back all changes.
- Replicated atomic — the batch is committed as a single Raft log entry before being applied atomically on all replicas.
Each individual operation is dispatched by opcode to the appropriate
DataStructureRegistry method (map put, counter increment, etc.).
- Since:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordBatch execution statistics record. -
Constructor Summary
ConstructorsConstructorDescriptionBatchExecutionHandler(DataStructureRegistry registry, int instanceNumber, RaftNode raftNode) Create a batch execution handler for a specific cluster node. -
Method Summary
Modifier and TypeMethodDescriptionGet a snapshot of the current batch execution statistics.Handle a BATCH_EXECUTE message.voidsetNearCacheInvalidationManager(@Nullable NearCacheInvalidationManager manager) Install the near-cache invalidation manager.voidsetTransactionKeyLockManager(@Nullable TransactionKeyLockManager lockManager)
-
Constructor Details
-
BatchExecutionHandler
Create a batch execution handler for a specific cluster node.- Parameters:
registry- the data structure registry (non-null)instanceNumber- the node instance number (non-negative)raftNode- the Raft consensus node (non-null, for replicated batches)- Throws:
NullPointerException- if registry or raftNode is null
-
-
Method Details
-
setNearCacheInvalidationManager
Install the near-cache invalidation manager. May be called at most once during node wiring; subsequent calls replace the previous manager. Passnullto disable batched invalidations (e.g. during tests that don't exercise near cache).- Parameters:
manager- the invalidation manager, ornullto disable
-
setTransactionKeyLockManager
-
handle
Handle a BATCH_EXECUTE message.- Parameters:
msg- the batch message (non-null, value contains serialized operations + flags)- Returns:
- RESPONSE_OK on success, RESPONSE_ERROR on failure
- Throws:
NullPointerException- if msg is null
-
getExecutionStats
Get a snapshot of the current batch execution statistics.- Returns:
- BatchExecutionStats containing current metrics
-