public final class AutoCloseables
extends java.lang.Object
AutoCloseable
.Modifier and Type | Method and Description |
---|---|
static void |
closeGracefully(Executor executor,
GracefulAutoCloseable closable,
long gracefulCloseTimeout,
java.util.concurrent.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, java.util.concurrent.TimeUnit gracefulCloseTimeoutUnit) throws java.lang.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
.java.lang.Exception
- if graceful closure failed.