Class SerializingExecutor

java.lang.Object
io.grpc.internal.SerializingExecutor
All Implemented Interfaces:
Runnable, Executor

public final class SerializingExecutor extends Object implements Executor, Runnable
Executor ensuring that all Runnable tasks submitted are executed in order using the provided Executor, and serially such that no two will ever be running at the same time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a SerializingExecutor, running tasks using executor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs the given runnable strictly after all Runnables that were submitted before it, and using the executor passed to the constructor.
    void
    run()
     
    void
    Only call this from this SerializingExecutor Runnable, so that the executor is immediately visible to this SerializingExecutor executor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SerializingExecutor

      public SerializingExecutor(Executor executor)
      Creates a SerializingExecutor, running tasks using executor.
      Parameters:
      executor - Executor in which tasks should be run. Must not be null.
  • Method Details

    • setExecutor

      public void setExecutor(Executor executor)
      Only call this from this SerializingExecutor Runnable, so that the executor is immediately visible to this SerializingExecutor executor.
    • execute

      public void execute(Runnable r)
      Runs the given runnable strictly after all Runnables that were submitted before it, and using the executor passed to the constructor. .
      Specified by:
      execute in interface Executor
    • run

      public void run()
      Specified by:
      run in interface Runnable