public class CloseableExecutor extends Object implements AutoCloseable
This shuts down the wrapped executor when it is closed, and can wait for tasks to exit.
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static CloseableExecutor |
of(ExecutorService executor)
Returns a closeable executor that wraps a passed in executor.
|
static CloseableExecutor |
of(ExecutorService executor,
Duration duration)
Returns a closeable executor that wraps a passed in executor.
|
public static CloseableExecutor of(ExecutorService executor)
The passed in executor is shut down when the returned CloseableExecutor is closed.
executor - the executor to wrappublic static CloseableExecutor of(ExecutorService executor, Duration duration)
The passed in executor is shut down when the returned CloseableExecutor is closed, and waits for the given duration for tasks to finish.
executor - the executor to wrapduration - the duration to wait for tasks to exitpublic void close()
close in interface AutoCloseableCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.