HHH-13496 Formula using unsafe concurrent initialization of its unique identifier

This commit is contained in:
Sanne Grinovero 2019-07-08 21:02:40 +01:00
parent a76c04783e
commit f042f8b553
1 changed files with 5 additions and 3 deletions

View File

@ -7,6 +7,7 @@
package org.hibernate.mapping;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunctionRegistry;
@ -20,13 +21,14 @@ import static org.hibernate.internal.util.StringHelper.safeInterning;
* @author Gavin King
*/
public class Formula implements Selectable, Serializable {
private static int formulaUniqueInteger;
private static final AtomicInteger formulaUniqueInteger = new AtomicInteger();
private String formula;
private int uniqueInteger;
private final int uniqueInteger;
public Formula() {
uniqueInteger = formulaUniqueInteger++;
uniqueInteger = formulaUniqueInteger.incrementAndGet();
}
public Formula(String formula) {