GeezerVison is showing netty.io — ReferenceCounted (Netty API Reference (4.1.141.Final))
Interface ReferenceCounted
- All Known Subinterfaces:
AddressedEnvelope<M,A>, Attribute, BinaryMemcacheMessage, BinaryMemcacheRequest, BinaryMemcacheResponse, BulkStringRedisContent, ByteBufHolder, DnsMessage, DnsQuery, DnsRawRecord, DnsResponse, FileRegion, FileUpload, FullBinaryMemcacheRequest, FullBinaryMemcacheResponse, FullHttpMessage, FullHttpRequest, FullHttpResponse, FullMemcacheMessage, Http2DataFrame, Http2GoAwayFrame, Http2UnknownFrame, HttpContent, HttpData, InterfaceHttpData, LastBulkStringRedisContent, LastHttpContent, LastMemcacheContent, LastSmtpContent, LastStompContentSubframe, MemcacheContent, MemcacheMessage, SmtpContent, SpdyDataFrame, SpdyUnknownFrame, StompContentSubframe, StompFrame
- All Known Implementing Classes:
AbstractBinaryMemcacheMessage, AbstractByteBuf, AbstractDerivedByteBuf, AbstractDiskHttpData, AbstractDnsMessage, AbstractHttpData, AbstractMemcacheObject, AbstractMemoryHttpData, AbstractReferenceCounted, AbstractReferenceCountedByteBuf, ArrayRedisMessage, BinaryWebSocketFrame, ByteBuf, CloseWebSocketFrame, CompositeByteBuf, ContinuationWebSocketFrame, DatagramDnsQuery, DatagramDnsResponse, DatagramPacket, DefaultAddressedEnvelope, DefaultBinaryMemcacheRequest, DefaultBinaryMemcacheResponse, DefaultBulkStringRedisContent, DefaultByteBufHolder, DefaultDnsQuery, DefaultDnsRawRecord, DefaultDnsResponse, DefaultFileRegion, DefaultFullBinaryMemcacheRequest, DefaultFullBinaryMemcacheResponse, DefaultFullHttpRequest, DefaultFullHttpResponse, DefaultHttp2DataFrame, DefaultHttp2GoAwayFrame, DefaultHttp2UnknownFrame, DefaultHttpContent, DefaultLastBulkStringRedisContent, DefaultLastHttpContent, DefaultLastMemcacheContent, DefaultLastSmtpContent, DefaultLastStompContentSubframe, DefaultMemcacheContent, DefaultSmtpContent, DefaultSpdyDataFrame, DefaultSpdyUnknownFrame, DefaultStompContentSubframe, DefaultStompFrame, DiskAttribute, DiskFileUpload, DomainDatagramPacket, DuplicatedByteBuf, EmptyByteBuf, FullBulkStringRedisMessage, HAProxyMessage, HAProxySSLTLV, HAProxyTLV, HttpServerUpgradeHandler.UpgradeEvent, MemoryAttribute, MemoryFileUpload, MixedAttribute, MixedFileUpload, MqttPublishMessage, OpenSslClientContext, OpenSslContext, OpenSslEngine, OpenSslServerContext, PemPrivateKey, PemX509Certificate, PingWebSocketFrame, PongWebSocketFrame, ReadOnlyByteBuf, ReferenceCountedOpenSslClientContext, ReferenceCountedOpenSslContext, ReferenceCountedOpenSslEngine, ReferenceCountedOpenSslServerContext, SctpMessage, SegmentedDatagramPacket, SegmentedDatagramPacket, SlicedByteBuf, SwappedByteBuf, TextWebSocketFrame, UdtMessage, UnpooledDirectByteBuf, UnpooledHeapByteBuf, UnpooledUnsafeDirectByteBuf, UnpooledUnsafeHeapByteBuf, WebSocketFrame
public interface ReferenceCounted
A reference-counted object that requires explicit deallocation.
When a new ReferenceCounted is instantiated, it starts with the reference count of 1.
retain() increases the reference count, and release() decreases the reference count.
If the reference count is decreased to 0, the object will be deallocated explicitly, and accessing
the deallocated object will usually result in an access violation.
If an object that implements ReferenceCounted is a container of other objects that implement
ReferenceCounted, the contained objects will also be released via release() when the container's
reference count becomes 0.
-
Method Summary
Modifier and Type
Method
Description
int
Returns the reference count of this object.
boolean
Decreases the reference count by 1 and deallocates this object if the reference count reaches at
0.
boolean
Decreases the reference count by the specified decrement and deallocates this object if the reference
count reaches at 0.
Increases the reference count by 1.
Increases the reference count by the specified increment.
Records the current access location of this object for debugging purposes.
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
-
Method Details
-
refCnt
int refCnt()
Returns the reference count of this object. If 0, it means this object has been deallocated.
-
retain
Increases the reference count by 1.
-
retain
Increases the reference count by the specified increment.
-
touch
Records 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
via ResourceLeakDetector. This method is a shortcut to touch(null).
-
touch
Records the current access location of this object with an additional arbitrary information for debugging
purposes. If this object is determined to be leaked, the information recorded by this operation will be
provided to you via ResourceLeakDetector.
-
release
boolean release()
Decreases the reference count by 1 and deallocates this object if the reference count reaches at
0.
- Returns:
true if and only if the reference count became 0 and this object has been deallocated
-
release
boolean release(int decrement)
Decreases the reference count by the specified decrement and deallocates this object if the reference
count reaches at 0.
- Returns:
true if and only if the reference count became 0 and this object has been deallocated
|