Class CommandFunctionTools.ExecutorServiceAutoCloseable

java.lang.Object
org.machanism.machai.gw.tools.CommandFunctionTools.ExecutorServiceAutoCloseable
All Implemented Interfaces:
AutoCloseable
Enclosing class:
CommandFunctionTools

private static final class CommandFunctionTools.ExecutorServiceAutoCloseable extends Object implements AutoCloseable
Auto-closeable wrapper for ExecutorService so it can be used with try-with-resources.
  • Field Details

  • Constructor Details

    • ExecutorServiceAutoCloseable

      private ExecutorServiceAutoCloseable(ExecutorService executor)
      Creates a wrapper for the supplied executor service.
      Parameters:
      executor - executor service to expose through this closeable wrapper
  • Method Details

    • get

      private ExecutorService get()
      Returns the wrapped executor service.
      Returns:
      wrapped executor service
    • close

      public void close()
      Shuts down the wrapped executor immediately.
      Specified by:
      close in interface AutoCloseable