Class CloseableExecutor

  • All Implemented Interfaces:
    AutoCloseable

    public class CloseableExecutor
    extends Object
    implements AutoCloseable
    AutoCloseable wrapper around an executor.

    This shuts down the wrapped executor when it is closed.

    • Method Detail

      • of

        public static CloseableExecutor of​(ExecutorService executor)
        Returns a closeable executor that wraps a passed in executor.

        The passed in executor is shut down when the returned CloseableExecutor is closed.

        Parameters:
        executor - the executor to wrap
        Returns:
        a CloseableExecutor