Unsynchronized persistence context in Java EE 7 JPA 2.1 introduced the concept of unsynchronized persistence context which allows fine grained control over flushing of the JPA Entity Manager i.e. by explicitly calling EntityManager#joinTransaction. Previously, this was defaulted to end of JTA transaction e.g. in a typical Stateless EJB, the entity manager would flush its state to the DB at the ...
Read More »Home »
Automated provisioning of JMS resources in Java EE 7
JMS 2.0 (part of the Java EE 7 Platform) introduced lots of nice features. One of these was the ability to declare JMS resources for automatic deployment. Pre Java EE 7 Inject Connection Factory using @Resource Lookup Destination (Queue/Topic) using @Resource Pull out the Session object and use it to create the Message, Message Producer and send the message Most ...
Read More »Implementing auto retry in Java EE applications
Initially, I wanted to call this blog – ‘Flexible timeouts with interceptor driven retry policies‘ – but then I thought it would be too ‘heavy’. This statement, along with the revised title should (hopefully) give you an idea of what this post might talk about ;-) The trigger This post is primarily driven by one of the comment/question I received ...
Read More »Basics of scaling Java EE applications
To be honest, ‘scalability’ is an exhaustive topic and generally not well understood. More often than not, its assumed to be same as High Availability. I have seen both novice programmers and ‘experienced’ architects suggest ‘clustering‘ as the solution for scalability and HA. There is actually nothing wrong with it, but the problem is that it is often done by ...
Read More »JAX-RS and JSON-P integration
This short post talks about support for JSON-P in JAX-RS 2.0 JSON-P …? The JSON Processing API (JSON-P) was introduced in Java EE 7. It provides a standard API to work with JSON data and is quite similar to its XML counterpart – JAXP. JSON-B (JSON Binding) API is in the works for Java EE 8. Support for JSON-P in ...
Read More »Native CDI Qualifiers: @Any and @Default
Let’s take a look at the out-of-the-box qualifiers in CDI There are three qualifiers declared by the CDI specification – @Any, @Default, @New @Any: Think of it as an omnipresent qualifier. It’s there even if its not ;-) @Default: As the name suggests, this qualifier treated as a default when none other qualifiers have been specific. The only exception to ...
Read More »Introductory NoSQL stuff
While some of you might be NoSQL gurus, there is often a lack of solid knowledge about NoSQL in general and some common myths as well. Specifically, topics like NoSQL applicability/use cases and its comparison (fair and unfair) against relational databases are often driven by incomplete knowledge. I do not claim to be an expert in the NoSQL domain, but ...
Read More »New in JMS 2.0
This post lists ALL of the new APIs (interfaces/classes/annotations etc.) introduced in JMS 2.0 (part of the Java EE 7 platform). These have been categorized as follows API simplification Ease of use Exception Handling Miscellaneous Here is a quick summary along with some code snippets API simplification JMSContext Simpler abstraction on top of Connection and Session objects which eliminates the ...
Read More »Random JCache stuff: multiple Providers and JMX beans
JCache (JSR 107) is the Java standard for Caching… enough said. No more introductory stuff. This is a quick fire post which talks about Multiple JCache provider configurations, and Feature: JCache stats via JMX Mbeans Managing multiple JCache providers In case you are dealing with a single JCache provider, javax.jcache.Caching.getCachingProvider() returns an instance of the one and only CachingProvider on ...
Read More »