Wednesday Dec 07, 2011

Lesser-advertised Java JSRs

As you may have already read here, Java EE 7 (JSR 342) is well on its way with some JSRs having reached the early draft status (e.g. JAX-RS 2.0, JSF 2.2, CDI 1.1, ...).


On the other hand, you may not have heard of the following JSRs that are all candidates for inclusion in the Java EE Platform:
State Management (JSR 350) was recently filed by Oracle to offer a standard API for a state management subsystem (examples of state include HTTPSession and any state associated with CDI scoping annotations).
Batch (JSR 352) was covered here just recently as it has recently passed the Review Ballot.
Concurrency Utilities for Java EE (JSR 236) is building on JSR-166 (java.util.concurrency) to provide a clean abstraction for threaded code in a managed environment. It has been ongoing for several years and should be revived and completed in time for Java EE 7.
Java API for JSON Processing (JSR 353) is a parsing API for manipulating (reading or writing) JSON content. Binding (JAXB-style) is not in the scope of this newly submitted JSR.

The exact list of JSRs that will be part of Java EE 7 is up to the expert group to decide. Arun has more details on the status of each JSR.

Thursday Oct 19, 2006

Using Custom Annotations in JAX-WS 2.1 to support HTTP Session State

Duke for GlassFish V2

Annotations are a first-class language feature in Java (tutorial, jsr-175). A standard specification like JAX-WS introduces standard annotations but custom annotations can be equally useful. Kohsuke uses a custom annotation to take advantage of a SPI (InstanceResolver) in the JAX-WS RI in GlassFish. The result is that adding a simple annotation (@HttpSessionScope, in the package) on a class tells the JAX-WS RI to create one instance of the class per each HTTP session.

Like any other non-standard mechanism, adding the annotation creates a dependency on a specific platform, but the dependency is explicitly declared (usually via an import statement), and the result is really clean an compact. Check Kohsuke's blog for details.