Class ExecutorWrapperService

  • All Implemented Interfaces:
    com.google.common.util.concurrent.Service

    
    public class ExecutorWrapperService<T extends ExecutorService>
    extends AbstractIdleService
                        

    Wraps an ExecutorService into a guava AbstractIdleService.

    Wrapping ExecutorServices into guava services allows orchestrating thread pool instances, especially shutting them down properly when shutting down a parent service instance.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      T get() Gets the ExecutorService instance when service is running.
      String toString()
      • Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

        addListener, awaitRunning, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExecutorWrapperService

        ExecutorWrapperService(Callable<T> serviceCreator, String serviceName, String frameworkIdentifier)
        Creates a wrapper around an ExecutorService.
        Parameters:
        serviceCreator - Callable which returns an ExecutorService.
        serviceName - name for the service, used in logging.
        frameworkIdentifier - identifier used for logging