Top Description Fields Constructors Methods
io.netty.util

public abstract Class AbstractReferenceCounted

extends Object
implements ReferenceCounted
Class Inheritance
All Implemented Interfaces
io.netty.util.ReferenceCounted
Imports
java.util.concurrent.atomic.AtomicIntegerFieldUpdater, io.netty.util.internal.ReferenceCountUpdater

Abstract base class for classes wants to implement ReferenceCounted.

Field Summary

Modifier and TypeField and Description
private static final AtomicIntegerFieldUpdater<AbstractReferenceCounted>
private volatile int
private static final long
private static final ReferenceCountUpdater<AbstractReferenceCounted>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract void
deallocate()

Called once refCnt() is equals 0.

private boolean
handleRelease(boolean result)

public int
refCnt()

Implements io.netty.util.ReferenceCounted.refCnt.

Returns the reference count of this object.
public boolean
release()

Implements io.netty.util.ReferenceCounted.release.

Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
public boolean
release(int decrement)

Implements io.netty.util.ReferenceCounted.release.

Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
public ReferenceCounted
retain()

Implements io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.
public ReferenceCounted
retain(int increment)

Implements io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.
protected final void
setRefCnt(int refCnt)

An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly

public ReferenceCounted
touch()

Implements io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AIF_UPDATERback to summary
private static final AtomicIntegerFieldUpdater<AbstractReferenceCounted> AIF_UPDATER
refCntback to summary
private volatile int refCnt
Annotations
@SuppressWarnings:unused, FieldMayBeFinal
REFCNT_FIELD_OFFSETback to summary
private static final long REFCNT_FIELD_OFFSET
updaterback to summary
private static final ReferenceCountUpdater<AbstractReferenceCounted> updater

Constructor Detail

AbstractReferenceCountedback to summary
public AbstractReferenceCounted()

Method Detail

deallocateback to summary
protected abstract void deallocate()

Called once refCnt() is equals 0.

handleReleaseback to summary
private boolean handleRelease(boolean result)
refCntback to summary
public int refCnt()

Implements io.netty.util.ReferenceCounted.refCnt.

Doc from io.netty.util.ReferenceCounted.refCnt.

Returns the reference count of this object. If 0, it means this object has been deallocated.

Annotations
@Override
releaseback to summary
public boolean release()

Implements io.netty.util.ReferenceCounted.release.

Doc from io.netty.util.ReferenceCounted.release.

Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.

Returns:boolean

true if and only if the reference count became 0 and this object has been deallocated

Annotations
@Override
releaseback to summary
public boolean release(int decrement)

Implements io.netty.util.ReferenceCounted.release.

Doc from io.netty.util.ReferenceCounted.release.

Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.

Returns:boolean

true if and only if the reference count became 0 and this object has been deallocated

Annotations
@Override
retainback to summary
public ReferenceCounted retain()

Implements io.netty.util.ReferenceCounted.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.

Annotations
@Override
retainback to summary
public ReferenceCounted retain(int increment)

Implements io.netty.util.ReferenceCounted.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.

Annotations
@Override
setRefCntback to summary
protected final void setRefCnt(int refCnt)

An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly

touchback to summary
public ReferenceCounted touch()

Implements io.netty.util.ReferenceCounted.touch.

Doc from io.netty.util.ReferenceCounted.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).

Annotations
@Override