killing an infinite loop in java

后端 未结 3 1983

I am using a third-party library to process a large number of data sets. The process very occasionally goes into an infinite loop (or is blocked - don\'t know why and can\'t

3条回答
  •  旧巷少年郎
    2021-01-03 02:37

    One of the ExecutorService.invokeAll(...) methods takes a timeout argument. Create a single Callable that calls the library, and wrap it in a List as an argument to that method. The Future returned indicate how it went.

    (Note: untested by me)

提交回复
热议问题