Package com.mastfrog.giulius.util
Class ExecutorServiceProvider
java.lang.Object
com.mastfrog.giulius.util.ExecutorServiceProvider
- All Implemented Interfaces:
com.google.inject.Provider<ExecutorService>,javax.inject.Provider<ExecutorService>
@Deprecated
public final class ExecutorServiceProvider
extends Object
implements com.google.inject.Provider<ExecutorService>
Deprecated.
The giulius-threadpool library offers all of this and more
A provider of ExecutorServices which automatically registers them with the
ShutdownHookRegistry for clean unloading. Use the static methods to create
instances during module configuration. This simply saves frequently written
code to shut down a thread pool on dependencies shutdown (which may mean the
end of a unit test, or application clean reload without stopping the VM -
shutdown does not necessarily mean the VM itself is being shut down).
- Author:
- Tim Boudreau
-
Method Summary
Modifier and TypeMethodDescriptionget()Deprecated.static com.google.inject.Provider<ExecutorService>provider(int threads, com.google.inject.Binder binder) Deprecated.Create a fixed thread pool using the passed number of threads and binder.static com.google.inject.Provider<ExecutorService>provider(com.google.inject.Binder binder) Deprecated.Create a "work stealing" thread pool using Executors.newWorkStealingPool() and bind it to be shutdown on dependencies shutdown.static com.google.inject.Provider<ExecutorService>provider(Supplier<ExecutorService> supplier, com.google.inject.Binder binder) Deprecated.Create a provider, using the passed supplier to create the thread pool.
-
Method Details
-
get
Deprecated.- Specified by:
getin interfacecom.google.inject.Provider<ExecutorService>- Specified by:
getin interfacejavax.inject.Provider<ExecutorService>
-
provider
public static com.google.inject.Provider<ExecutorService> provider(Supplier<ExecutorService> supplier, com.google.inject.Binder binder) Deprecated.Create a provider, using the passed supplier to create the thread pool.- Parameters:
supplier- A supplierbinder- The binder- Returns:
- A provider
-
provider
public static com.google.inject.Provider<ExecutorService> provider(int threads, com.google.inject.Binder binder) Deprecated.Create a fixed thread pool using the passed number of threads and binder.- Parameters:
threads- The thread countbinder-- Returns:
-
provider
Deprecated.Create a "work stealing" thread pool using Executors.newWorkStealingPool() and bind it to be shutdown on dependencies shutdown.- Parameters:
binder- The binder- Returns:
- A provider
-