Example taken from http://java.sun.com/docs/books/tutorial/essential/threads/index.html
