Java Weekly #8: Java9, JMS 2, JUnit, Microservices and more...

Java 9

Mark Reinhold announced the first batch of JEPs for Java 9. These are:

For me as a developer the two most interesting JEPs are 198 Light-Weight JSON API and 201 Modular Source Code. JEP 201 is only the first step for the JIGSAW project and JEP 200 will be more interesting. But it is good to see, that it is targeted for Java 9.


Java EE

The Java Temporary Cache API (JCache) was released a few month ago and was one of the most wanted features in the Java EE 8 community surveys. If you like to refresh your knowledge of this specification, you should have a look at Java Temporary Caching API aka JCache by David Delabassee. He gives a short overview of existing resources and upcoming JavaOne sessions.

Java Weekly #7: Generics with Lambda, unified type conversion and more...

Java

Java generics are an important concept in the modern Java development and they are key to understand and use the new Java 8 lambda expressions to its full extend. Josh Juneau wrote a great article, explaining how to use Java generics and why we need them to use lambda expressions.


Javin Paul wrote a great article about a small change introduced with JDK 1.7.0_40. Empty ArrayList and HashMap are now initialized with a capacity of 0, instead of an Object array of size 10 for an empty ArrayList and a default capacity of 16 for an empty HashMap. Depending on the application, this can be a huge performance improvement.


The Java update 8u11 and 7u65 introduced some errors and broke several third-party tools. This was the result of a stricter verification by the bytecode verify as described by Niv Steingarten in his post Oracle’s Latest Java 8 Update Broke Your Tools — How Did it Happen?


Java EE

Arjan Tijms had a look at the different approaches on how to convert objects in Java EE. He describes 5 (yes, five!) ways which are currently defined in different Java EE specifications and names two more APIs which are part of Java SE. 
This raises the questions, if we need to define one unified conversion API. From my point of view, this should have been already done in the past. But better now then never...

Java Weekly #6: Micro Services, CDI 2.0, NoEstimates and more...

Java

After using Scala for some days and switching back to Java, Lucas Eder started to miss some features of the Scala syntax. He wrote a blog post about The 10 Most Annoying Things Coming Back to Java After Some Days of Scala

Java EE

Roberto Cortez wrote a great tutorial on how to deploy Spring Batch as a Wildfly module. You should have a look, if you want to use one of the most feature rich implementations of JSR-352 with Wildfly.


Monitoring the O/R mapper becomes an important task, if you need to analyze performance issues of a Java EE application. Therefore Hibernate provides its Statistics Interface which exposes several statistics related to sessions, entites, queries and more. If you like to learn how to activate these statistics and how you can access them, have a look at Hibernate Statistics with Hawtio and Jolokia by Markus Eisele.

Java Weekly #5: Metaspace, Server-Sent Events, Java EE 8 drafts and more...

Java

If you like to learn more about the removal of PermGen and the introduction of Metaspace in Java 8, you should have a look at Where Has the Java PermGen Gone? by Monica Beckwith. She wrote a great post about problems with the old PermGen and how they were solved with the new Metaspace.


Java EE

Server-Sent Events (SSE) were introduced with HTML 5 and enable the server to push data via HTTP to the client. Shing Wai Chan shows in his post Server-Sent Events with Async Servlet By Example how you can implement SSE by only using the Servlet API.


Antonio Goncalves wrote an interesting article about integration testing. He wants to execute the integration tests of his web application only, if it is successfully deployed on the JBoss application server. Otherwise the tests shall be skipped. He describes in his post Your tests assume that JBoss is up and running how this can be achieved by using JUnit assumptions and the JBoss HTTP management API.

Java Weekly #4: PicketLink and DeltaSpike, Batch API, JMS 2.1 and more...

Java EE

Shane Bryzak wrote a great article on how to use PicketLink and Apache DeltaSpike to secure your Java EE application. The combination of these two frameworks is really powerful. It allows you to add security to your application by implementing only one annotation and one method.


The Batch 1.0 API does not offer any solution to schedule a batch operation in Java EE. But there is no need for it, as Arun Gupta shows in his Tech Tip #36. The Java EE plattform already offers 3 different ways to schedule a batch operation.


If you want to learn more about the Java EE Concurrency API, you should have a look at the Java EE Concurrency API Tutorial by Francesco Marchioni. He created a detailed description on how to process parallel tasks on a Java EE application server. This is really a great resource if you want to learn more about Java EE Concurrency.

Java Weekly #3: Microservices, Java 8 features, upcoming events and more...

Java

The article Tired of Null Pointer Exceptions? Consider Using Java SE 8's Optional! by Raoul-Gabriel Urma gives an extensive description about how to use Optional to improve your API and avoid NullPointerExceptions.


Oleg Shelajev wrote an interesting article about the unpredictability of parallel streams. The stream API is one of the major features introduced with Java 8 and it seems to be easy and powerful. But as Oleg describes in his article, it can influence the performance of your application in an unpredictable way.


Java EE

Maven archetypes are a quick and easy way to setup a Maven project and immediately start with the implementation. But so far there was no archetype to create a Java EE 7 project with Arquillian dependencies and profiles (at least as far as I know...). If you have used Arquillian to test your application, you know that setting up the profiles for different application servers is always some annoying (copy & paste) work.
This has changed since Arun Gupta introduced a Maven Archetype for Java EE 7 projects with Arquillian profiles on his blog. The archetype provides Java EE 7 dependencies and creates a managed and a remote profile for Wildfly and GlassFish.

Java Weekly #2: JPA 2.1, Java8, JSR 351, Eclipse Luna and more...

Java EE

Steven Gertiser showed a great example on how to use a JPA Type Converter to persist the new Java8 DateTime classes. This example shows again how powerful the type converter feature is. You only need a few lines of code to define how a class gets persisted to the database.
If you like to read more about Type Converter and other new features of JPA 2.1, have a look at my JPA 2.1 related posts.


Normally, I try to ignore the Spring vs. Java EE discussion, but I found a good posting by Nmpallas this week. He is a long time Java EE developer and gave Spring a try for a recent project. His main reason was, that an application server offers much more features than he needed. But after some time, he decided to migrate the application to Wildfly 8.0.0. Read about his reasons and what he thinks about the standard Spring arguments in: It’s not Spring anymore is the summer of JEE7, ready riding the wave?


Java 8

Java 8 introduced the two default methods forEach(Consumer action) and spliterator() to the Iterable interface. While this looks good in the first place, Stephen Colebourne is not as happy with it. He describes in his blog why this change reduced the number of use cases of the Iterable interface: Java 8 - Iterable woes
I do not see a huge issue in this change. But what do you think? Is this really a drawback of the new Iterable interface?