Nux 1.6

nux.xom.pool
Class PoolConfig

java.lang.Object
  extended by nux.xom.pool.PoolConfig

public class PoolConfig
extends Object

Set of tunable configuration parameters for DocumentMap and cousins.

Setters return this for convenient method chaining.

Author:
whoschek.AT.lbl.DOT.gov, $Author: hoschek3 $

Constructor Summary
  PoolConfig()
          Constructs an instance with default parameters.
protected PoolConfig(PoolConfig src)
          Constructs a deep copy of the given source configuration.
 
Method Summary
 PoolConfig copy()
          Returns a deep copy of this configuration.
 long getCapacity()
          Returns the maximum amount of memory [bytes] the sum of all contained pool values may occupy.
 int getCompressionLevel()
          Returns the pool compression level.
 boolean getFileMonitoring()
          Returns the file change invalidation policy.
 int getMaxEntries()
          Returns the maximum number of entries this pool can hold before starting to evict old entries.
 long getMaxIdleTime()
          Returns the (approximate) maximum time [ms] a pool entry is retained since its last access on get().
 long getMaxLifeTime()
          Returns the (approximate) maximum time [ms] a pool entry is retained since its creation/insertion on put().
 PoolConfig setCapacity(long capacity)
          Sets the maximum amount of memory [bytes] the sum of all contained pool values may occupy.
 PoolConfig setCompressionLevel(int compressionLevel)
          Sets the pool compression level (defaults to 0).
 PoolConfig setFileMonitoring(boolean fileMonitoring)
          Sets whether or not a pool should periodically monitor and automatically remove an entry if it's key is a File and that file has been modified or deleted since the entry has been inserted into the pool.
 PoolConfig setMaxEntries(int maxEntries)
          Sets the maximum number of entries this pool can hold before starting to evict old entries.
 PoolConfig setMaxIdleTime(long maxIdleTime)
          Sets the (approximate) maximum time [ms] a pool entry is retained since its last access on get().
 PoolConfig setMaxLifeTime(long maxLifeTime)
          Sets the (approximate) maximum time [ms] a pool entry is retained since its creation/insertion on put().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolConfig

public PoolConfig()
Constructs an instance with default parameters.


PoolConfig

protected PoolConfig(PoolConfig src)
Constructs a deep copy of the given source configuration. Helps to implement polymorphic copy().

Parameters:
src - the source configuration to copy
Method Detail

copy

public PoolConfig copy()
Returns a deep copy of this configuration.

Returns:
a deep copy

getCompressionLevel

public int getCompressionLevel()
Returns the pool compression level.

Returns:
the pool compression level

setCompressionLevel

public PoolConfig setCompressionLevel(int compressionLevel)
Sets the pool compression level (defaults to 0).

Parameters:
compressionLevel - a number in the range -1..9
Returns:
this

getMaxEntries

public int getMaxEntries()
Returns the maximum number of entries this pool can hold before starting to evict old entries.

Returns:
the maximum number of entries

setMaxEntries

public PoolConfig setMaxEntries(int maxEntries)
Sets the maximum number of entries this pool can hold before starting to evict old entries. A value of zero effectively disables pooling. A value of Integer.MAX_VALUE effectively disables this constraint. The default is 10000.

Parameters:
maxEntries - the new maxEntries
Returns:
this

getCapacity

public long getCapacity()
Returns the maximum amount of memory [bytes] the sum of all contained pool values may occupy.

Returns:
the maximum amount of memory

setCapacity

public PoolConfig setCapacity(long capacity)
Sets the maximum amount of memory [bytes] the sum of all contained pool values may occupy. A value of Long.MAX_VALUE effectively disables this constraint. The default is Runtime.maxMemory() / 2.

Parameters:
capacity - the new capacity
Returns:
this
See Also:
Runtime.maxMemory()

getMaxIdleTime

public long getMaxIdleTime()
Returns the (approximate) maximum time [ms] a pool entry is retained since its last access on get().

Returns:
the maximum time

setMaxIdleTime

public PoolConfig setMaxIdleTime(long maxIdleTime)
Sets the (approximate) maximum time [ms] a pool entry is retained since its last access on get(). A value of Long.MAX_VALUE effectively disables this constraint. The default is 5L * 60 * 1000, i.e. 5 minutes.

Parameters:
maxIdleTime - the new maxIdleTime
Returns:
this

getMaxLifeTime

public long getMaxLifeTime()
Returns the (approximate) maximum time [ms] a pool entry is retained since its creation/insertion on put().

Returns:
the maximum time

setMaxLifeTime

public PoolConfig setMaxLifeTime(long maxLifeTime)
Sets the (approximate) maximum time [ms] a pool entry is retained since its creation/insertion on put(). A value of Long.MAX_VALUE effectively disables this constraint (this is the default).

Parameters:
maxLifeTime - the new maxLifeTime
Returns:
this

setFileMonitoring

public PoolConfig setFileMonitoring(boolean fileMonitoring)
Sets whether or not a pool should periodically monitor and automatically remove an entry if it's key is a File and that file has been modified or deleted since the entry has been inserted into the pool. The default is false.

Parameters:
fileMonitoring - true to enable auto-removal of changed files, false otherwise
Returns:
this

getFileMonitoring

public boolean getFileMonitoring()
Returns the file change invalidation policy.

Returns:
the file change invalidation policy

Nux 1.6