This was a major release of Java back in 2004 and the new features added, were mainly focussed to address the issues in the following categories:
- Ease of Development
- Scalability and Performance
- Manageability and Monitoring
I will briefly describe the above three areas and then move on to discussing the actuall features added in J2SE 5.0.
Ease of development, is a fancy term for programmer productivity : for example type safety-check which involved casting Objects to their correct type before trying to use them in the program, used to be the programmer’s responsibility. Now, Generic types in general takes care of the same, at least to a large extend.
Other features introduced in 5.0 to aid in focussing on application logic instead of the programming language related issues, are metadata or annotations, autoboxing/auto-unboxing, an enhanced for-loop, enumerated types, static import, C++ like formatted input and output, variable arguments (varargs), concurrency utilities from java.util.concurrent package, and a simpler RMI interface generation. We will look into these new features one by one with examples later in this text.
Scalability and Performance
The 5.0 release had an emphasis on startup time and memory footprint, and promised to aid Java application to be able to run at their best speed possible.
The major changes in this direction were, that now the Core JVM Classes come pre-packed, improving the startup time, and the read-only data is shared among multiple running JVMs due to the introduction of class data sharing in HotSpot JVM.
Another new feature in J2SE 5.0 is the Performance ergonomics, as a result o fwhich, an application’s performance can be better even with no or minimal JVM runtime options.
Manageability and Monitoring
Since 5.0, we have out-of-the-box ready to use, Java Management Extensions (JMX) framework (javax.management), and remote access protocols. JMX MBeans can be used to notify registered listeners when a low memory threshold is crossed, thus helping detect a low memory condition.
The java.lang.management API helps monitor and manage the Java virtual machine and the platform it’s running on. Remote management of JVM or a Java application has been made possible with jmxremote.
A new more powerful native profiling API JVMTI is intended to cover the full range of native in-process tools access, like profiling, monitoring, debugging and a plethora of other code analysis tools.
Last but hardly the least, two new APIs,
Thread.getAllStackTraces can now be used to get stack trace information programmatically.
var _gaq = _gaq || ; _gaq.push(['_setAccount', 'UA-19519021-1']); _gaq.push(['_trackPageview']);