本帖最后由 一碗小米周 于 2013-9-24 19:16 编辑
- public void start(){
- Executors.newSingleThreadExecutor().execute(new Runnable() {
- public void run() {
- //while(true){
- switch (type) {
- case common:
- commonService();
- break;
- case rapid:
- rapidService();
- break;
- case vip:
- vipService();
- break;
-
- }
- //}
-
- }
- private void commonService() {
- String windowName = "第"+windowId+"号"+type+"窗口";
- System.out.println(windowName+"正在获取任务");
- Integer Number = NumberMachine.getInstance().getCommonManager().fetchNumeber();
-
- if(Number!=null){
- System.out.println(windowName+"为第"+Number+"个"+type+"客户完成服务");
- int maxservetime = Constants.MAX_SERVICE_TIME-Constants.MIN_SERVICE_TIME;
- long servetime= new Random().nextInt(maxservetime)+1+Constants.MIN_SERVICE_TIME;
- try {
- Thread.sleep(servetime);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
复制代码 请问各位那个我注释的while(true)有什么作用?为什么我注释了之后,就不再执行if(Number!=null)??谢谢。。
|