Last time when I saw enum used as a HashMap key I decided to check why it works out of the box without custom implementations of 'hashCode' and 'equals' methods.
Sunday, May 5, 2013
Java SE has clearly defined entry point of the program execution - 'public static void main(String args)' method. However, when it comes to Java EE such an entry point is blurred. Can we create main method in Java EE?
When we deal with concurrency we use 'synchronized' keyword or we leverage the power of java.util.concurrent (JUC) stuff in order to tame our threads. Both of the methods have advantages and disadvantages. I would like to focus on one particular advantage of intrinsic locking.
Saturday, April 20, 2013
Some time ago I wrote about deadlock in Java language. However the problem of a deadlock can also appear in a database. The transactions are just the analogues of threads. Is a database able to recover from a deadlock? Let's check this out!
Saturday, April 13, 2013
The most popular deadlock example is about acquiring two different locks in the opposite order by two different threads. However it can be tricky to obtain deadlock in that way because we must encounter unlucky timings of the threads. I created a piece of code that is very likely to result in a deadlock.