How Evolution Harms a Programming Language

Java is a lovely programming language, but after its biggest evolutionary step (from 1.4 to 1.5) some awkward things started occurring, since the new compiler should be backwards compatible. Java programmers must recall about some backwards compatibility aspects in order to understand why the Java compiler acts in a somewhat strange way at times. Method overloading, for example, became pretty tricky. Guess what's the result for the program below... [code language='java'] public class MethodOverloading { void doSomething(Integer i) {  ... Read more

Avoiding StaleConnectionException on WebSphere Application Server

StaleConnectionException is one of the most popular issues that occur when one implements an application that employs JDBC to connect to a database through WAS' connection pool. Depending on the container's connection pool settings, it keeps stale (no longer usable due to database failure) connections. Therefore when your application gets a new connection and tries to use it, it will fail. As recommended by IBM, I have implemented several approaches to detect stale connections, and retry. Although OK, the retry approach is ... Read more

Singleton

Lazy Singleton in Java: [code language='java'] public class Singleton { private static class SingletonHolder { private static Singleton INSTANCE = new Singleton(); } public static Singleton getInstance() { return SingletonHolder.INSTANCE; } }[/code] Read more

Transaction Management Using Spring

In order to effectively design and implement software that handles transactions using Spring, knowledge on the concepts below is vital: Isolation: the degree of isolation this transaction has from the work of other transactions. For example, can this transaction see uncommitted writes from other transactions? Propagation: normally all code executed within a transaction scope will run in that transaction. However, there are several options specifying behavior if a transactional method is executed when a transaction context already exists: for example, simply continue running ... Read more