Interface ThreadExecutorRegion


public interface ThreadExecutorRegion
Interface for a region of thread executors that distributes tasks by index.

Implementations map an arbitrary long index to one of a fixed set of ThreadExecutor instances, allowing deterministic task-to-thread assignment.

Author:
渔民小镇
date:
2023-12-01
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    execute(Runnable runnable, long index)
    Get the Executor by index to run the task.
    getThreadExecutor(long index)
    Get the Executor based on the index.
  • Method Details

    • getThreadExecutor

      ThreadExecutor getThreadExecutor(long index)
      Get the Executor based on the index.
      Parameters:
      index - the index used to select an executor from the region
      Returns:
      the ThreadExecutor mapped to the given index
    • execute

      default void execute(Runnable runnable, long index)
      Get the Executor by index to run the task.
      Parameters:
      runnable - the task to execute
      index - the index used to select an executor