Saturday, April 20, 2013

Database deadlock example

    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

Simple deadlock example - jstack to the rescue

    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.

Friday, April 12, 2013

StackOverflowError without recursion

    I believe that the great majority of programmers has already seen StackOverflowError with beautiful stacktrace. The flow is usually stuck deep inside the invocation of the same, recursive method. However, such an error can be produced quite easy without recursion.

Thursday, April 4, 2013

Regexp for matching text within parentheses, brackets, quotes, etc.

    Sometimes we want to find some text that is placed within (...), "...", '...', [...], etc., but we do not want to include delimiters. It can be achieved by means of the look-behind regexp expression.