HHH-5929 PooledLoOptimizer is not thread-safe

All Optimizers in OptimizerFactory are thread safe by having the
 #generate(AccessCallback) method synchronized. The only exception is
PooledLoOptimizer who's #generate(AccessCallback) method is not
synchronized.

 - make PooledLoOptimizer#generate(AccessCallback) synchronized

 https://hibernate.onjira.com/browse/HHH-5929
 https://hibernate.onjira.com/browse/HHH-6829
This commit is contained in:
Philippe Marschall 2012-06-09 19:38:30 +02:00 committed by Strong Liu
parent a86997c7ba
commit 3e4786220c
1 changed files with 1 additions and 1 deletions

View File

@ -514,7 +514,7 @@ public class OptimizerFactory {
}
@Override
public Serializable generate(AccessCallback callback) {
public synchronized Serializable generate(AccessCallback callback) {
if ( lastSourceValue == null || ! value.lt( lastSourceValue.copy().add( incrementSize ) ) ) {
lastSourceValue = callback.getNextValue();
value = lastSourceValue.copy();