Class MoreExecutors
java.lang.Object
org.glassfish.jersey.internal.guava.MoreExecutors
- Since:
- 3.0
- Author:
- Eric Fellheimer, Kyle Littlefield, Justin Mahoney
-
Method Summary
Modifier and TypeMethodDescriptionstatic Executor
Returns anExecutor
that runs each task in the thread that invokesexecute
, as inThreadPoolExecutor.CallerRunsPolicy
.
-
Method Details
-
directExecutor
Returns anExecutor
that runs each task in the thread that invokesexecute
, as inThreadPoolExecutor.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 theExecutorService
subinterface necessitates significant performance overhead.- Since:
- 18.0
-