In this period of taming Tiger, John Zukowski describes how the latest Java virtual machines improve startup time, reduce memory requirements, and improve performance. Tiger provides shared data files, a new thread scheduling algorithm, and a fatal error processor (for handling failures). Share your thoughts on this article with the author and other readers in the discussion forum that accompanies this article. (You can also click the discussion access discussion forum at the top or bottom of this article.) )
Fatal Error processor
The JVM contains several new command-line options. One of the less standard options is the "fatal error processor." Start the JVM with the-xx:onerror option to specify the command to execute if an error occurs and the JVM fails. Listing 1 shows a few of these options:
Listing 1. Some OnError processing options
-XX:OnError="gcore %p; dbx - %p"
-XX:OnError="gdb %p"
-XX:OnError="pmap %p"
When a fatal error occurs in the JVM, the command in quotation marks is executed. The%p option is replaced with a process ID. It's not easy to deliberately make mistakes, but if you stumble across a situation that does recur, the information you get through the processor is very helpful.
The ONERROR option uses the Java Debugging interface (Java debug INTERFACE,JDI) service Proxy Connector Bridge (serviceability Agent connector Bridges). With this bridge, you can connect core files or virtual machines that have already been installed, as well as other tasks. As shown below, several diagnostics tools are available with the JDK, they take advantage of the bridge, but the last three tools are not available on the Microsoft Windows platform:
jps--Get Process ID
jstat--Gets the statistic value of the process ID (JSTAT-GC pid)
jinfo--get configuration information for the JVM
jmap--the memory map of the print library
Jstack PID | core--Build Stack Trace
Class data sharing
To help improve startup time, the JVM now works with memory-mapped files. These files are created at installation time and hold the internal representation of the system class. This way, when you start the JVM, you don't load the system classes from scratch, but instead load the memory-mapped files. This provides assistance in two areas. First, almost half of the memory-mapped files are read-only, which means that they can be shared among multiple concurrent running processes, reducing the startup time and the total memory required to a considerable extent. Second, since these files are in a format that Java HotSpot virtual machines can use, there will never be a need for memory to handle the original class files, which also improves startup time.
The location of the shared profile depends on the platform. The file is named Classes.jsa, where the JSA extension represents the Java share file (Java shared Archive). On the Microsoft Windows platform, you can find shared files in Jre\bin\client. On the Linux platform, the location is jre/lib/[arch]/client. All of these locations are based on java_home root.