|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.client.Closeable
public abstract class Closeable
Captures the 'closed' state of an object, that is initially open, can be tested to see if it is closed, and provides a 'close' method to close it.
Responsibilities | Collaborations |
---|---|
Mark an object as closed. | |
Check if an object is closed. | |
Raise a JMS exception if an object is closed. |
checkNotClosed()
is not that helpfull, what if the caller wants to do something
other than throw an exception? It doesn't really represent a very usefull re-usable piece of code. Consider
inlining it and dropping the method.Field Summary | |
---|---|
protected AtomicBoolean |
_closed
We use an atomic boolean so that we do not have to synchronized access to this flag. |
protected AtomicBoolean |
_closing
Are we in the process of closing. |
Constructor Summary | |
---|---|
Closeable()
|
Method Summary | |
---|---|
protected void |
checkNotClosed()
Checks if this is closed, and raises a JMSException if it is. |
abstract void |
close()
Closes this object. |
boolean |
isClosed()
Checks if this is closed. |
boolean |
isClosing()
Checks if this is closis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final AtomicBoolean _closed
protected final AtomicBoolean _closing
Constructor Detail |
---|
public Closeable()
Method Detail |
---|
protected void checkNotClosed() throws JMSException
JMSException
- If this is closed.public boolean isClosed()
public boolean isClosing()
public abstract void close() throws JMSException
JMSException
- If this cannot be closed for any reason.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |