design question for Java multiple-thread