You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/08/20 21:27:07 UTC

[commons-math] 01/02: Only restore interrupted state if necessary

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 5201f2c5fab763e063fe536101cad031418738d3
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.