public class BaseRetained extends Object implements Retained
Retained
interface.Constructor and Description |
---|
BaseRetained() |
Modifier and Type | Method and Description |
---|---|
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.
|
public BaseRetained()
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()
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.
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()
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.Copyright © 2010–2017 FuseSource, Corp.. All rights reserved.