org.cdlib.xtf.saxonExt.pipe
Class PipeBufferPool

Object
  extended by PipeBufferPool

 class PipeBufferPool
extends Object

Keeps a pool of buffers used by the Pipe saxon extension functions, to minimize per-request memory gobbling.


Field Summary
(package private) static int BUF_SIZE
           
(package private) static int MAX_SPARE_BUFS
           
(package private) static LinkedList spareBuffers
           
 
Constructor Summary
PipeBufferPool()
           
 
Method Summary
(package private) static byte[] allocBuffer()
          Allocate a buffer to use for I/O.
(package private) static void deallocBuffer(byte[] buf)
          Return a buffer so it can be re-used later.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SPARE_BUFS

static final int MAX_SPARE_BUFS
See Also:
Constant Field Values

BUF_SIZE

static final int BUF_SIZE
See Also:
Constant Field Values

spareBuffers

static LinkedList spareBuffers
Constructor Detail

PipeBufferPool

PipeBufferPool()
Method Detail

allocBuffer

static byte[] allocBuffer()
Allocate a buffer to use for I/O. Uses previously allocated buffer if possible (that buffer must have been deallocated using deallocBuffer()).


deallocBuffer

static void deallocBuffer(byte[] buf)
Return a buffer so it can be re-used later. If we already have enough spare buffers then make it a weak reference so the buffer can be garbage-collected.