commit | 5201f2c5fab763e063fe536101cad031418738d3 | [log] [tgz] |
---|---|---|
author | Alex Herbert <aherbert@apache.org> | Fri Aug 20 21:19:23 2021 +0100 |
committer | Alex Herbert <aherbert@apache.org> | Fri Aug 20 21:19:23 2021 +0100 |
tree | 2c99d8954c244113543a6e5d1468d948d43869ed | |
parent | 7ee70ef4748507a3f8dd67dc57c775f87732a87c [diff] |
Only restore interrupted state if necessary
diff --git a/commons-math-examples/examples-sofm/tsp/src/main/java/org/apache/commons/math4/examples/sofm/tsp/TravellingSalesmanSolver.java b/commons-math-examples/examples-sofm/tsp/src/main/java/org/apache/commons/math4/examples/sofm/tsp/TravellingSalesmanSolver.java index 478310d..d6eb45b 100644 --- a/commons-math-examples/examples-sofm/tsp/src/main/java/org/apache/commons/math4/examples/sofm/tsp/TravellingSalesmanSolver.java +++ b/commons-math-examples/examples-sofm/tsp/src/main/java/org/apache/commons/math4/examples/sofm/tsp/TravellingSalesmanSolver.java
@@ -124,8 +124,10 @@ 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.