Class StripedExecutor<Key>

java.lang.Object
com.yahoo.concurrent.StripedExecutor<Key>

public class StripedExecutor<Key> extends Object
Executor that serializes runnables with the same key, but may parallelize over different keys.
Author:
jonmv
  • Constructor Details

  • Method Details

    • execute

      public void execute(Key key, Runnable command)
      Executes the given command. If other commands are already running or queued for the given key, execution of this command happens after those, on the same thread as is running them.

      Any exception thrown by the command will only be logged, to allow subsequent commands to run.

    • shutdownAndWait

      public void shutdownAndWait()
      Shuts down the delegate executor and waits for it to terminate.
    • shutdownAndWait

      public void shutdownAndWait(Duration grace, Duration die)
      Shuts down the delegate executor and waits for the given grace duration for it to terminate. If this fails, tells the executor to ExecutorService.shutdownNow()), and waits for the die duration.