lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [49/50] lucene-solr:feature/autoscaling_72: SOLR-11440: Potential fix for better handling of exceptions thrown during closing.
Date Thu, 05 Oct 2017 11:57:10 GMT
SOLR-11440: Potential fix for better handling of exceptions thrown during closing.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/77fc1885
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/77fc1885
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/77fc1885

Branch: refs/heads/feature/autoscaling_72
Commit: 77fc1885c7a35740fdc5f591ecd54e75702f1612
Parents: 6b327fa
Author: Andrzej Bialecki <ab@apache.org>
Authored: Thu Oct 5 10:45:28 2017 +0200
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Thu Oct 5 10:45:28 2017 +0200

----------------------------------------------------------------------
 .../solr/cloud/autoscaling/ScheduledTriggers.java    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/77fc1885/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
index 7bbbcd9..9dcec35 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
@@ -37,7 +37,6 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
 
@@ -147,18 +146,22 @@ public class ScheduledTriggers implements Closeable {
     if (isClosed) {
       throw new AlreadyClosedException("ScheduledTriggers has been closed and cannot be used
anymore");
     }
-    ScheduledTrigger st = null;
+    ScheduledTrigger st;
     try {
       st = new ScheduledTrigger(newTrigger, zkClient, queueStats);
     } catch (Exception e) {
-      //TODO to decide what to do
-      log.error("Failed to add trigger", e);
+      if (isClosed) {
+        throw new AlreadyClosedException("ScheduledTriggers has been closed and cannot be
used anymore");
+      }
+      if (!zkClient.isConnected() || zkClient.isClosed()) {
+        log.error("Failed to add trigger " + newTrigger.getName() + " - closing or disconnected
from ZK", e);
+      } else {
+        log.error("Failed to add trigger " + newTrigger.getName(), e);
+      }
       return;
     }
-
     ScheduledTrigger scheduledTrigger = st;
 
-
     ScheduledTrigger old = scheduledTriggers.putIfAbsent(newTrigger.getName(), scheduledTrigger);
     if (old != null) {
       if (old.trigger.equals(newTrigger)) {


Mime
View raw message