Optimizer instances.
| Modifier and Type | Class and Description |
|---|---|
| public static class | OptimizerFactory.HiLoOptimizer
Optimizer which applies a 'hilo' algorithm in memory to achieve optimization. |
| public static interface | OptimizerFactory.InitialValueAwareOptimizer
Marker interface for optimizer which wish to know the user-specified initial value. |
| public static class | |
| public static class | OptimizerFactory.NoopOptimizer
An optimizer that performs no optimization. |
| public abstract static class | OptimizerFactory.OptimizerSupport
Common support for optimizer implementations. |
| public static class | |
| public static class | OptimizerFactory.PooledOptimizer
Optimizer which uses a pool of values, storing the next low value of the range in the database. |
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| private static Class | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static Optimizer | |
| public static Optimizer | Returns: The built optimizerThe optimizer type, either a short-hand name or the type, Class<T> Optimizer class name.The generated value java type returnClass, int The increment size. incrementSize)
Deprecated
Use
Builds an optimizer
buildOptimizer(String, Class, int, long) instead
|
| public static Optimizer | Returns: The built optimizerThe optimizer type, either a short-hand name or the type, Class<T> Optimizer class name.The generated value java type returnClass, int The increment size. incrementSize, long The user supplied initial-value (-1 indicates the user did not specify). explicitInitialValue)Builds an optimizer |
| public static boolean |
| CTOR_SIG | back to summary |
|---|---|
| private static Class<T>[] CTOR_SIG | |
| log | back to summary |
|---|---|
| private static final Logger log | |
| OptimizerFactory | back to summary |
|---|---|
| public OptimizerFactory() | |
| buildFallbackOptimizer | back to summary |
|---|---|
| private static Optimizer buildFallbackOptimizer(Class<T> returnClass, int incrementSize) | |
| buildOptimizer | back to summary |
|---|---|
| public static Optimizer buildOptimizer(String type, Class<T> returnClass, int incrementSize)
Deprecated Use Builds an optimizer
| |
| buildOptimizer | back to summary |
|---|---|
| public static Optimizer buildOptimizer(String type, Class<T> returnClass, int incrementSize, long explicitInitialValue) Builds an optimizer
| |
| isPooledOptimizer | back to summary |
|---|---|
| public static boolean isPooledOptimizer(String type) | |
A 'hilo' algorithm is simply a means for a single value stored in the database to represent a "bucket" of possible, contiguous values. The database value identifies which particular bucket we are on.
This database value must be paired with another value that defines the
size of the bucket; the number of possible values available.
The incrementSize serves this purpose. The
naming here is meant more for consistency in that this value serves the
same purpose as the increment supplied to the PooledOptimizer.
The general algorithms used to determine the bucket are:
upperLimit = (databaseValue * incrementSize) + 1lowerLimit = upperLimit - 1upperLimit = (1 * 20) + 1 = 21lowerLimit = 21 - 20 = 1upperLimit = (2 * 20) + 1 = 41lowerLimit = 41 - 20 = 21Note, 'value' always (after init) holds the next value to return
| Modifier and Type | Field and Description |
|---|---|
| private IntegralDataTypeHolder | |
| private IntegralDataTypeHolder | |
| private IntegralDataTypeHolder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | applyIncrementSizeToSourceValues()
Implements org. |
| public synchronized Serializable | generate(AccessCallback
Callback to access the underlying value source. callback)Implements org. |
| public IntegralDataTypeHolder | |
| public IntegralDataTypeHolder | getLastSourceValue()
Implements org. |
| public IntegralDataTypeHolder |
| lastSourceValue | back to summary |
|---|---|
| private IntegralDataTypeHolder lastSourceValue | |
| upperLimit | back to summary |
|---|---|
| private IntegralDataTypeHolder upperLimit | |
| value | back to summary |
|---|---|
| private IntegralDataTypeHolder value | |
| HiLoOptimizer | back to summary |
|---|---|
| public HiLoOptimizer(Class<T> returnClass, int incrementSize) | |
| applyIncrementSizeToSourceValues | back to summary |
|---|---|
| public boolean applyIncrementSizeToSourceValues() Implements org. Doc from org. Are increments to be applied to the values stored in the underlying value source?
| |
| generate | back to summary |
|---|---|
| public synchronized Serializable generate(AccessCallback callback) Implements org. Doc from org. Generate an identifier value accounting for this specific optimization.
| |
| getHiValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getHiValue() Getter for property 'upperLimit'. Exposure intended for testing purposes.
| |
| getLastSourceValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastSourceValue() Implements org. Doc from org. 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.
| |
| getLastValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastValue() Getter for property 'lastValue'. Exposure intended for testing purposes.
| |
Used instead of constructor injection since that is already a public understanding and because not all optimizers care.
| Modifier and Type | Method and Description |
|---|---|
| public void | injectInitialValue(long
The initial value specified by the user, or -1 to indicate that the
user did not specify. initialValue)Reports the user specified initial value to the optimizer. |
| injectInitialValue | back to summary |
|---|---|
| public void injectInitialValue(long initialValue) Reports the user specified initial value to the optimizer. -1 is used to indicate that the user did not specify.
| |
| Modifier and Type | Field and Description |
|---|---|
| private IntegralDataTypeHolder | |
| private IntegralDataTypeHolder | |
| private long | |
| private long | |
| private IntegralDataTypeHolder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | applyIncrementSizeToSourceValues()
Implements org. |
| public synchronized Serializable | generate(AccessCallback
Callback to access the underlying value source. callback)Implements org. |
| public IntegralDataTypeHolder | getLastSourceValue()
Implements org. |
| public IntegralDataTypeHolder |
| hi | back to summary |
|---|---|
| private IntegralDataTypeHolder hi | |
| lastSourceValue | back to summary |
|---|---|
| private IntegralDataTypeHolder lastSourceValue | |
| lo | back to summary |
|---|---|
| private long lo | |
| maxLo | back to summary |
|---|---|
| private long maxLo | |
| value | back to summary |
|---|---|
| private IntegralDataTypeHolder value | |
| LegacyHiLoAlgorithmOptimizer | back to summary |
|---|---|
| public LegacyHiLoAlgorithmOptimizer(Class<T> returnClass, int incrementSize) | |
| applyIncrementSizeToSourceValues | back to summary |
|---|---|
| public boolean applyIncrementSizeToSourceValues() Implements org. Doc from org. Are increments to be applied to the values stored in the underlying value source?
| |
| generate | back to summary |
|---|---|
| public synchronized Serializable generate(AccessCallback callback) Implements org. Doc from org. Generate an identifier value accounting for this specific optimization.
| |
| getLastSourceValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastSourceValue() Implements org. Doc from org. 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.
| |
| getLastValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastValue() Getter for property 'lastValue'. Exposure intended for testing purposes.
| |
| Modifier and Type | Field and Description |
|---|---|
| private IntegralDataTypeHolder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | applyIncrementSizeToSourceValues()
Implements org. |
| public Serializable | generate(AccessCallback
Callback to access the underlying value source. callback)Implements org. |
| public IntegralDataTypeHolder | getLastSourceValue()
Implements org. |
| lastSourceValue | back to summary |
|---|---|
| private IntegralDataTypeHolder lastSourceValue | |
| NoopOptimizer | back to summary |
|---|---|
| public NoopOptimizer(Class<T> returnClass, int incrementSize) | |
| applyIncrementSizeToSourceValues | back to summary |
|---|---|
| public boolean applyIncrementSizeToSourceValues() Implements org. Doc from org. Are increments to be applied to the values stored in the underlying value source?
| |
| generate | back to summary |
|---|---|
| public Serializable generate(AccessCallback callback) Implements org. Doc from org. Generate an identifier value accounting for this specific optimization.
| |
| getLastSourceValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastSourceValue() Implements org. Doc from org. 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.
| |
| Modifier and Type | Field and Description |
|---|---|
| protected final int | |
| protected final Class |
| Access | Constructor and Description |
|---|---|
| protected | OptimizerSupport(Class<T>
The expected id class. returnClass, int The increment size incrementSize)Construct an optimizer |
| Modifier and Type | Method and Description |
|---|---|
| public final int | getIncrementSize()
Implements org. |
| public final Class |
| incrementSize | back to summary |
|---|---|
| protected final int incrementSize | |
| returnClass | back to summary |
|---|---|
| protected final Class<T> returnClass | |
| OptimizerSupport | back to summary |
|---|---|
| protected OptimizerSupport(Class<T> returnClass, int incrementSize) Construct an optimizer
| |
| getIncrementSize | back to summary |
|---|---|
| public final int getIncrementSize() Implements org. Doc from org. Retrieves the defined increment size.
| |
| getReturnClass | back to summary |
|---|---|
| public final Class Getter for property 'returnClass'. This is the Java
class which is used to represent the id (e.g.
| |
| Modifier and Type | Field and Description |
|---|---|
| private IntegralDataTypeHolder | |
| private IntegralDataTypeHolder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | applyIncrementSizeToSourceValues()
Implements org. |
| public Serializable | generate(AccessCallback
Callback to access the underlying value source. callback)Implements org. |
| public IntegralDataTypeHolder | getLastSourceValue()
Implements org. |
| lastSourceValue | back to summary |
|---|---|
| private IntegralDataTypeHolder lastSourceValue | |
| value | back to summary |
|---|---|
| private IntegralDataTypeHolder value | |
| PooledLoOptimizer | back to summary |
|---|---|
| public PooledLoOptimizer(Class<T> returnClass, int incrementSize) | |
| applyIncrementSizeToSourceValues | back to summary |
|---|---|
| public boolean applyIncrementSizeToSourceValues() Implements org. Doc from org. Are increments to be applied to the values stored in the underlying value source?
| |
| generate | back to summary |
|---|---|
| public Serializable generate(AccessCallback callback) Implements org. Doc from org. Generate an identifier value accounting for this specific optimization.
| |
| getLastSourceValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastSourceValue() Implements org. Doc from org. 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.
| |
Note that this optimizer works essentially the same as the
HiLoOptimizer except that here the bucket ranges are actually
encoded into the database structures.
Note if you prefer that the database value be interpreted as the bottom end of our current range,
then use the PooledLoOptimizer strategy
| Modifier and Type | Field and Description |
|---|---|
| private IntegralDataTypeHolder | |
| private long | |
| private IntegralDataTypeHolder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | applyIncrementSizeToSourceValues()
Implements org. |
| public synchronized Serializable | generate(AccessCallback
Callback to access the underlying value source. callback)Implements org. |
| public IntegralDataTypeHolder | getLastSourceValue()
Implements org. |
| public IntegralDataTypeHolder | |
| public void | injectInitialValue(long
The initial value specified by the user, or -1 to indicate that the
user did not specify. initialValue)Implements org. |
| hiValue | back to summary |
|---|---|
| private IntegralDataTypeHolder hiValue | |
| initialValue | back to summary |
|---|---|
| private long initialValue | |
| value | back to summary |
|---|---|
| private IntegralDataTypeHolder value | |
| PooledOptimizer | back to summary |
|---|---|
| public PooledOptimizer(Class<T> returnClass, int incrementSize) | |
| applyIncrementSizeToSourceValues | back to summary |
|---|---|
| public boolean applyIncrementSizeToSourceValues() Implements org. Doc from org. Are increments to be applied to the values stored in the underlying value source?
| |
| generate | back to summary |
|---|---|
| public synchronized Serializable generate(AccessCallback callback) Implements org. Doc from org. Generate an identifier value accounting for this specific optimization.
| |
| getLastSourceValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastSourceValue() Implements org. Doc from org. 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.
| |
| getLastValue | back to summary |
|---|---|
| public IntegralDataTypeHolder getLastValue() Getter for property 'lastValue'. Exposure intended for testing purposes.
| |
| injectInitialValue | back to summary |
|---|---|
| public void injectInitialValue(long initialValue) Implements org. Doc from org. Reports the user specified initial value to the optimizer. -1 is used to indicate that the user did not specify.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| public static final OptimizerFactory. | |
| private final boolean | |
| public static final OptimizerFactory. | |
| public static final OptimizerFactory. | |
| private final Class | |
| public static final OptimizerFactory. | |
| public static final OptimizerFactory. |
| Access | Constructor and Description |
|---|---|
| private | |
| private | StandardOptimizerDescriptor(String externalName, Class<? extends Optimizer> optimizerClass, boolean pooled)
|
| Modifier and Type | Method and Description |
|---|---|
| public static OptimizerFactory. | |
| public String | |
| public Class | |
| public boolean | |
| public static OptimizerFactory. | |
| public static OptimizerFactory. |
| externalName | back to summary |
|---|---|
| private final String externalName | |
| HILO | back to summary |
|---|---|
| public static final OptimizerFactory. | |
| isPooled | back to summary |
|---|---|
| private final boolean isPooled | |
| LEGACY_HILO | back to summary |
|---|---|
| public static final OptimizerFactory. | |
| NONE | back to summary |
|---|---|
| public static final OptimizerFactory. | |
| optimizerClass | back to summary |
|---|---|
| private final Class<? extends Optimizer> optimizerClass | |
| POOLED | back to summary |
|---|---|
| public static final OptimizerFactory. | |
| POOLED_LO | back to summary |
|---|---|
| public static final OptimizerFactory. | |
| StandardOptimizerDescriptor | back to summary |
|---|---|
| private StandardOptimizerDescriptor(String externalName, Class<? extends Optimizer> optimizerClass) | |
| StandardOptimizerDescriptor | back to summary |
|---|---|
| private StandardOptimizerDescriptor(String externalName, Class<? extends Optimizer> optimizerClass, boolean pooled) | |
| fromExternalName | back to summary |
|---|---|
| public static OptimizerFactory. | |
| getExternalName | back to summary |
|---|---|
| public String getExternalName() | |
| getOptimizerClass | back to summary |
|---|---|
| public Class | |
| isPooled | back to summary |
|---|---|
| public boolean isPooled() | |
| valueOf | back to summary |
|---|---|
| public static OptimizerFactory. | |
| values | back to summary |
|---|---|
| public static OptimizerFactory. | |