Class FlashJournalRM.BufferPool

  • Enclosing class:
    FlashJournalRM

    protected static class FlashJournalRM.BufferPool
    extends Object
    The BufferPool class recycles up to a maximum number of Buffer objects.
    • Constructor Detail

      • BufferPool

        public BufferPool​(int cbBuffer,
                          int cMaxBuffers)
        Instantiate a buffer pool to provide buffers to the journal appending process.
        Parameters:
        cbBuffer - the size of each buffer
        cMaxBuffers - the maximum number of buffers to hold on to
    • Method Detail

      • allocate

        public FlashJournalRM.Buffer allocate​(byte[] abOv)
        Allocate a buffer from the buffer pool.
        Parameters:
        abOv - the overlay byte[]
        Returns:
        a Buffer instance
      • release

        public void release​(FlashJournalRM.Buffer buf)
        Return a buffer to the pool. Note that this isn't a precisely limited pool; it's possible that it could hold slightly more than the maximum size due to the avoidance of synchronization.
        Parameters:
        buf - the Buffer to return to the pool
      • getSize

        public int getSize()
        Determine the current size of the pool.
        Returns:
        the number of buffers in the pool