public interface Closable
Modifier and Type | Interface and Description |
---|---|
static interface |
Closable.CloseAutomaton
The
Closable.CloseAutomaton interface defines those methods related to the
closing of connection(s) life-cycle. |
static interface |
Closable.CloseBuilder<B extends Closable.CloseBuilder<B>>
To enable the
Closable functionality to be invoked in a builder
chain. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component's connection(s).
|
default void |
closeIn(int aCloseInMillis)
Tries to close the component's connection(s) after the given time in
milliseconds.
|
default void |
closeQuietly()
Tries to close the component's connection(s).
|
default void |
closeUnchecked()
Closes the component by calling
close() without you to require
catching an CloseException . |
void close() throws CloseException
CloseException
as
upon close we may have to do things like flushing buffers which can fail
(and would otherwise fail unhandled or even worse unnoticed).CloseException
- in case closing or pre-closing (flushing) fails.default void closeUnchecked()
close()
without you to require
catching an CloseException
.org.refcodes.exception.HiddenException
- encapsulates the cause and is thrown upon
encountering a CloseException
exceptiondefault void closeQuietly()
close()
method with an
according exception.
The default implementation tries to invoke a "flush()" in case the
implementing instance implements the Flushable
interface
before invoking close()
. Additionally the default implementation
tries IoRetryCount.NORM
number of times to invoke
close()
till a timeout of IoTimeout.NORM
is reached. In
any case this method will return quietly without throwing any exception.default void closeIn(int aCloseInMillis)
HiddenException
. Use (if implemented)
ClosedAccessor.isClosed()
to finally determine whether the close
operation succeeded.aCloseInMillis
- The time in milliseconds to pass till
close()
is called.Copyright © 2018. All rights reserved.