public interface IReopenChannel<C extends Channel>
Channel for some
resource and also understand when the resource has been closed and therefore
should not be reopened. This is used in combination with
FileChannelUtility to support the transparent re-opening of a file
whose channel was closed asynchronously by an interrupt in another thread
during an NIO operation.| Modifier and Type | Method and Description |
|---|---|
C |
reopenChannel()
Transparently re-opens the
Channel if it is closed. |
String |
toString()
Should include the name of the backing file (if known).
|
C reopenChannel() throws IOException
Channel if it is closed.
Note: Java will close the backing Channel if a Thread is
interrupted during an NIO operation.
Note: This method MUST NOT be invoked if the channel was closed by an
interrupt in the caller's thread. The caller can detect
this condition by a thrown ClosedByInterruptException rather than
either an AsynchronousCloseException or an
ClosedChannelException. See FileChannelUtility which
knows how to handle this.
Note: This method MUST synchronized so that concurrent operations do not
try to re-open the Channel at the same time.
Note: While the Channel may be open within the implementation of
this method, it IS NOT possible guaranteed that it will be open by the
time you try to use it except by synchronizing all activity on that
Channel. In general, that will limit throughput.
Note: Platforms and volumes (such as NFS) which DO NOT support
FileLock should re-open the file anyway without throwing an
exception. This behavior is required to run in those contexts.
Channel and never null.IllegalStateException - if the resource has been closed and is therefore no longer
permitting reads or writes on the file.IOExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.