Top Description Inners Fields Constructors Methods
org.hibernate.id.enhanced

public Class PooledLoThreadLocalOptimizer

extends AbstractOptimizer
Class Inheritance
Imports
java.io.Serializable, java.util.HashMap, .Map, org.hibernate.HibernateException, org.hibernate.id.IntegralDataTypeHolder, org.hibernate.internal.CoreMessageLogger, org.jboss.logging.Logger

Variation of PooledOptimizer which interprets the incoming database value as the lo value, rather than the hi value, as well as using thread local to cache the generation state.
Authors
Stuart Douglas, Scott Marlow, Steve Ebersole
See Also
PooledOptimizer

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final CoreMessageLogger
private final ThreadLocal<Map<String, PooledLoThreadLocalOptimizer.GenerationState>>
private final ThreadLocal<PooledLoThreadLocalOptimizer.GenerationState>
Inherited from org.hibernate.id.enhanced.AbstractOptimizer:
incrementSizereturnClass

Constructor Summary

AccessConstructor and Description
public
PooledLoThreadLocalOptimizer(Class<T>
The Java type of the values to be generated
returnClass
,
int
The increment size.
incrementSize
)

Constructs a PooledLoThreadLocalOptimizer.

Method Summary

Modifier and TypeMethod and Description
public boolean
applyIncrementSizeToSourceValues()

Implements org.hibernate.id.enhanced.Optimizer.applyIncrementSizeToSourceValues.

Are increments to be applied to the values stored in the underlying value source?
public Serializable
generate(AccessCallback
Callback to access the underlying value source.
callback
)

Implements org.hibernate.id.enhanced.Optimizer.generate.

Generate an identifier value accounting for this specific optimization.
public IntegralDataTypeHolder
getLastSourceValue()

Implements org.hibernate.id.enhanced.Optimizer.getLastSourceValue.

A common means to access the last value obtained from the underlying source.
private PooledLoThreadLocalOptimizer.GenerationState
locateGenerationState(String tenantIdentifier)

private PooledLoThreadLocalOptimizer.GenerationState
Inherited from org.hibernate.id.enhanced.AbstractOptimizer:
getIncrementSizegetReturnClass

Field Detail

LOGback to summary
private static final CoreMessageLogger LOG
multiTenantStatesback to summary
private final ThreadLocal<Map<String, PooledLoThreadLocalOptimizer.GenerationState>> multiTenantStates
singleTenantStateback to summary
private final ThreadLocal<PooledLoThreadLocalOptimizer.GenerationState> singleTenantState

Constructor Detail

PooledLoThreadLocalOptimizerback to summary
public PooledLoThreadLocalOptimizer(Class<T> returnClass, int incrementSize)

Constructs a PooledLoThreadLocalOptimizer.

Parameters
returnClass:Class<T>

The Java type of the values to be generated

incrementSize:int

The increment size.

Method Detail

applyIncrementSizeToSourceValuesback to summary
public boolean applyIncrementSizeToSourceValues()

Implements org.hibernate.id.enhanced.Optimizer.applyIncrementSizeToSourceValues.

Doc from org.hibernate.id.enhanced.Optimizer.applyIncrementSizeToSourceValues.

Are increments to be applied to the values stored in the underlying value source?

Returns:boolean

True if the values in the source are to be incremented according to the defined increment size; false otherwise, in which case the increment is totally an in memory construct.

Annotations
@Override
generateback to summary
public Serializable generate(AccessCallback callback)

Implements org.hibernate.id.enhanced.Optimizer.generate.

Doc from org.hibernate.id.enhanced.Optimizer.generate.

Generate an identifier value accounting for this specific optimization. All known implementors are synchronized. Consider carefully if a new implementation could drop this requirement.

Parameters
callback:AccessCallback

Callback to access the underlying value source.

Returns:Serializable

The generated identifier value.

Annotations
@Override
getLastSourceValueback to summary
public IntegralDataTypeHolder getLastSourceValue()

Implements org.hibernate.id.enhanced.Optimizer.getLastSourceValue.

Doc from org.hibernate.id.enhanced.Optimizer.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.

Returns:IntegralDataTypeHolder

The last value we obtained from the underlying source; null indicates we have not yet consulted with the source.

Annotations
@Override
locateGenerationStateback to summary
private PooledLoThreadLocalOptimizer.GenerationState locateGenerationState(String tenantIdentifier)
noTenantGenerationStateback to summary
private PooledLoThreadLocalOptimizer.GenerationState noTenantGenerationState()
org.hibernate.id.enhanced back to summary

private Class PooledLoThreadLocalOptimizer.GenerationState

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.id.enhanced.PooledLoThreadLocalOptimizer.GenerationState

Field Summary

Modifier and TypeField and Description
private IntegralDataTypeHolder
private IntegralDataTypeHolder
private IntegralDataTypeHolder

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private Serializable
generate(AccessCallback callback, int incrementSize)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastSourceValueback to summary
private IntegralDataTypeHolder lastSourceValue
upperLimitValueback to summary
private IntegralDataTypeHolder upperLimitValue
valueback to summary
private IntegralDataTypeHolder value

Constructor Detail

GenerationStateback to summary
private GenerationState()

Method Detail

generateback to summary
private Serializable generate(AccessCallback callback, int incrementSize)