public interface Optimizer
Performs optimization on an optimizable identifier generator. Typically this optimization takes the form of trying to ensure we do not have to hit the database on each and every request to get an identifier value. <p/> Optimizers work on constructor injection. They should provide a constructor with the following arguments <ol> <li>java.lang.Class - The return type for the generated values</li> <li>int - The increment size</li> </ol>
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.
|
int |
getIncrementSize()
Retrieves the defined increment size.
|
IntegralDataTypeHolder |
getLastSourceValue()
A common means to access the last value obtained from the underlying
source.
|
Serializable generate(AccessCallback callback)
Generate an identifier value accounting for this specific optimization.
All known implementors are synchronized. Consider carefully if a new implementation could drop this requirement.
callback
- Callback to access the underlying value source.IntegralDataTypeHolder getLastSourceValue()
A 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.
int getIncrementSize()
Retrieves the defined increment size.
boolean applyIncrementSizeToSourceValues()
Are increments to be applied to the values stored in the underlying value source?
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.