Class MoreExecutors

java.lang.Object
org.glassfish.jersey.internal.guava.MoreExecutors

public final class MoreExecutors extends Object
Factory and utility methods for Executor, ExecutorService, and ThreadFactory.
Since:
3.0
Author:
Eric Fellheimer, Kyle Littlefield, Justin Mahoney
  • Method Details

    • directExecutor

      public static Executor directExecutor()
      Returns an Executor that runs each task in the thread that invokes execute, as in ThreadPoolExecutor.CallerRunsPolicy.

      This instance is equivalent to:

         
         final class DirectExecutor implements Executor {
           public void execute(Runnable r) {
             r.run();
           }
         }

      This should be preferred to #newDirectExecutorService() because the implementing the ExecutorService subinterface necessitates significant performance overhead.

      Since:
      18.0