Five years waiting for JRE7: it’s justified? (Part 2)
After discovering some code changes and refactoring in the first part, we will try in this part to discover some major features added to JRE7.
Let’s detect all packages and types added to JRE7:
SELECT PACKAGES WHERE WasAdded
SELECT TYPES WHERE WasAdded
Many packages and types are added, most of these new features are listed in the official JDK release note.
Let’s first begin with the most popularized new features:
Improved API for dynamically typed programming languages
Java 6 introduced some interesting possibilities to execute scripting languages, and this effort was continued in Java 7 and many improvements was added to support better dynamic languages.
These Extensions was added to the JVM, the Java language, and the Java SE API to support the implementation of dynamically-typed languages at performance levels near to that of the Java language itself.
JRuby is an example of dynamic language that used this new feature in its last implementation available here.
After analyzing JRuby we can search for methods used by the new improved implementation
SELECT TYPES WHERE IsDirectlyUsedBy "org.jruby.runtime.invokedynamic"
The new implementation use new classes from “java.lang.invoke” added to JRE7.
API for Parallel Programming / Multicore programming
The Fork/Join framework is designed to make divide-and-conquer algorithms easy to parallelize. That type of algorithms is perfect for problems that can be divided into two or more sub-problems of the same type. The solutions to the sub-problems are then combined to give a solution to the original problem.
For more details please refer to this link.
Let’s search for all added types in java.util.concurrent
SELECT TYPES FROM PACKAGES "java.util.concurrent" WHERE WasAdded
Enhanced Class Loader
The Java SE 7 release contains an important enhancement for multithreaded custom class loaders. In previous releases, certain types of custom class loaders were prone to deadlock. The Java SE 7 release modifies the locking mechanism to avoid deadlock.
For more details about this problem, you can refer to this web page.
Let’s search for added methods to ClassLoader:
SELECT METHODS FROM TYPES "java.lang.ClassLoader" WHERE WasAdded
And we can also search all new methods used by ClassLoader
SELECT METHODS WHERE IsDirectlyUsedBy "java.lang.ClassLoader" AND WasAdded
The Java API for XML Processing (JAXP) enables applications to parse, transform, validate and query XML documents using an API that is independent of a particular XML processor implementation. JAXP provides a pluggability layer to enable vendors to provide their own implementations without introducing dependencies in application code.
To check if really with JAXP we can plug an independent XML processor implementation, let’s search for interfaces inside the “javax.xml.parsers”.
SELECT TYPES WHERE IsDirectlyUsedBy "javax.xml.parsers" AND IsInterface
As we can observe this package include many interesting interfaces like XMLReader and Parser, so we can plug any parser implementation.
Using interfaces make the API more flexible and in JRE7 many interfaces was added, which is a good point for this new release.
Let’s search for all methods added for JAXP
SELECT METHODS FROM PACKAGES "javax.xml.parsers", "org.w3c.dom", "org.xml.sax","javax.xml.transform","javax.xml.stream" WHERE WasAdded
Only few methods added to this new release for JAXP.
Java Architecture for XML Binding (JAXB) allows to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and to unmarshal XML back into Java objects. In other words, JAXB allows storing and retrieving data in memory in any XML format, without the need to implement a specific set of XML loading and saving routines for the program’s class structure.
JAXB is useful when the specification is complex and changing. In such a case, regularly changing the XML Schema definitions to keep them synchronized with the Java definitions can be time consuming and error prone.
Let’s search all methods added to JAXB.
SELECT METHODS FROM PACKAGES "javax.xml.bind","javax.xml.bind.util" WHERE WasAdded
The new java.nio.file package and its related package, java.nio.file.attribute, provide comprehensive support for file I/O and for accessing the file system. A zip file system provider is also available in JDK 7.
SELECT TYPES FROM PACKAGES "java.nio.file.*" WHERE IsPublic
SELECT METHODS FROM PACKAGES "java.net" WHERE WasAdded AND IsPublic
Many methods was added, the JDK7 release note focused only on URLClassLoader and SDP, however many other possibilities was added to other classes.
SELECT METHODS FROM TYPES "java.net.URLClassLoader" WHERE WasAdded
The major change in URLClassLoader is that we can now close the loader.
For high performance computing environments, the capacity to move data across a network quickly and efficiently is a requirement. Conventional networking using socket streams can create bottlenecks when it comes to moving data. Introduced in 1999 by the InfiniBand Trade Association, InfiniBand (IB) was created to address the need for high performance computing. One of the most important features of IB is Remote Direct Memory Access (RDMA). RDMA enables moving data directly from the memory of one computer to another computer, bypassing the operating system of both computers and resulting in significant performance gains.
The Sockets Direct Protocol (SDP) is a networking protocol developed to support stream connections over InfiniBand fabric.
JDK7 add these new classes to provide this useful new feature
Rich Internet Applications (RIA)/Deployment
JDK7 added many capabilities to deploy RIA application, to check that let’s search for all types added to “com.sun.deploy.*” packages.
SELECT TYPES FROM PACKAGES "com.sun.deploy.*" WHERE WasAdded
JLayer is a universal decorator for Swing components which enables you to implement various advanced painting effects as well as receive notifications of all AWTEvents generated within its borders.
Let’s search for methods used by JLayer, to discover which JComponent are used for this decoration.
SELECT METHODS WHERE IsDirectlyUsedBy "javax.swing.JLayer"
JSSE jar provides both an application programming interface (API) framework and an implementation of that API. The JSSE API supplements the “core” network and cryptographic services
This jar was mainly refactored, many namespaces was moved, removed and others added.
SELECT TYPES FROM JARS "jsse" WHERE WasAdded
Many classes was added to Java2d, it includes XRender-Based Rendering Pipeline,Support for OpenType/CFF Font and Support for Linux Fonts.
SELECT TYPES FROM PACKAGES "sun.java2d.*" WHERE WasAdded
The Locale class has been updated and many methods were added to it.
Let’s search for all public methods added to this class.
SELECT METHODS FROM TYPES "java.util.Locale" WHERE WasAdded AND IsPublic
Major features was added to JRE7
- improved Dynamic typed languages API
- New IO
- RIA Deployement
However only few improvements was added to:
- Class Loader
We hope that Oracle invest more in JRE8, and give us more features to the language and the API.