com.sun.grizzly.memory.slab
Class SlabPoolImpl

java.lang.Object
  extended by com.sun.grizzly.memory.slab.SlabPoolImpl
All Implemented Interfaces:
SlabMemoryManagerFactory.SlabPool, Closeable

public final class SlabPoolImpl
extends Object
implements SlabMemoryManagerFactory.SlabPool

Author:
Ken Cavanaugh

Constructor Summary
SlabPoolImpl(int maxAllocationSize, long minSize, long maxSize, boolean bufferType)
           
 
Method Summary
 long allocatedSpace()
          Total bytes allocated.
 boolean bufferType()
          The BufferType of every Slab in this pool.
 void close()
           
 void dispose(Slab slab, ByteBuffer buffer)
           
 long freeSpace()
          Current free space in pool.
 Slab getSlab()
           
 int maxAllocationSize()
          The maxAllocationSize of every Slab in this pool.
 long maxSize()
          Maximum size to which pool may expand as specified when the SlabPool was created.
 long minSize()
          Minimum size of pool, as specified when the SlabPool was created.
 int numFreeSlabs()
          Number of free slabs available for use in Allocators using this SlabPool.
 int numFullSlabs()
          Number of full slabs which still have allocations in use.
 int numPartialSlabs()
          Number of slabs currently in use by Allocators.
 void releaseSlab(Slab slab)
           
 long unavailableSpace()
          Total bytes disposed but not yet available for use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlabPoolImpl

public SlabPoolImpl(int maxAllocationSize,
                    long minSize,
                    long maxSize,
                    boolean bufferType)
Method Detail

close

public void close()
Specified by:
close in interface Closeable

maxAllocationSize

public int maxAllocationSize()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
The maxAllocationSize of every Slab in this pool.

Specified by:
maxAllocationSize in interface SlabMemoryManagerFactory.SlabPool

minSize

public long minSize()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Minimum size of pool, as specified when the SlabPool was created.

Specified by:
minSize in interface SlabMemoryManagerFactory.SlabPool

maxSize

public long maxSize()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Maximum size to which pool may expand as specified when the SlabPool was created.

Specified by:
maxSize in interface SlabMemoryManagerFactory.SlabPool

numFreeSlabs

public int numFreeSlabs()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Number of free slabs available for use in Allocators using this SlabPool.

Specified by:
numFreeSlabs in interface SlabMemoryManagerFactory.SlabPool

numPartialSlabs

public int numPartialSlabs()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Number of slabs currently in use by Allocators.

Specified by:
numPartialSlabs in interface SlabMemoryManagerFactory.SlabPool

numFullSlabs

public int numFullSlabs()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Number of full slabs which still have allocations in use. Full slabs become empty as soon as all of their allocations have been disposed.

Specified by:
numFullSlabs in interface SlabMemoryManagerFactory.SlabPool

freeSpace

public long freeSpace()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Current free space in pool. freeSpace() + allocatedSpace() is the total size of the pool. This may at times temporarily exceed maxSize, but excess space will be released from the pool when it is freed and the total size is bigger than the maximum size.

Specified by:
freeSpace in interface SlabMemoryManagerFactory.SlabPool

unavailableSpace

public long unavailableSpace()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Total bytes disposed but not yet available for use. This is always less than allocatedSpace.

Specified by:
unavailableSpace in interface SlabMemoryManagerFactory.SlabPool

allocatedSpace

public long allocatedSpace()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
Total bytes allocated. This includes unavailableSpace(). allocatedSpace() - unavailableSpace() is the space still actively in use by clients of the SlabPool.

Specified by:
allocatedSpace in interface SlabMemoryManagerFactory.SlabPool

bufferType

public boolean bufferType()
Description copied from interface: SlabMemoryManagerFactory.SlabPool
The BufferType of every Slab in this pool.

Specified by:
bufferType in interface SlabMemoryManagerFactory.SlabPool

getSlab

public Slab getSlab()

releaseSlab

public void releaseSlab(Slab slab)

dispose

public void dispose(Slab slab,
                    ByteBuffer buffer)


Copyright © 2009 SUN Microsystems. All Rights Reserved.