RFR for JDK-7027502: Test failures in demo/jvmti/hprof testcases, need to be othervm
paul.sandoz at oracle.com
Thu Jan 9 11:24:01 UTC 2014
On Jan 9, 2014, at 12:07 PM, Tristan Yan <tristan.yan at oracle.com> wrote:
> Thank you Paul
> I change turn to local variable as well.
> I am not sure I understand your second suggestion here, sum up thread_turns of each Context(This is a fixed value) doesn't equal total_turns_taken.
The suggestion (feel free to ignore it!) was to take the local variable:
161 int turns_taken = 0;
and move it to a field on Context.
Then in the synchronized block of the main loop sum 'em up. e.g.:
List<Context> cs = ;
int current_total_turns_taken = cs.stream().mapToInt(c -> c.turns_taken).sum();
Obviously that is less efficient but it does separate concerns.
More information about the core-libs-dev