1 36 37 38 41 42 public class Minst { 43 44 45 46 private static int engaged = 0; 47 48 51 52 public static void method_entry(int cnum, int mnum) { 53 Class x = Minst.class; 54 synchronized ( x ) { 55 if ( engaged > 0 ) { 56 engaged = 0; 57 String className = "Unknown"; 58 String methodName = "Unknown"; 59 Exception exp = new Exception (); 60 StackTraceElement [] stack = exp.getStackTrace(); 61 if (stack.length > 1) { 62 StackTraceElement location = stack[1]; 63 className = location.getClassName(); 64 methodName = location.getMethodName(); 65 } 66 System.out.println("Reached method entry: " + 67 className + "." + methodName + "()"); 68 engaged++; 69 } 70 } 71 } 72 73 } 74 75 | Popular Tags |