Class BatchExecutionHandler

java.lang.Object
com.loomcache.server.handler.BatchExecutionHandler

public class BatchExecutionHandler extends Object
Server-side handler for MessageType.BATCH_EXECUTE messages.

Supports three execution modes:

  1. Sequential — operations execute one by one; partial results on failure.
  2. Atomic — operations are buffered and applied atomically; any failure rolls back all changes.
  3. 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
  • Constructor Details

    • BatchExecutionHandler

      public BatchExecutionHandler(DataStructureRegistry registry, int instanceNumber, RaftNode raftNode)
      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

      public void setNearCacheInvalidationManager(@Nullable NearCacheInvalidationManager manager)
      Install the near-cache invalidation manager. May be called at most once during node wiring; subsequent calls replace the previous manager. Pass null to disable batched invalidations (e.g. during tests that don't exercise near cache).
      Parameters:
      manager - the invalidation manager, or null to disable
    • setTransactionKeyLockManager

      public void setTransactionKeyLockManager(@Nullable TransactionKeyLockManager lockManager)
    • handle

      public Message handle(Message msg)
      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

      public BatchExecutionHandler.BatchExecutionStats getExecutionStats()
      Get a snapshot of the current batch execution statistics.
      Returns:
      BatchExecutionStats containing current metrics