@vladis, here you got rid of `synchronized`. Question to you: what would happen if 2 sessions are going to be destroyed at the same time after tomcat restart: one will get into the IF block and then 2nd thread will go there as well. Then first thread is decrementing the counter and now it's 0. Then second thread would decrement it to -1.