Friday 15 February 2013

Does JVM know anything about java.util.concurrent package? -


Try below the block, in which order 3 statements should be executed. Is there any possibility that the statement can run out of order? Does the JVM look forward to j.u.c classes to see the smoothness indicator (synchronized, volatile) and it understands that it should not re-execute the execution?

  Private Deck & lt; Integer & gt; Deck = new linked list & lt; Integer & gt; (); Private lock lock = new retract lock (); Private condition condition = lock.newCondition (); Class creator Runnabel {@Override} publicly runs the zero (run) (while {true} {try {lock.lock (); deque.add (1); condition.signalAll ();} Finally {lock.unlock (); JVM will never rearrange the function calls, unless they are completely inlineed. Any party effect can hide behind them, so long as it can prove that it is such a Not, it can not reorder them.   

No comments:

Post a Comment