fm.liveswitch.DataBufferPool Class Reference

A data buffer pool. More...

Public Member Functions

 DataBufferPool ()
 Initializes a new instance of the fm.liveswitch.DataBufferPool class. More...
 
 DataBufferPool (String tag)
 Initializes a new instance of the fm.liveswitch.DataBufferPool class. More...
 
int getBlockSize ()
 Gets the block size. More...
 
boolean getDisabled ()
 Gets whether the pool is disabled. More...
 
boolean getEnableStatistics ()
 Gets whether to enable statistics. More...
 
long getPooledBytesAvailable ()
 Gets the total bytes available in the pool. More...
 
fm.liveswitch.PoolStatistics getStatistics ()
 Gets the pool usage statistics. More...
 
fm.liveswitch.PoolStatistics[] getTraceStatistics ()
 Gets all tagged pool usage statistics. More...
 
fm.liveswitch.PoolStatistics getTraceStatistics (String tag)
 Gets pool usage statistics for a specific tag. More...
 
fm.liveswitch.PoolStatistics getTraceStatistics (@SuppressWarnings("rawtypes") Class type)
 Gets pool usage statistics for a specific tag. More...
 
void releasePools ()
 Release the pools. More...
 
void setDisabled (boolean value)
 Sets whether the pool is disabled. More...
 
void setEnableStatistics (boolean value)
 Sets whether to enable statistics. More...
 
fm.liveswitch.DataBuffer take (int size)
 Takes a buffer from the pool. More...
 
fm.liveswitch.DataBuffer take (int size, boolean littleEndian)
 Takes a buffer from the pool. More...
 
fm.liveswitch.DataBuffer take (int size, boolean littleEndian, boolean clearBytes)
 Takes a buffer from the pool. More...
 

Static Public Member Functions

static fm.liveswitch.DataBufferPool getInstance ()
 Gets the singleton instance. More...
 
static boolean getIsSupported ()
 Gets a value indicating whether DataBuffer pooling is supported on this platform. More...
 
static fm.liveswitch.DataBufferPoolTracer getTracer (String tag)
 Get a data buffer pool tracer for a specific tag using the default pool. More...
 
static fm.liveswitch.DataBufferPoolTracer getTracer (String tag, fm.liveswitch.DataBufferPool pool)
 Get a data buffer pool tracer for a specific tag and pool. More...
 
static fm.liveswitch.DataBufferPoolTracer getTracer (@SuppressWarnings("rawtypes") Class type)
 Get a data buffer pool tracer for a specific tag using the default pool. More...
 
static fm.liveswitch.DataBufferPoolTracer getTracer (@SuppressWarnings("rawtypes") Class type, fm.liveswitch.DataBufferPool pool)
 Get a data buffer pool tracer for a specific tag and pool. More...
 

Detailed Description

A data buffer pool.

Constructor & Destructor Documentation

◆ DataBufferPool() [1/2]

fm.liveswitch.DataBufferPool.DataBufferPool ( )

Initializes a new instance of the fm.liveswitch.DataBufferPool class.

◆ DataBufferPool() [2/2]

fm.liveswitch.DataBufferPool.DataBufferPool ( String  tag)

Initializes a new instance of the fm.liveswitch.DataBufferPool class.

Parameters
tagThe tag for stats output.

Member Function Documentation

◆ getBlockSize()

int fm.liveswitch.DataBufferPool.getBlockSize ( )

Gets the block size.

◆ getDisabled()

boolean fm.liveswitch.DataBufferPool.getDisabled ( )

Gets whether the pool is disabled.

If disabled, each call to take a buffer will result in a new allocation.

◆ getEnableStatistics()

boolean fm.liveswitch.DataBufferPool.getEnableStatistics ( )

Gets whether to enable statistics.

◆ getInstance()

static fm.liveswitch.DataBufferPool fm.liveswitch.DataBufferPool.getInstance ( )
static

Gets the singleton instance.

◆ getIsSupported()

static boolean fm.liveswitch.DataBufferPool.getIsSupported ( )
static

Gets a value indicating whether DataBuffer pooling is supported on this platform.

◆ getPooledBytesAvailable()

long fm.liveswitch.DataBufferPool.getPooledBytesAvailable ( )

Gets the total bytes available in the pool.

Implements fm.liveswitch.IDataBufferPool.

◆ getStatistics()

fm.liveswitch.PoolStatistics fm.liveswitch.DataBufferPool.getStatistics ( )

Gets the pool usage statistics.

◆ getTracer() [1/4]

static fm.liveswitch.DataBufferPoolTracer fm.liveswitch.DataBufferPool.getTracer ( @SuppressWarnings("rawtypes") Class  type)
static

Get a data buffer pool tracer for a specific tag using the default pool.

The tag is taken from the class namespace and name.

Parameters
typeThe type to use as the tag.
Returns
A tracer that will associate stats with the tag.

◆ getTracer() [2/4]

static fm.liveswitch.DataBufferPoolTracer fm.liveswitch.DataBufferPool.getTracer ( @SuppressWarnings("rawtypes") Class  type,
fm.liveswitch.DataBufferPool  pool 
)
static

Get a data buffer pool tracer for a specific tag and pool.

The tag is taken from the class namespace and name.

Parameters
typeThe type to use as the tag.
poolThe underlying pool.
Returns
A tracer that will associate stats with the tag.

◆ getTracer() [3/4]

static fm.liveswitch.DataBufferPoolTracer fm.liveswitch.DataBufferPool.getTracer ( String  tag)
static

Get a data buffer pool tracer for a specific tag using the default pool.

Parameters
tagThe tag to log to.
Returns
A tracer that will associate stats with the type.

◆ getTracer() [4/4]

static fm.liveswitch.DataBufferPoolTracer fm.liveswitch.DataBufferPool.getTracer ( String  tag,
fm.liveswitch.DataBufferPool  pool 
)
static

Get a data buffer pool tracer for a specific tag and pool.

Parameters
tagThe tag to log to.
poolThe underlying pool.
Returns
A tracer that will associate stats with the type.

◆ getTraceStatistics() [1/3]

fm.liveswitch.PoolStatistics [] fm.liveswitch.DataBufferPool.getTraceStatistics ( )

Gets all tagged pool usage statistics.

◆ getTraceStatistics() [2/3]

fm.liveswitch.PoolStatistics fm.liveswitch.DataBufferPool.getTraceStatistics ( @SuppressWarnings("rawtypes") Class  type)

Gets pool usage statistics for a specific tag.

Parameters
typeThe type to use as the tag.

◆ getTraceStatistics() [3/3]

fm.liveswitch.PoolStatistics fm.liveswitch.DataBufferPool.getTraceStatistics ( String  tag)

Gets pool usage statistics for a specific tag.

Parameters
tagThe tag.

◆ releasePools()

void fm.liveswitch.DataBufferPool.releasePools ( )

Release the pools.

Implements fm.liveswitch.IDataBufferPool.

◆ setDisabled()

void fm.liveswitch.DataBufferPool.setDisabled ( boolean  value)

Sets whether the pool is disabled.

If disabled, each call to take a buffer will result in a new allocation.

◆ setEnableStatistics()

void fm.liveswitch.DataBufferPool.setEnableStatistics ( boolean  value)

Sets whether to enable statistics.

◆ take() [1/3]

fm.liveswitch.DataBuffer fm.liveswitch.DataBufferPool.take ( int  size)

Takes a buffer from the pool.

Parameters
sizeThe number of bytes needed.

Implements fm.liveswitch.IDataBufferPool.

◆ take() [2/3]

fm.liveswitch.DataBuffer fm.liveswitch.DataBufferPool.take ( int  size,
boolean  littleEndian 
)

Takes a buffer from the pool.

Parameters
sizeThe number of bytes needed.
littleEndianWhether the data buffer should be little-endian.

Implements fm.liveswitch.IDataBufferPool.

◆ take() [3/3]

fm.liveswitch.DataBuffer fm.liveswitch.DataBufferPool.take ( int  size,
boolean  littleEndian,
boolean  clearBytes 
)

Takes a buffer from the pool.

Parameters
sizeThe number of bytes needed.
littleEndianWhether the data buffer should be little-endian.
clearBytesWhether to clear the data buffer.

Implements fm.liveswitch.IDataBufferPool.