RFR for JDK-7027502: Test failures in demo/jvmti/hprof testcases, need to be othervm
david.holmes at oracle.com
Thu Jan 9 11:12:46 UTC 2014
On 9/01/2014 8:28 PM, Paul Sandoz wrote:
> On Jan 9, 2014, at 10:52 AM, Tristan Yan <tristan.yan at oracle.com> wrote:
>> Can someone else give a second review on this.
> In a comment the bug you state:
> "here total_turns_taken is a static variable, it could affect by other tests"
> I don't quite know under what test circumstances that can happen, but if so is the following also an issue:
> 52 private final static TurnChecker turn = new TurnChecker(-1);
> FWIW an alternative to using an AtomicInteger would be for the main loop to sum up thread_turns of each Context, since read/writes are all performed in a synchronized block.
Now that you mention it ... I had mistakenly thought the switch to an
AtomicInteger was to ensure the ++ was actually atomic, but as you note
these updates all take place within a synchronized block that locks the
same "turn" instance of TurnChecker.
So now I'm confused by the change. Tristan what was the basis of making
the change that you did ? If the issue was that concurrent hprof tests
all used the same Context class in the same VM (how??) then as Paul says
the TurnChecker instance would also be a problem. Otherwise the change
makes no real difference to the semantics of the test as far as I can see.
More information about the core-libs-dev