Swing Worker Threads Not Concurrent

后端 未结 3 601
我在风中等你
我在风中等你 2020-12-07 02:16

It seems that when I instantiate 12 Swing Worker threads, the first six starts to complete its task, it finishes AND then the last six starts and finishes. The behavior I\'

3条回答
  •  盖世英雄少女心
    2020-12-07 02:52

    The behavior I'm looking for is all 12 threads start working at the same time & finish at the same time.

    A CountDownLatch is designed for this very purpose. Here's a good example using a single SwingWorker and a number of subsidiary threads controlled by the latch.

提交回复
热议问题