Timeout a task with Java's SwingWorker

前端 未结 4 1336
不知归路
不知归路 2021-01-02 22:52

I am trying to implement a SwingWorker class within my application. Is there a way to set a length of time that after which, the SwingWorker \"times out\"? I

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-02 23:29

    Any particular reason for not using the SwingWorker.get(long, java.util.concurrent.TimeUnit) ? It will throw TimeoutException that you can easily handle in your application.

提交回复
热议问题