Saturday, February 23, 2013

Injecting Stateful Session Bean into servlet

    The advent of DI frameworks makes it natural to annotate a field with @EJB or @Inject and let the framework resolve the dependency for us. It can be that simple but sometimes something can behave incorrectly.

Tuesday, February 12, 2013

The frightening and shocking history of concurrency

    Some time ago I was a participant of the Java conference. That time one of the speaker said that about 80-90% (I do not remember the exact value) of multi threaded code was synchronized wrongly and the rest of the code had not yet been proven to be synchronized wrongly.

Sunday, February 3, 2013

I am optimistic... exception!

    Java EE applications usually handle many concurrent users. This means that there must exist some strategies that keep the data consistent in case of concurrent modification of the same database row (entity). JPA2 defines two types of locking, namely Optimistic Locking (OL) and Pessimistic Locking (PL).