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();
|
f.get();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
// Restore interrupted state...
|
if (e instanceof InterruptedException) {
|
||||||
Thread.currentThread().interrupt();
|
// Restore interrupted state...
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
// Terminate all threads.
|
// Terminate all threads.
|
||||||
|
|
Loading…
Reference in New Issue