java.lang.IllegalThreadStateException

后端 未结 5 1531
鱼传尺愫
鱼传尺愫 2020-12-29 19:01

I am working with threads. However when I try to start a thread, I get a Exception. In concrete java.lang.IllegalThreadStateException. My code is:

public voi         


        
5条回答
  •  一生所求
    2020-12-29 19:37

    In fact, the call process is:

    • From main method: controller.main(usbservice);

    • In controller object:

      @Override
      public void main(Object argv) {
          if(this.writer == null)
              this.writer = new CommandWriting(usbservice);
          if(this.reader == null)
              this.reader = new CommandReading(usbservice);
          reader.readCommand();
      }
      
    • In object reader is the readCommand method.

    Then, it is only called once.

提交回复
热议问题