Package org.jboss.remoting3
Interface HandleableCloseable<T>
-
- Type Parameters:
T
- the type that is passed to the close handler
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Subinterfaces:
Channel
,Connection
,ConnectionHandler
,ConnectionProvider
,Endpoint
,Registration
- All Known Implementing Classes:
AbstractHandleableCloseable
,LegacyEndpoint
public interface HandleableCloseable<T> extends Closeable
A Remoting resource that can be closed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
HandleableCloseable.Key
A key which may be used to remove this handler.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HandleableCloseable.Key
addCloseHandler(CloseHandler<? super T> handler)
Add a handler that will be called upon close.void
awaitClosed()
Wait for a resource close to complete.void
awaitClosedUninterruptibly()
Wait for a resource close to complete.void
close()
Close this resource.void
closeAsync()
Asynchronously close this resource.boolean
isOpen()
Read the status of this resource.
-
-
-
Method Detail
-
close
void close() throws IOException
Close this resource. Call any registered close handlers. Calling this method more than once will not have any additional effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- if the close failed
-
awaitClosed
void awaitClosed() throws InterruptedException
Wait for a resource close to complete.- Throws:
InterruptedException
- if the operation is interrupted
-
awaitClosedUninterruptibly
void awaitClosedUninterruptibly()
Wait for a resource close to complete.
-
closeAsync
void closeAsync()
Asynchronously close this resource. Returns immediately.
-
addCloseHandler
HandleableCloseable.Key addCloseHandler(CloseHandler<? super T> handler)
Add a handler that will be called upon close. If the resource is already closed, the handler will be called immediately.- Parameters:
handler
- the close handler- Returns:
- a key which may be used to later remove this handler
-
isOpen
boolean isOpen()
Read the status of this resource. This is just a snapshot in time; there is no guarantee that the resource will remain open for any amount of time, even if this method returnstrue
.- Returns:
true
if the resource is still open
-
-