Class AbstractReferenceCounted
java.lang.Object
io.netty.util.AbstractReferenceCounted
- All Implemented Interfaces:
ReferenceCounted
- Direct Known Subclasses:
AbstractDnsMessage, AbstractHttpData, AbstractMemcacheObject, ArrayRedisMessage, DefaultFileRegion, HAProxyMessage, MixedAttribute, MixedFileUpload, PemPrivateKey
Abstract base class for classes wants to implement
ReferenceCounted.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidCalled oncerefCnt()is equals 0.intrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement) Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.retain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.protected voidsetRefCnt(int refCnt) An unsafe operation intended for use by a subclass that sets the reference count of the object directlytouch()Records the current access location of this object for debugging purposes.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReferenceCounted
touch
-
Constructor Details
-
AbstractReferenceCounted
public AbstractReferenceCounted()
-
-
Method Details
-
refCnt
public int refCnt()Description copied from interface:ReferenceCountedReturns the reference count of this object. If0, it means this object has been deallocated.- Specified by:
refCntin interfaceReferenceCounted
-
setRefCnt
protected void setRefCnt(int refCnt) An unsafe operation intended for use by a subclass that sets the reference count of the object directly -
retain
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCountedRecords the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector. This method is a shortcut totouch(null).- Specified by:
touchin interfaceReferenceCounted
-
release
public boolean release()Description copied from interface:ReferenceCountedDecreases the reference count by1and deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
release
public boolean release(int decrement) Description copied from interface:ReferenceCountedDecreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
deallocate
protected abstract void deallocate()Called oncerefCnt()is equals 0.
-