<persistence>
<persistence-unit name="MyPU">
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/somedb" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL96Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
public class ReOrdering implements Runnable { int one, two, three, four, five, six; volatile int volaTile; @Override public void run() { one = 1; two = 2; three = 3; volaTile = 92; int x = four; int y = five; int z = six; } }
The assignments of one, two and three may be reordered, as long as they all happen before the volatile write. Similarly, the x, y, and z statements may be reordered as the volatile write happens before all of them. The volatile operation is often called a memory barrier. The happens before guarantee ensures that read and write instructions of volatile variables cannot be reordered across a memory barrier.
The happens before guarantee has another effect: When a thread writes to a volatile variable, then all other variables - including non-volatiles - changed by the thread before writing to the volatile variable are also flushed to main memory. When a thread reads a volatile variable it also reads all other variables - including non-volatile - that were flushed to main memory together with the volatile variable.
pip <имя файла>