You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/08/22 00:33:28 UTC
[commons-math] 04/13: Only restore interrupted state if necessary
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit 75c7377e4762b3204f50bfdb66b1d8f6c7a2d1b4
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri Aug 20 21:19:23 2021 +0100
Only restore interrupted state if necessary
---
.../commons/math4/examples/sofm/tsp/TravellingSalesmanSolver.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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 @@ 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.