|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlPool.Params
public static class UtlPool.Params
Specifies pool operating parameters.
This class is used to specify the operating parameters of an object. pool. An instance of this class is provided to a pool during pool creation.
Note: Pool operating parameters must be set before pool creation. Changes to a parameters object after pool creation has no effect on the pool.
Method Summary | |
---|---|
Object |
clone()
Clone the parameters object. |
static UtlPool.Params |
create()
Create a parameters object with default values. |
int |
getInitialCapacity()
Get the initial pool capacity. |
int |
getMaxCapacity()
Get the maximum pool capacity. |
boolean |
isDetachedWash()
Get whether pool items will be washed using the detached washer |
boolean |
isPreallocate()
Tests whether this pool was set to preallocate items up front. |
boolean |
isReadOnly()
Tests whether the pool parameters are read only. |
boolean |
isThreaded()
Get whether a pool is operating in a thread safe manner. |
UtlPool.Params |
load(String propertyPrefix,
Map<String,Object> source,
boolean override)
Loads pool parameters from the given source Map. |
UtlPool.Params |
load(String propertyPrefix,
Properties source,
boolean override)
Loads pool parameters from the given source properties. |
UtlPool.Params |
setDetachedWash(boolean val)
Set whether pool items should be washed using the detached washer |
UtlPool.Params |
setInitialCapacity(int val)
Set the initial pool capacity. |
UtlPool.Params |
setMaxCapacity(int val)
Set the maximum pool capacity. |
UtlPool.Params |
setPreallocate(boolean preallocate)
Sets whether items in the pool should be preallocated up front to avoid object promotions. |
UtlPool.Params |
setThreaded(boolean val)
Set whether a pool will be accessed concurrently using multiple threads. |
String |
toString()
Get a string representation of the parameter object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static UtlPool.Params create()
public final UtlPool.Params load(String propertyPrefix, Properties source, boolean override)
This method allows loading pool parameters generically. For example, to set pool parameters from the environment, one can call:
Params params = Params.create(); params.load("mypooledtype", UtlEnv.getEnv());If the environment has the value "mypooledtype.initCapacity=8192" then the calling
getInitialCapacity()
on the UtlPool.Params
after this call would return
8192.
However, if the value of the override
override parameter is set to false values
from the source will not be applied. For example:
Params params = Params.create(); params.setInitialCapacity(4096); params.load("mypooledtype", UtlEnv.getEnv());Would not result in the value of 8192 being applied from the environment.
propertyPrefix
- The property prefix to use.source
- The source parameters.override
- If false then the value from the source will not override a value that has already be set.
public final boolean isReadOnly()
When a pool is created, the provided parameter are cloned and marked as read only.
public final UtlPool.Params load(String propertyPrefix, Map<String,Object> source, boolean override)
This method is equivalent to Params.lo
propertyPrefix
- The property prefix to use.source
- The source parameters.override
- If false then the value from the source will not override a value that has already be set.
public final UtlPool.Params setThreaded(boolean val)
val
- True signifies multi-threaded access while false signifies
single-threaded access.
public final boolean isThreaded()
public final UtlPool.Params setDetachedWash(boolean val)
val
- True signifies detached wash while false signifies
attached wash.
public final boolean isDetachedWash()
public final UtlPool.Params setInitialCapacity(int val)
The initial pool capacity is the capacity with which the pool is created. The pool is dynamically grown when the number of objects in the pool exceeds the initial capacity. The capacity continues to grow until the maximum capacity is reached at which point objects in the pool are released for garbage collection to keep the size of the pool <= thea maximum pool capacity.
public final int getInitialCapacity()
setInitialCapacity(int)
public final UtlPool.Params setMaxCapacity(int val)
The maximum pool capacity is the maximum size to which a pool can grow beyond which pooled objects are released for garbage collection. Objects are released in a LIFO manner to minimize evicted objects' live age to favor younger generation GCs.
Settting maximum capacity to less than initial capacity, causes the pool to reduce the initial capacity to maximum capacity.
public final int getMaxCapacity()
setMaxCapacity(int)
public UtlPool.Params setPreallocate(boolean preallocate)
setInitialCapacity(int)
will be created and seeded into the pool.
preallocate
- true
to enable object preallocation
public boolean isPreallocate()
When true the pool will create the number of items specified by its initialCapacity when it is created.
public Object clone()
This method creates a clone of the parameters object. The clone will not be
readonly even if these UtlPool.Params
are.
clone
in class Object
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |