state-machine-example-java-6-thread-states