Example usage for io.netty.buffer ByteBufHolder retain

List of usage examples for io.netty.buffer ByteBufHolder retain

Introduction

In this page you can find the example usage for io.netty.buffer ByteBufHolder retain.

Prototype

@Override
    ByteBufHolder retain();

Source Link

Usage

From source file:co.rsk.rpc.netty.RskJsonRpcHandler.java

License:Open Source License

@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBufHolder msg) {
    try {/*from  w  ww.  j  ava  2  s  .c  om*/
        RskJsonRpcRequest request = serializer.deserializeRequest(new ByteBufInputStream(msg.copy().content()));

        // TODO(mc) we should support the ModuleDescription method filters
        JsonRpcResultOrError resultOrError = request.accept(this, ctx);
        JsonRpcIdentifiableMessage response = resultOrError.responseFor(request.getId());
        ctx.writeAndFlush(new TextWebSocketFrame(serializer.serializeMessage(response)));
        return;
    } catch (IOException e) {
        LOGGER.trace("Not a known or valid JsonRpcRequest", e);
    }

    // delegate to the next handler if the message can't be matched to a known JSON-RPC request
    ctx.fireChannelRead(msg.retain());
}

From source file:com.codeabovelab.dm.platform.http.async.ByteBufHolderAdapter.java

License:Apache License

@Override
public void onAdd(ByteBufHolder chunk) {
    chunk.retain();
}