Methods Summary |
---|
public void | acquireReference()Acquires a reference to the object.
synchronized(this) {
if (mReferenceCount <= 0) {
throw new IllegalStateException(
"attempt to re-open an already-closed object: " + this);
}
mReferenceCount++;
}
|
public void | close()Releases a reference to the object, closing the object if the last reference
was released.
Calling this method is equivalent to calling {@link #releaseReference}.
releaseReference();
|
protected abstract void | onAllReferencesReleased()Called when the last reference to the object was released by
a call to {@link #releaseReference()} or {@link #close()}.
|
protected void | onAllReferencesReleasedFromContainer()Called when the last reference to the object was released by
a call to {@link #releaseReferenceFromContainer()}.
onAllReferencesReleased();
|
public void | releaseReference()Releases a reference to the object, closing the object if the last reference
was released.
boolean refCountIsZero = false;
synchronized(this) {
refCountIsZero = --mReferenceCount == 0;
}
if (refCountIsZero) {
onAllReferencesReleased();
}
|
public void | releaseReferenceFromContainer()Releases a reference to the object that was owned by the container of the object,
closing the object if the last reference was released.
boolean refCountIsZero = false;
synchronized(this) {
refCountIsZero = --mReferenceCount == 0;
}
if (refCountIsZero) {
onAllReferencesReleasedFromContainer();
}
|