HHH-13496 Formula using unsafe concurrent initialization of its unique identifier
This commit is contained in:
parent
a76c04783e
commit
f042f8b553
|
@ -7,6 +7,7 @@
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.dialect.function.SQLFunctionRegistry;
|
import org.hibernate.dialect.function.SQLFunctionRegistry;
|
||||||
|
@ -20,13 +21,14 @@ import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class Formula implements Selectable, Serializable {
|
public class Formula implements Selectable, Serializable {
|
||||||
private static int formulaUniqueInteger;
|
|
||||||
|
private static final AtomicInteger formulaUniqueInteger = new AtomicInteger();
|
||||||
|
|
||||||
private String formula;
|
private String formula;
|
||||||
private int uniqueInteger;
|
private final int uniqueInteger;
|
||||||
|
|
||||||
public Formula() {
|
public Formula() {
|
||||||
uniqueInteger = formulaUniqueInteger++;
|
uniqueInteger = formulaUniqueInteger.incrementAndGet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Formula(String formula) {
|
public Formula(String formula) {
|
||||||
|
|
Loading…
Reference in New Issue