Class OutgoingBufferPool


  • public class OutgoingBufferPool
    extends java.lang.Object
    Maintains a pool of ExposedDataOutputStreams. The main reason is that a ByteArrayOutputStream starts with 1024 bytes, and almost always increases to 65K (max size of a UDP datagram). We save a few copies when the BAOS increases its size by pooling those.
    Version:
    $Id: OutgoingBufferPool.java,v 1.1 2007/01/07 01:24:52 belaban Exp $
    Author:
    Bela Ban
    • Constructor Detail

      • OutgoingBufferPool

        public OutgoingBufferPool​(int capacity)
    • Method Detail

      • take

        public ExposedDataOutputStream take()
                                     throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • put

        public void put​(ExposedDataOutputStream buf)
                 throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • dumpStats

        public java.lang.String dumpStats()