RFR for JDK-7027502: Test failures in demo/jvmti/hprof testcases,	need to be othervm
    Paul Sandoz 
    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.
> 
> http://cr.openjdk.java.net/~tyan/JDK-7027502/webrev.03/
> 
> 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.
Paul.
    
    
More information about the core-libs-dev
mailing list