AbstractReferenceCountedByteBuf Class — netty Architecture
Architecture documentation for the AbstractReferenceCountedByteBuf class in AbstractReferenceCountedByteBuf.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1["AbstractReferenceCountedByteBuf"] f4b01138_8837_612f_c7ca_c6ff8e3b548d["AbstractReferenceCountedByteBuf.java"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|defined in| f4b01138_8837_612f_c7ca_c6ff8e3b548d 8afa8180_f6a8_e6ee_27a0_2983d031b8ae["AbstractReferenceCountedByteBuf()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 8afa8180_f6a8_e6ee_27a0_2983d031b8ae e3ceb053_8946_63aa_db02_23bb4874e351["isAccessible()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| e3ceb053_8946_63aa_db02_23bb4874e351 14d35bb3_c6bb_1399_615e_070c8d11fb7f["refCnt()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 14d35bb3_c6bb_1399_615e_070c8d11fb7f ff7a94bb_09b4_56f2_da2e_eceea2cd277d["setRefCnt()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| ff7a94bb_09b4_56f2_da2e_eceea2cd277d 88c1081c_1465_a962_a8fa_47d64b5a4217["resetRefCnt()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 88c1081c_1465_a962_a8fa_47d64b5a4217 7a565b17_d49c_b859_e9ec_3d86c888d81e["ByteBuf()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 7a565b17_d49c_b859_e9ec_3d86c888d81e 2a48963a_49d8_1472_0146_7432d8df0936["release()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 2a48963a_49d8_1472_0146_7432d8df0936 1df0a274_d9ad_7fd3_bc44_085d342a2d47["handleRelease()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 1df0a274_d9ad_7fd3_bc44_085d342a2d47 06df4938_fdc1_d8e4_1b50_b03d560d2f4f["deallocate()"] 5c93eb07_a4c0_4b14_5ed7_12bab64a5cc1 -->|method| 06df4938_fdc1_d8e4_1b50_b03d560d2f4f
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java lines 24–102
public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
// this is setting the ref cnt to the initial value
private final RefCnt refCnt = new RefCnt();
protected AbstractReferenceCountedByteBuf(int maxCapacity) {
super(maxCapacity);
}
@Override
boolean isAccessible() {
// Try to do non-volatile read for performance as the ensureAccessible() is racy anyway and only provide
// a best-effort guard.
return RefCnt.isLiveNonVolatile(refCnt);
}
@Override
public int refCnt() {
return RefCnt.refCnt(refCnt);
}
/**
* An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly
*/
protected final void setRefCnt(int count) {
RefCnt.setRefCnt(refCnt, count);
}
/**
* An unsafe operation intended for use by a subclass that resets the reference count of the buffer to 1
*/
protected final void resetRefCnt() {
RefCnt.resetRefCnt(refCnt);
}
@Override
public ByteBuf retain() {
RefCnt.retain(refCnt);
return this;
}
@Override
public ByteBuf retain(int increment) {
RefCnt.retain(refCnt, increment);
return this;
}
@Override
public ByteBuf touch() {
return this;
}
@Override
public ByteBuf touch(Object hint) {
return this;
}
@Override
public boolean release() {
return handleRelease(RefCnt.release(refCnt));
}
@Override
public boolean release(int decrement) {
return handleRelease(RefCnt.release(refCnt, decrement));
}
private boolean handleRelease(boolean result) {
if (result) {
deallocate();
}
return result;
}
/**
* Called once {@link #refCnt()} is equals 0.
*/
protected abstract void deallocate();
}
Source
Frequently Asked Questions
What is the AbstractReferenceCountedByteBuf class?
AbstractReferenceCountedByteBuf is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java.
Where is AbstractReferenceCountedByteBuf defined?
AbstractReferenceCountedByteBuf is defined in buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java at line 24.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free