HHH-3001 - The NoopOptimizer is not thread safe

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19994 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2010-07-21 17:31:09 +00:00
parent 48a5e04caa
commit 7f815de1a7
1 changed files with 7 additions and 8 deletions

View File

@ -187,15 +187,14 @@ public class OptimizerFactory {
* {@inheritDoc}
*/
public Serializable generate(AccessCallback callback) {
if ( lastSourceValue == null ) {
do {
lastSourceValue = callback.getNextValue();
} while ( lastSourceValue.lt( 1 ) );
// IMPL NOTE : it is incredibly important that the method-local variable be used here to
// avoid concurrency issues.
IntegralDataTypeHolder value = null;
while ( value == null || value.lt( 1 ) ) {
value = callback.getNextValue();
}
else {
lastSourceValue = callback.getNextValue();
}
return lastSourceValue.makeValue();
lastSourceValue = value;
return value.makeValue();
}
/**