|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fusesource.hawtdispatch.BaseRetained
public class BaseRetained
Base class that implements the Retained
interface.
Constructor Summary | |
---|---|
BaseRetained()
|
Method Summary | |
---|---|
protected void |
assertRetained()
Subclasses can use this method to validate that the object has not yet been released. |
protected void |
dispose()
This method will be called once the release retained reaches zero. |
Task |
getDisposer()
|
void |
release()
Decrement the reference count of this object. |
protected void |
release(int n)
Decrements the reference count by n. |
void |
retain()
Increment the reference count of this object. |
int |
retained()
|
void |
setDisposer(Runnable disposer)
Adds a disposer runnable that is executed once the object is disposed. |
void |
setDisposer(Task disposer)
Adds a disposer runnable that is executed once the object is disposed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BaseRetained()
Method Detail |
---|
public final void setDisposer(Runnable disposer)
Adds a disposer runnable that is executed once the object is disposed.
A dispatch object's disposer runnable will be invoked on the object's target queue once the object's retain counter reaches zero. This disposer may be used by the application to release any resources associated with the object.
disposer
- public final void setDisposer(Task disposer)
Adds a disposer runnable that is executed once the object is disposed.
A dispatch object's disposer runnable will be invoked on the object's target queue once the object's retain counter reaches zero. This disposer may be used by the application to release any resources associated with the object.
disposer
- public final Task getDisposer()
public final void retain()
Increment the reference count of this object.
Calls toretain()
must be balanced with calls to
release()
.
retain
in interface Retained
public final void release()
Decrement the reference count of this object.
An object is asynchronously disposed once all references are released. Using a disposed object will cause undefined errors. The system does not guarantee that a given client is the last or only reference to a given object.
release
in interface Retained
protected final void release(int n)
Decrements the reference count by n.
An object is asynchronously disposed once all references are released. Using a disposed object will cause undefined errors. The system does not guarantee that a given client is the last or only reference to a given object.
n
- protected final void assertRetained()
IllegalStateException
- if the object has been released.public final int retained()
retained
in interface Retained
protected void dispose()
This method will be called once the release retained reaches zero. It causes the set disposer runnabled to be executed if not null.
Subclasses should override if they want to implement a custom disposing action in addition to the actions performed by the disposer object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |