Another attempt at synchronization, modeled around this old but maybe
still relevant article:
http://www.javaworld.com/jw-03-1999/jw-03-toolbox.html
Tried to handle synchronization better, based on this article: 
http://www.javaworld.com/jw-03-1999/jw-03-toolbox.html