Only restore interrupted state if necessary
This commit is contained in:
parent
26e4a737f7
commit
75c7377e47
|
@ -124,8 +124,10 @@ public final class TravellingSalesmanSolver {
|
|||
f.get();
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
// Restore interrupted state...
|
||||
Thread.currentThread().interrupt();
|
||||
if (e instanceof InterruptedException) {
|
||||
// Restore interrupted state...
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// Terminate all threads.
|
||||
|
|
Loading…
Reference in New Issue