Talking Java EE 7 with Anil Gaur, Vice President of software development at Oracle
After some slight delays, Java EE 7 has arrived today. We caught up with Oracle VP of Software Development Anil Gaur to discuss the major enterprise release in more detail. You can find out more about Java EE 7 in the launch webcast later on today here at 9 am PT / 12 pm ET / 5 pm GMT.
JAX: How many engineers/developers were behind the Java EE 7 release, in total?
Gaur: The Java EE 7 release is a community effort. The 4 new JSRs & 10 updated JSRs were developed by: 16 spec leads, 32 companies and 187 Java experts. In addition, a large number of engineers contributed towards the reference implementation and TCK development.
JAX: Going into the release, what were the key design goals? There appears to be a heavy focus on web support for example.
Gaur: There are actually 3 top-level themes we are driving for Java EE 7:
1) Deliver HTML5 Dynamic Scalable Applications.
To facilitate the rapid adoption of HTML5 to create a richer user experience in the browser, we are introducing WebSocket support as a means to create a low-latency, bi-directional full-duplex communication channel. We are also introducing an asynchronous API to improve scalability by executing RESTful business logic in the background and not holding to a thread. Similarly a JAX-RS client can be asynchronous allowing it to work on other tasks, while waiting for a server to respond. RESTful services often exchange information using JSON. Java EE 7 introduces the JSON Processing API to parse JSON-formatted data using a Streaming or an Object Model API. JSF now has JSF-friendly markup, meaning that HTML5-friendly markup, such as type or data-* attributes, can now be rendered directly in a web browser without a prior knowledge of the attributes.
2) Increase Developer Productivity
Java EE 7 offers a number of productivity improvements for developers. This is enabled by reducing the amount of boilerplate code needed before developers can get to the core business logic. For example, JMS 2.0 leverages annotations, dependency injection, AutoCloseable, default resource definitions and a simplified API to reduce the amount of effort for something like simply placing a message on a queue to just a few lines of code. One much-requested feature we've added is a standard RESTful client API so developers can productively make RESTful calls without using a proprietary client API. Resource definitions like JMS connection factories and data sources have a default definition so deploying an application to a Java EE runtime is now handled in a standard way and requires much less configuration. We've also done a lot of work to improve the integration of JSRs, to make Java EE 7 even more integrated platform. For example, Bean Validation can now be used in method declarations to validate parameter and return values, container-managed transactions are now available to more than just EJBs and transactional interceptors, along with the new @Transactional annotation, enable transactions to be applied to any managed bean method, making it transactional. CDI is enabled by default, so a beans.xml is no longer required to simply use a CDI bean.
We’ve also introduced some new CDI scope such as @TransactionScoped and @FlowScoped. Even existing JSF scope, such as ViewScoped were rewritten as CDI scope.
3) Meet the most demanding enterprise requirements
Two new JSRs are directed at addressing some pretty important enterprise requirements. Java EE is a managed environment, so applications are not allowed to create their own threads. The Concurrency Utility API enables developers to create thread pools that execute tasks concurrently. The Batch API, which was lead by IBM, is best suited for non-interactive, bulk-oriented and long running or computationally-intensive tasks. We expect this API to be pretty popular among enterprise customers.
JAX: There are several new parts to Java EE. Can you tell us about Batch Applications for the Java Platform 1.0 (JSR 352) and what this allows users to do? What situations does it thrive in?
Gaur: Batch Applications for Java Platform 1.0 allows users to execute a series of jobs that are suitable for non-interactive, bulk-oriented and long-running tasks. Typical examples are end-of-month bank statement generation or extract-transform-load in a data warehouse.
The jobs are defined using a Job Specification Language, referred as "Job XML". Each job can have multiple steps; each step is a "chunk" or "batchlet". Chunk is item-oriented processing where a chunk of items are read, processed, and written out, all within a transaction. There are checkpoint mechanisms available in case there is an intermittent failure. Batchlet is task-oriented processing and allows you to roll-your-own batch pattern.
These jobs can be invoked from any Java EE component allowing you to seamlessly integrate batch processing with your application.
JAX: A lot of developers are excited about WebSocket. How important was this to Java EE 7 and what does it enable you to do?
Gaur: WebSocket enables a full-duplex bi-directional communication channel over a single TCP connection. This allows you to build a low latency application that requires high interactivity using standard Java EE APIs. This is one of the most significant technologies added to the Java EE 7 platform and we expect developers will build innovative applications using this API in many ways that we cannot yet foresee.
JAX:Was targeting HTML5 a necessity for the release?
Gaur: Absolutely. HTML5 is a key client-side standard for enabling a dynamic user experience, and has been growing rapidly in popularity with developers over the past few years. This will drive significantly more demand for services that provide the information that these dynamic user interfaces need. So, Servlet 3.1 NIO, JAX-RS 2.0 asynchronous RESTful web services, WebSockets, and even Concurrency Utilities to some degree, deliver the scalability and communication channels for Java EE developers to keep those information-hungry clients satisfied.
JAX: Why has JSON been selected - what benefits does this give to Java developers?
Gaur: JSON is a standard data format for light weight data exchange and the lingua franca of web applications. Typically Java EE applications will include third-party libraries to process JSON. Integrating the JSON Processing API in the platform itself allows us to remove dependency on those additional libraries. As the JSON APIs are now available in the platform, the application becomes lighter weight and also uses standard APIs.
JAX: How important was the Expert Group’s advice throughout development?
Gaur: Very important and significant. All the Expert Groups (EG) operated in a transparent manner using JCP 2.9. This required them to publish the EG discussions on a public forum, have a public issue tracker, respond to a public alias where non-EG members can post questions and share working drafts of the specification. All of this allowed the EG to tap into a much wider set of "experts" and this resulted in a much better quality specification and wider adoption, even before the specification going final.
JAX: Which other JSRs stand out for you?
Gaur: Concurrency Utilities for Java EE is a significant addition to the Java EE 7 platform. Java EE is a managed environment and so creating user threads is not allowed. With this addition, standard Java SE Concurrency design patterns can now be used in a managed way within Java EE. For example, ManagedExecutorService can be used to create a managed ExecutorService where the user task can be defined as Runnable or Callable. The threads are managed by the Java EE runtime and JNDI, class-loading, security and other context information are available in the spawned threads.
JAX: Were there any large hurdles to overcome during development?
Gaur: There were no major hurdles which were unique to this release of the platform. Driving standards in a community with broad participation from vendors and individuals has its fair share of challenges. It's not uncommon to have disagreements within the Expert Groups on certain topics, which may take a while to reach consensus, but at the end, that's a good thing for the platform. Last summer we had to revisit the theme of Java EE 7 since we realized that many of the Cloud technologies under consideration for the specification had not matured enough to be standardized. Based on the consistent feedback from Java EE vendors and the community we decided to switch the theme from Cloud to HTML 5 and Developer Productivity, which has worked out really well.
JAX: Was this the correct decision in your view - to leave Cloud support out?
Gaur: There was a unanimous consensus within the Expert Group, Java EE community, partners, and everywhere else for deferring the Cloud support. There are still no clear standards in the Cloud space which makes including them within the Java platform only that more challenging. The components added/updated in the platform have a much wider appeal to developers and solve their daily problems. Given the current landscape of PaaS and the ability to provide new functionality in the platform, we strongly believe that was the correct decision.
JAX: Was it a disappointment to see JCache miss out on the release?
Gaur: Java EE 7 has a lot to offer to developers even without JCache. We're working towards finalizing the JCache APIs well before Java EE 8 and we expect there will be incremental progress in the platform to enable developers to use the new APIs on top of Java EE 7.
JAX: With three years since Java EE 6, are you expecting adoption to be very strong for Java EE 7?
Gaur: During our early community participation via Adopt-a-JSR and FishCAT efforts, we've seen tremendous interest in the new, as well as the updated, technologies added to the platform. All of the technologies in Java EE 7 are solving real-world problems and we've seen great adoption of them already.
JAX: What do you want the community to take from the release?
Gaur: The Java EE platform is a community-driven enterprise standard. It provides a cohesive and integrated stack to solve real-world problems. With 18 Java EE 6 compliant application servers, the community has a broad selection of create-once-deploy-anywhere for their applications. GlassFish is the first Java EE 7 compliant application server, Red Hat has already announced plans around Java EE 7 compliance and we expect other vendors to follow as well. I highly encourage the community to download and try the Java EE 7 SDK fromoracle.com/javaee and provide us feedback.
And last but not least, Oracle is committed towards Making the Future Java.