Class ExecutorEngine

java.lang.Object
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine
All Implemented Interfaces:
AutoCloseable

public final class ExecutorEngine extends Object implements AutoCloseable
Executor engine.
  • Method Details

    • createExecutorEngineWithSize

      public static ExecutorEngine createExecutorEngineWithSize(int executorSize)
      Create executor engine with executor size.
      Parameters:
      executorSize - executor size
      Returns:
      created executor engine
    • createExecutorEngineWithCPUAndResources

      public static ExecutorEngine createExecutorEngineWithCPUAndResources(int resourceCount)
      Create executor engine with CPU and resources.
      Parameters:
      resourceCount - resource count
      Returns:
      created executor engine
    • createExecutorEngineWithCPU

      public static ExecutorEngine createExecutorEngineWithCPU()
      Create executor engine with CPU.
      Returns:
      created executor engine
    • execute

      public <I, O> List<O> execute(ExecutionGroupContext<I> executionGroupContext, ExecutorCallback<I,O> callback) throws SQLException
      Execute.
      Type Parameters:
      I - type of input value
      O - type of return value
      Parameters:
      executionGroupContext - execution group context
      callback - executor callback
      Returns:
      execute result
      Throws:
      SQLException - throw if execute failure
    • execute

      public <I, O> List<O> execute(ExecutionGroupContext<I> executionGroupContext, ExecutorCallback<I,O> firstCallback, ExecutorCallback<I,O> callback, boolean serial) throws SQLException
      Execute.
      Type Parameters:
      I - type of input value
      O - type of return value
      Parameters:
      executionGroupContext - execution group context
      firstCallback - first executor callback
      callback - other executor callback
      serial - whether using multi thread execute or not
      Returns:
      execute result
      Throws:
      SQLException - throw if execute failure
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable