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 Type
    Method
    Description
    get()
    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.

    Methods inherited from class java.lang.Object

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

    • get

      public ExecutorService get()
      Deprecated.
      Specified by:
      get in interface com.google.inject.Provider<ExecutorService>
      Specified by:
      get in interface javax.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 supplier
      binder - 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 count
      binder -
      Returns:
    • provider

      public 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.
      Parameters:
      binder - The binder
      Returns:
      A provider