You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2013/05/11 04:02:31 UTC

git commit: Don't throw if future can't be canceled. Just log it

Updated Branches:
  refs/heads/CURATOR-17 10df9fc24 -> 601bc4c93


Don't throw if future can't be canceled. Just log it


Project: http://git-wip-us.apache.org/repos/asf/incubator-curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-curator/commit/601bc4c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-curator/tree/601bc4c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-curator/diff/601bc4c9

Branch: refs/heads/CURATOR-17
Commit: 601bc4c93229bea70bd4d24121901d36394d6cd5
Parents: 10df9fc
Author: randgalt <ra...@apache.org>
Authored: Fri May 10 19:02:21 2013 -0700
Committer: randgalt <ra...@apache.org>
Committed: Fri May 10 19:02:21 2013 -0700

----------------------------------------------------------------------
 .../curator/utils/CloseableExecutorService.java    |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/601bc4c9/curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java b/curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
index 4024d29..74c6d28 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
@@ -4,6 +4,8 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import java.io.Closeable;
 import java.util.Iterator;
 import java.util.Set;
@@ -20,6 +22,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
  */
 public class CloseableExecutorService implements Closeable
 {
+    private final Logger log = LoggerFactory.getLogger(CloseableExecutorService.class);
     private final Set<Future<?>> futures = Sets.newSetFromMap(Maps.<Future<?>, Boolean>newConcurrentMap());
     private final ExecutorService executorService;
     protected final AtomicBoolean isOpen = new AtomicBoolean(true);
@@ -79,8 +82,7 @@ public class CloseableExecutorService implements Closeable
             iterator.remove();
             if ( !future.cancel(true) )
             {
-                System.err.println("Could not cancel");
-                throw new RuntimeException("Could not cancel");
+                log.warn("Could not cancel " + future);
             }
         }
     }