Why does SwingWorker stop unexpectedly?

前端 未结 4 822
醉酒成梦
醉酒成梦 2020-12-07 01:19

I wanted to try out some ideas using SwingWorker since I haven\'t used it too much. Instead, I ran into an issue and I can\'t figure out what\'s wrong.

4条回答
  •  悲&欢浪女
    2020-12-07 02:22

    If you look at line 771 of SwingWorker class source code (Java SE 7):

    thread.setDaemon(true);
    

    You will see that the SwingWorker is executed within a daemon thread, and in Java the JVM will be terminated if all non-daemon threads are finished.

提交回复
热议问题