|
JBoss Remoting 3 3.2.0.Beta2-redhat-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.remoting3.spi.AbstractHandleableCloseable<T>
T
- the type of the closeable resourcepublic abstract class AbstractHandleableCloseable<T extends HandleableCloseable<T>>
A basic implementation of a closeable resource. Use as a convenient base class for your closeable resources.
Ensures that the close()
method is idempotent; implements the registry of close handlers.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jboss.remoting3.HandleableCloseable |
---|
HandleableCloseable.Key |
Constructor Summary | |
---|---|
protected |
AbstractHandleableCloseable(Executor executor)
Basic constructor. |
protected |
AbstractHandleableCloseable(Executor executor,
boolean autoClose)
Basic constructor. |
Method Summary | |
---|---|
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. |
protected void |
checkOpen()
Check if open, throwing an exception if it is not. |
void |
close()
Close this resource. |
protected void |
closeAction()
Called exactly once when the close() method is invoked; the actual close operation should take place here. |
void |
closeAsync()
Asynchronously close this resource. |
protected void |
closeComplete()
Call when close is complete. |
protected void |
closeFailed(IOException cause)
Call if an async close has failed. |
protected void |
finalize()
Finalize this closeable instance. |
protected Executor |
getExecutor()
Get the executor to use for handler invocation. |
protected boolean |
isOpen()
Read the status of this resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractHandleableCloseable(Executor executor)
executor
- the executor used to execute the close notification handlersprotected AbstractHandleableCloseable(Executor executor, boolean autoClose)
executor
- the executor used to execute the close notification handlersautoClose
- true
if this instance should automatically close on finalizeMethod Detail |
---|
protected boolean isOpen()
true
.
true
if the resource is still openprotected void closeAction() throws IOException
close()
method is invoked; the actual close operation should take place here.
This method must call closeComplete()
, directly or indirectly, for the close operation to finish
(it may happen in another thread but it must happen).
RemotingException
- if the close failed
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface HandleableCloseable<T extends HandleableCloseable<T>>
IOException
- if the close failedprotected void closeComplete()
protected void closeFailed(IOException cause)
cause
- the failure causepublic void awaitClosed() throws InterruptedException
awaitClosed
in interface HandleableCloseable<T extends HandleableCloseable<T>>
InterruptedException
- if the operation is interruptedpublic void awaitClosedUninterruptibly()
awaitClosedUninterruptibly
in interface HandleableCloseable<T extends HandleableCloseable<T>>
public void closeAsync()
closeAsync
in interface HandleableCloseable<T extends HandleableCloseable<T>>
public HandleableCloseable.Key addCloseHandler(CloseHandler<? super T> handler)
addCloseHandler
in interface HandleableCloseable<T extends HandleableCloseable<T>>
handler
- the close handler
protected Executor getExecutor()
protected void finalize() throws Throwable
finalize
in class Object
Throwable
protected void checkOpen() throws NotOpenException
NotOpenException
- if not open
|
JBoss Remoting 3 3.2.0.Beta2-redhat-1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |