Class ByteBufferPool



  • public class ByteBufferPool
    extends java.lang.Object
    The class provides reuse of ByteBuffers. It is supposed that all requested buffers have the same size for a long period of time. That is why there is no any logic splitting buffers into different buckets (by size). It's unnecessary. At the same moment it is allowed to change requested buffers size (all smaller buffers will be discarded). It may be needed for example, if after rehandshaking netPacketBufferSize was changed.
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteBufferPool()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ByteBufferReference get(int size)  
      void release(java.nio.ByteBuffer buffer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ByteBufferPool

        public ByteBufferPool()
    • Method Detail

      • release

        public void release(java.nio.ByteBuffer buffer)