Recently went to interview a company, is to do enterprise-level monitoring, and then casually chat, say this thing is how to achieve, probably mean that, in the JVM when the start, add a parameter, put a jar package on the project can be, the concrete implementation is implemented with Java reflection, when is afraid of being said small white, So no detailed question. When I came back, I thought, if you use reflection, you must have a factory class, proxy class, if I do not spring, the direct new out of things, how to reflect Ah,
For example: The following program
public class Test {
public static void Taketimer () {
try {
Thread.Sleep (2000);
System.out.println ("Taketimer");
} catch (Exception e) {
//Todo:handle exception
}
}
public static void Main (string[] args) {
Taketimer ();
}
}
I do not change anything, how to know how long the Taketimer method executes!
This thing is going to use the JVM, give me some hints.
Java Enterprise-level monitoring