1 15 16 package javassist.runtime; 17 18 25 public class Cflow extends ThreadLocal { 26 private static class Depth { 27 private int depth; 28 Depth() { depth = 0; } 29 int get() { return depth; } 30 void inc() { ++depth; } 31 void dec() { --depth; } 32 } 33 34 protected synchronized Object initialValue() { 35 return new Depth(); 36 } 37 38 41 public void enter() { ((Depth)get()).inc(); } 42 43 46 public void exit() { ((Depth)get()).dec(); } 47 48 51 public int value() { return ((Depth)get()).get(); } 52 } 53 | Popular Tags |