HHH-8878 Avoid hot allocation in PooledLoOptimizer
Conflicts: hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java
This commit is contained in:
parent
a34d740eba
commit
2798e9d8e3
|
@ -51,6 +51,8 @@ public class PooledLoOptimizer extends AbstractOptimizer {
|
|||
private IntegralDataTypeHolder lastSourceValue;
|
||||
// the current generator value
|
||||
private IntegralDataTypeHolder value;
|
||||
// the value at which we'll hit the db again
|
||||
private IntegralDataTypeHolder upperLimitValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,8 +74,9 @@ public class PooledLoOptimizer extends AbstractOptimizer {
|
|||
final GenerationState generationState = locateGenerationState( callback.getTenantIdentifier() );
|
||||
|
||||
if ( generationState.lastSourceValue == null
|
||||
|| ! generationState.value.lt( generationState.lastSourceValue.copy().add( incrementSize ) ) ) {
|
||||
|| ! generationState.value.lt( generationState.upperLimitValue ) ) {
|
||||
generationState.lastSourceValue = callback.getNextValue();
|
||||
generationState.upperLimitValue = generationState.lastSourceValue.copy().add( incrementSize );
|
||||
generationState.value = generationState.lastSourceValue.copy();
|
||||
// handle cases where initial-value is less that one (hsqldb for instance).
|
||||
while ( generationState.value.lt( 1 ) ) {
|
||||
|
|
Loading…
Reference in New Issue