PendingWrite Class — netty Architecture
Architecture documentation for the PendingWrite class in PendingWrite.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0ba8967a_d49f_213a_b0be_5431f654ab95["PendingWrite"] c4fc88b8_e639_7d03_99c3_4a22a9faee32["PendingWrite.java"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|defined in| c4fc88b8_e639_7d03_99c3_4a22a9faee32 8c2e3b5b_129a_80e9_8e60_3871006b84b7["PendingWrite()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| 8c2e3b5b_129a_80e9_8e60_3871006b84b7 f354774a_fb24_36c7_c0ea_775e3bce8b50["recycle()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| f354774a_fb24_36c7_c0ea_775e3bce8b50 bed1384e_e1e5_aedc_7ec2_c6ab2ec3348e["failAndRecycle()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| bed1384e_e1e5_aedc_7ec2_c6ab2ec3348e dc41654d_6fde_2b44_d327_cfb7a428ab9d["successAndRecycle()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| dc41654d_6fde_2b44_d327_cfb7a428ab9d 9351f0ba_e8fe_e96e_7c03_26a8b5707695["Object()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| 9351f0ba_e8fe_e96e_7c03_26a8b5707695 35442fd0_cc9a_33e9_5985_7d24d300d197["promise()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| 35442fd0_cc9a_33e9_5985_7d24d300d197 d5e7f428_1c62_9e50_3ed3_8ea371c0298f["recycleAndGet()"] 0ba8967a_d49f_213a_b0be_5431f654ab95 -->|method| d5e7f428_1c62_9e50_3ed3_8ea371c0298f
Relationship Graph
Source Code
common/src/main/java/io/netty/util/internal/PendingWrite.java lines 26–100
public final class PendingWrite {
private static final Recycler<PendingWrite> RECYCLER =
new Recycler<PendingWrite>() {
@Override
protected PendingWrite newObject(Handle<PendingWrite> handle) {
return new PendingWrite(handle);
}
};
/**
* Create a new empty {@link RecyclableArrayList} instance
*/
public static PendingWrite newInstance(Object msg, Promise<Void> promise) {
PendingWrite pending = RECYCLER.get();
pending.msg = msg;
pending.promise = promise;
return pending;
}
private final Handle<PendingWrite> handle;
private Object msg;
private Promise<Void> promise;
private PendingWrite(Handle<PendingWrite> handle) {
this.handle = handle;
}
/**
* Clear and recycle this instance.
*/
public boolean recycle() {
msg = null;
promise = null;
handle.recycle(this);
return true;
}
/**
* Fails the underlying {@link Promise} with the given cause and recycle this instance.
*/
public boolean failAndRecycle(Throwable cause) {
ReferenceCountUtil.release(msg);
if (promise != null) {
promise.setFailure(cause);
}
return recycle();
}
/**
* Mark the underlying {@link Promise} successfully and recycle this instance.
*/
public boolean successAndRecycle() {
if (promise != null) {
promise.setSuccess(null);
}
return recycle();
}
public Object msg() {
return msg;
}
public Promise<Void> promise() {
return promise;
}
/**
* Recycle this instance and return the {@link Promise}.
*/
public Promise<Void> recycleAndGet() {
Promise<Void> promise = this.promise;
recycle();
return promise;
}
}
Source
Frequently Asked Questions
What is the PendingWrite class?
PendingWrite is a class in the netty codebase, defined in common/src/main/java/io/netty/util/internal/PendingWrite.java.
Where is PendingWrite defined?
PendingWrite is defined in common/src/main/java/io/netty/util/internal/PendingWrite.java at line 26.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free