Top 10 features of JDK 7
By Partho, Gaea News NetworkThursday, October 1, 2009
We had already focused on JDK 7 features in our post - Java/JDK 7 downloaded. According to the roadmap in OpenJDK site, JDK 7 would be arriving at the first quarter of 2010. Going by the schedule 6 milestone are expected in 2009, with the milestone M3 encompassing JSR 292’s VM Support for non-Java languages, support for SCTP (Stream Control Transmission Protocol) and SDP (Sockets Direct Protocol) on Solaris, as well as an upgrade to Unicode 5.1 and an updated class loader.. JDK 7 would includes several enhanced features with respect to performance, usability and security of Java platform. We can wait till the current draft of the development process is published as a Feature Proposal Template. However, as the draft is available we decided to dig deep into the JDK 7 to sort out the top 10 features for JDK 7.
1. Modularization (Project Jigsaw)
Modularization has been focused on refactoring of the Java SE platform into smaller, separate, interdependent modules. The modules could be downloaded individually as need by the JVM and/or Java applications. Eventually this would reduce the size of runtime on the user’s machine. With modularization the platform will have smaller download, resulting in a improved start-up performance. Further, having a smaller memory footprint would allow significant performance improvements, especially desktop applications.
2. More new I/O APIs for the Java platform (NIO.2): JSR 203
JSR 203 would have a major impact on JDK 7. It offers contains three primary elements that offer new input/output (I/O) APIs for the Java platform:
- An extensive File I/O API system addresses feature requests that developers have sought since the inception of the JDK.
- A socket channel API addresses multicasting, socket binding associated with channels, and related issues.
- An asynchronous I/O API enables mapping to I/O facilities, completion ports, and various I/O event port mechanisms to enhance scalability.
The abbreviation NIO is the new I/O APIs that allow for I/O operations in Java technology. In the NIO.2 the file systems API is contained in a new package - java.nio.file, with two subpackages. There is a java.nio.file.attribute subpackage that supports bulk access to file attributes. The service provider interface SPI subpackage java.nio.file.spi offers an interface for pluggable file system implementations.
3. Compressed 64-bit object pointers
Using VM unleashes the true power of Java. JDK 7 is proposed to have a compressed 64-bit object pointer that would fit into 32 bits. The technique will not only reduce the memory, it will also decrease the memory-bandwidth consumption, resulting in better performance.
4. Garbage First - Collector
The new Garbage collector in short G1 GC is set to be introduced in the Java HotSpot VM in JDK 7. G1 has been designed to eventually replace concurrent-mark-sweep (CMS) collector. It would lower the pause time and enhance the predictability than the current CMS. collector. G1 adopts a new approach to heap layout than other HotSpot GCs.
5. JSR TBD: Small language enhancements (Project Coin)
It is aimed to set of small language changes that have been intended to simplify typical programming tasks. The final Project Coin changes for inclusion in JDK 7 includes
- Strings in switch
- Automatic Resource Management
- Improved Type Inference for Generic Instance Creation (diamond)
- Simplified Varargs Method Invocation
- An omnibus proposal for better integral literals
- Language support for Collections
- Language support for JSR 292
6. Improved static program checking: JSR 308
In Java 6 annotations syntax is limited. Previously the annotations could not be placed on generic type arguments, type casts, etc. JSR 308 extends Java annotation syntax to permit annotations on any occurrences of a type. The Type Annotations syntax will allow the annotations to be written in more places, like generic type arguments: List<@NonNull Object>. It can be used by developers to write more informative types, and then tools such as type-checkers can detect and prevent more errors. The programmer can benefit from the type annotations while working with people who are using other versions of Java, such as Java 6, 5, or even 4.
Moreover, the Checker Framework includes compiler plug-ins, checkers that find bugs or verify their absence. The users can write your own compiler plug-ins. Several users only need this.
7. Multi-language support
JSR 292 (InvokeDynamic) defines better compatibility between Java and other dynamic languages such as Ruby and Python addressed for JDK 7. This could provide better than native implementation of these native languages on top of the Java Runtime Environment(JRE) helping to achieve performance levels close to that of Java language.
8. Stream Control Transmission Protocol (SCTP)
One of the crucial features in JDK 7 is the support for SCTP. This is an implementation-specific, reliable, message-oriented, transport protocol existing at an equivalent level with UDP (User Datagram Protocol) and TCP (Transmission Control Protocol). It offers network redundancy by supporting multi-homing. This means that an endpoint may be represented by more than one address and each address may be used for sending and receiving data. One address is designated as the primary address, this is the default address that the peer will use for sending data. For a specific session, a single port number is used across the entire address list at an endpoint. Some of the key features in SCTP include message framing, reliable transport service, session-oriented, ordered and unordered message delivery, multi-homing and multi-streaming.
9. Upgrade class-loader architecture
Using the URLClassLoader, applications load classes and resources from a search path of URLs. One of the frequent problem that crops up is supporting updated implementations of the classes and resources loaded from a particular codebase, and in particular from jar files. It cannot be predicted exactly when finalization and garbage collection will occur. This has been sort out with a new method called close() in URLClassLoader. The method effectively invalidates the loader, so that no new classes can be loaded from it. Further, it closes the jar files that have been opened by the loader.
10. Swing updates
There would be small additions to the Swing API including the JXLayer component decorator, JXDatePicker, and possibly CSS-based styling. JXLayer allows users to easily decorate the compound components and catch all Mouse, Keyboard and FocusEvent for all its subcomponents.
Conclusion
To know exactly where JDK 7 is heading to we can have a look at what Mark Reinhold, principal engineer at Sun working on Java SE and OpenJDK pointed out - JDK 7 won’t be defining what will be Java SE 7, the standard edition run time and that the development process is about creating a prototype for a future proposal for the Jave SE 7 Platform Specification, to go into the Java Community Process.
Deepak