public final class AutoCloseables
extends Object
AutoCloseable.| Modifier and Type | Method and Description |
|---|---|
static void |
closeGracefully(Executor executor,
GracefulAutoCloseable closable,
long gracefulCloseTimeout,
TimeUnit gracefulCloseTimeoutUnit)
Invokes
GracefulAutoCloseable.closeGracefully() on the closable, applies a timeout, and if the
timeout fires forces a call to AutoCloseable.close(). |
public static void closeGracefully(Executor executor, GracefulAutoCloseable closable, long gracefulCloseTimeout, TimeUnit gracefulCloseTimeoutUnit) throws Exception
GracefulAutoCloseable.closeGracefully() on the closable, applies a timeout, and if the
timeout fires forces a call to AutoCloseable.close().executor - Executor to use for applying timeout.closable - The GracefulAutoCloseable to initiate GracefulAutoCloseable.closeGracefully() on.gracefulCloseTimeout - The timeout duration to wait for GracefulAutoCloseable.closeGracefully() to
complete.gracefulCloseTimeoutUnit - The time unit applied to gracefulCloseTimeout.Exception - if graceful closure failed.