Best Story I System.Out.println ("Total Memory IS:" Java.lang.Runtime.Getruntime (). TotalMemory () / 1024); System.out.Println ("Free Memory IS:" java.lang. Runtime.Getruntime (). FreeMemory () / 1024); One day, a customer is looking for East's soft trouble, saying that our software is not easy to use, and the total crash. WebLogic error prompts seem to be a memory allocation request failed. - Dongping's application system moves from the R & D environment to the use environment, with a point in mind, and the Tomcat on the PC cannot be able to compare with the WebLogic on the server. The supervisory company hits the door, I will accept this case with a Java Tianshi. (Java Tianshi is insight into the technical master of Java myelology, not mastering Java command syntax, skilled programmer usage programmer, not coding, the following is the same.) Development main force came over to build a demo environment, we tested it, There is no equivalent error. The operating system is a different UNIX type, so the database is also different versions. Other places are the same. Tianshi uses java.lang.Runtime.Getruntime (). TotalMemory () and FreeMemory () function gets the actual allocation amount and usage of JVM, sent to the front to measure, discovery although WebLogic Server specifies large memory parameters, When actually run, JVM does not get so much memory. I have found the problem now, it is WebLogic without a patch! At the end of the case, we inform the front line to ask for the latest patch of WebLogic and UNIX OS, now the east is soft. Best Story II System.Out.println ("THE CALLER IS" Sun.Reflect.Reflection.getCallerclass (0)); System.out.Println ("THE CALLER IS" Sun.Reflect.Reflection.getCallerclass (1)) System.out.println ("The Caller IS" Sun.Reflect.Reflection.getCallerClass (2)); // Foot. This is our own story, after the release, everything is as usual, once, suddenly discovered that the database connection pool behavior is abnormal, and no new connections cannot be properly allocated. I used to do pressure testing, and I didn't miss it once? ! In order to find out, we want to know that those programs have visited the public database access bean. There are too many places where the call is called, can only be added in the bean to implement the caller's report, what code is used? We have issued a question in the water mother smth.org, with a valuable answer in half an hour, remind us to use Sun.Reflect.Reflection.getCallerClass (int 1), parameter casual, 0, 1, 2, 3 can. We tried, and it can be reported, 0 is getcallerclass itself, 1 is bean itself, 2 should be a bean call party, 3 unstable. This function seems to report all the call layers accurately.