public abstract class AbstractReferenceCounted extends java.lang.Object implements ReferenceCounted
ReferenceCounted
.构造器和说明 |
---|
AbstractReferenceCounted() |
限定符和类型 | 方法和说明 |
---|---|
protected abstract void |
deallocate()
Called once
refCnt() is equals 0. |
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0 . |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0 . |
ReferenceCounted |
retain()
Increases the reference count by
1 . |
ReferenceCounted |
retain(int increment)
Increases the reference count by the specified
increment . |
protected void |
setRefCnt(int refCnt)
An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly
|
public final int refCnt()
ReferenceCounted
0
, it means this object has been deallocated.refCnt
在接口中 ReferenceCounted
protected final void setRefCnt(int refCnt)
public ReferenceCounted retain()
ReferenceCounted
1
.retain
在接口中 ReferenceCounted
public ReferenceCounted retain(int increment)
ReferenceCounted
increment
.retain
在接口中 ReferenceCounted
public boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.release
在接口中 ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic boolean release(int decrement)
ReferenceCounted
decrement
and deallocates this object if the reference
count reaches at 0
.release
在接口中 ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedprotected abstract void deallocate()
refCnt()
is equals 0.