public class PooledOptimizer extends AbstractOptimizer implements InitialValueAwareOptimizer
Optimizer which uses a pool of values, storing the next low value of the
range in the database.
<p/>
Note that this optimizer works essentially the same as the
HiLoOptimizer except that here the bucket ranges are actually
encoded into the database structures.
<p/>
Note if you prefer that the database value be interpreted as the bottom end of our current range,
then use the PooledLoOptimizer strategy
PooledLoOptimizerincrementSize, returnClass| Constructor and Description |
|---|
PooledOptimizer(Class returnClass,
int incrementSize)
Constructs a PooledOptimizer
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
applyIncrementSizeToSourceValues()
Are increments to be applied to the values stored in the underlying
value source?
|
Serializable |
generate(AccessCallback callback)
Generate an identifier value accounting for this specific optimization.
|
IntegralDataTypeHolder |
getLastSourceValue()
A common means to access the last value obtained from the underlying
source.
|
IntegralDataTypeHolder |
getLastValue()
Getter for property 'lastValue'.
|
void |
injectInitialValue(long initialValue)
Reports the user specified initial value to the optimizer.
|
getIncrementSize, getReturnClasspublic PooledOptimizer(Class returnClass, int incrementSize)
Constructs a PooledOptimizer
returnClass - The Java type of the values to be generatedincrementSize - The increment size.public Serializable generate(AccessCallback callback)
OptimizerGenerate an identifier value accounting for this specific optimization.
All known implementors are synchronized. Consider carefully if a new implementation could drop this requirement.
public IntegralDataTypeHolder getLastSourceValue()
OptimizerA common means to access the last value obtained from the underlying source. This is intended for testing purposes, since accessing the underlying database source directly is much more difficult.
getLastSourceValue in interface Optimizerpublic boolean applyIncrementSizeToSourceValues()
OptimizerAre increments to be applied to the values stored in the underlying value source?
applyIncrementSizeToSourceValues in interface Optimizerpublic IntegralDataTypeHolder getLastValue()
Getter for property 'lastValue'. <p/> Exposure intended for testing purposes.
public void injectInitialValue(long initialValue)
InitialValueAwareOptimizerReports the user specified initial value to the optimizer. <p/> <tt>-1</tt> is used to indicate that the user did not specify.
injectInitialValue in interface InitialValueAwareOptimizerinitialValue - The initial value specified by the user, or <tt>-1</tt> to indicate that the
user did not specify.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.