Friday Mar 15, 2013

AutoCloseable JMS 2 Resources

As the Java EE 7 release date draws closer, blogs and articles covering the new features are beginning to roll in. In a brief blog entry, John Ament, a key independent member of the JMS 2 expert group talks about AutoCloseable JMS 2 Resources. This feature takes advantage of Java SE 7 try-with-resources to significantly simplify the cleanup of JMS resources such as connections, sessions, message consumers and message producers. This is particularly important in non-Java EE environments where you are not using the new JMSContext API via @Inject. The blog entry includes downloadable JMS 2 code samples. John expects to write many more blog entries covering JMS 2, so stay tuned.

For those unaware, JMS 2 is now in the proposed final draft stage. Feel free to download the draft and take a look at it yourself. There is a very handly What is new in JMS 2.0? section towards the beginning of the document.