Skip to content
Browse files

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
  • Loading branch information...
1 parent a86997c commit 3e4786220c8b66d3603ce315169a6bc645609fad @marschall marschall committed with stliu Jun 9, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java
View
2 hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java
@@ -514,7 +514,7 @@ public PooledLoOptimizer(Class returnClass, int incrementSize) {
}
@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();

0 comments on commit 3e47862

Please sign in to comment.
Something went wrong with that request. Please try again.