一个程序中启动了多个线程后,怎么去控制这些线程?

解决方案 »

  1.   

    priority is really a bad idea for controlling the threads.Java's scheduling and priority models are weak; in particular1. no guarantee is given that the highest priority runnable thread is always executing;2. equal priority threads may or may not be time sliced; and3. where native threads are used, different Java priorities may be mapped to the same operating system priority
    use Thread Groups or Thread Manager to control your threads.
      

  2.   

    用PriorityQueue自己搞优先级,interrupt低优先权的线程:)