Package io.grpc.netty

Class NettyWritableBufferAllocator

  • All Implemented Interfaces:
    WritableBufferAllocator

    class NettyWritableBufferAllocator
    extends java.lang.Object
    implements WritableBufferAllocator
    The default allocator for NettyWritableBuffers used by the Netty transport. We set a minimum bound to avoid unnecessary re-allocation for small follow-on writes and to facilitate Netty's caching of buffer objects for small writes. We set an upper-bound to avoid allocations outside of the arena-pool which are orders of magnitude slower. The Netty transport can receive buffers of arbitrary size and will chunk them based on flow-control so there is no transport requirement for an upper bound.

    Note: It is assumed that most applications will be using Netty's direct buffer pools for maximum performance.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private io.netty.buffer.ByteBufAllocator allocator  
      private static int MAX_BUFFER  
      private static int MIN_BUFFER  
    • Field Detail

      • allocator

        private final io.netty.buffer.ByteBufAllocator allocator
    • Constructor Detail

      • NettyWritableBufferAllocator

        NettyWritableBufferAllocator​(io.netty.buffer.ByteBufAllocator allocator)