Example usage for io.netty.util ReferenceCountUtil retain

List of usage examples for io.netty.util ReferenceCountUtil retain

Introduction

In this page you can find the example usage for io.netty.util ReferenceCountUtil retain.

Prototype

@SuppressWarnings("unchecked")
public static <T> T retain(T msg, int increment) 

Source Link

Document

Try to call ReferenceCounted#retain(int) if the specified message implements ReferenceCounted .

Usage

From source file:org.apache.spark.network.protocol.MessageWithHeader.java

License:Apache License

@Override
public MessageWithHeader retain(int increment) {
    super.retain(increment);
    header.retain(increment);//  w  w w  .ja va2s .co  m
    ReferenceCountUtil.retain(body, increment);
    if (managedBuffer != null) {
        for (int i = 0; i < increment; i++) {
            managedBuffer.retain();
        }
    }
    return this;
}