killing an infinite loop in java
问题 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 get into the code). I'd like to kill this after a set time and continue to the next case. A simple example is: for (Object data : dataList) { Object result = TheirLibrary.processData(data); store(result); } processData normally takes 1 second max. I'd like to set a timer which kills processData() after , say, 10 seconds