You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ca...@apache.org on 2014/08/05 06:34:18 UTC

[1/4] git commit: CURATOR-71 do not log-and-throw

Repository: curator
Updated Branches:
  refs/heads/master adb93c0ef -> 3c1a4edc2


CURATOR-71 do not log-and-throw

If we throw an exception, then there is no point in logging it since
something further up the call stack already has to deal with it. At
best, the exception gets logged twice, at worst we log potentially
confusing exceptions that end up not mattering.


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

Branch: refs/heads/master
Commit: 35278cc1b52802995ee5db017bcc84dba7c69a70
Parents: f5767c8
Author: Mike Drob <md...@cloudera.com>
Authored: Fri Aug 1 12:08:47 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Fri Aug 1 12:08:47 2014 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/curator/CuratorZookeeperClient.java    | 5 ++---
 .../org/apache/curator/framework/imps/CuratorFrameworkImpl.java | 5 ++---
 .../apache/curator/framework/recipes/leader/LeaderSelector.java | 1 -
 .../framework/recipes/locks/StandardLockInternalsDriver.java    | 1 -
 .../framework/recipes/nodes/PersistentEphemeralNode.java        | 5 +----
 5 files changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/35278cc1/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
index f14214f..09b28b2 100644
--- a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
+++ b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
@@ -182,9 +182,8 @@ public class CuratorZookeeperClient implements Closeable
 
         if ( !started.compareAndSet(false, true) )
         {
-            IllegalStateException error = new IllegalStateException();
-            log.error("Already started", error);
-            throw error;
+            IllegalStateException ise = new IllegalStateException("Already started");
+            throw ise;
         }
 
         state.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/35278cc1/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 01cacee..e86b1e5 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -233,9 +233,8 @@ public class CuratorFrameworkImpl implements CuratorFramework
         log.info("Starting");
         if ( !state.compareAndSet(CuratorFrameworkState.LATENT, CuratorFrameworkState.STARTED) )
         {
-            IllegalStateException error = new IllegalStateException();
-            log.error("Cannot be started more than once", error);
-            throw error;
+            IllegalStateException ise = new IllegalStateException("Cannot be started more than once");
+            throw ise;
         }
 
         try

http://git-wip-us.apache.org/repos/asf/curator/blob/35278cc1/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
index e7b61f9..3be941a 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
@@ -418,7 +418,6 @@ public class LeaderSelector implements Closeable
         }
         catch ( Exception e )
         {
-            log.error("mutex.acquire() threw an exception", e);
             throw e;
         }
         finally

http://git-wip-us.apache.org/repos/asf/curator/blob/35278cc1/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
index d225bbb..25f07b8 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
@@ -61,7 +61,6 @@ public class StandardLockInternalsDriver implements LockInternalsDriver
     {
         if ( ourIndex < 0 )
         {
-            log.error("Sequential path not found: " + sequenceNodeName);
             throw new KeeperException.NoNodeException("Sequential path not found: " + sequenceNodeName);
         }
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/35278cc1/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
index 08cbe17..2b07586 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
@@ -320,7 +320,6 @@ public class PersistentEphemeralNode implements Closeable
             }
             catch ( Exception e )
             {
-                log.error("Deleting node: " + localNodePath, e);
                 throw e;
             }
         }
@@ -341,8 +340,7 @@ public class PersistentEphemeralNode implements Closeable
         }
         catch ( Exception e )
         {
-            log.error("Creating node. BasePath: " + basePath, e);
-            throw new RuntimeException(e);  // should never happen unless there's a programming error - so throw RuntimeException
+            throw new RuntimeException("Creating node. BasePath: " + basePath, e);  // should never happen unless there's a programming error - so throw RuntimeException
         }
     }
 
@@ -362,7 +360,6 @@ public class PersistentEphemeralNode implements Closeable
             }
             catch ( Exception e )
             {
-                log.error("Watching node: " + localNodePath, e);
                 throw e;
             }
         }


[3/4] git commit: Merge branch 'CURATOR-71' of https://github.com/madrob/curator into CURATOR-71

Posted by ca...@apache.org.
Merge branch 'CURATOR-71' of https://github.com/madrob/curator into CURATOR-71


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

Branch: refs/heads/master
Commit: a83bf36217d06877305c873077e4a7421934e02d
Parents: 35278cc df87585
Author: Cam McKenzie <ca...@apache.org>
Authored: Tue Aug 5 13:46:37 2014 +1000
Committer: Cam McKenzie <ca...@apache.org>
Committed: Tue Aug 5 13:46:37 2014 +1000

----------------------------------------------------------------------
 .../src/main/java/org/apache/curator/ConnectionState.java           | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------



[2/4] git commit: CURATOR-71 do not log-and-throw

Posted by ca...@apache.org.
CURATOR-71 do not log-and-throw

If we throw an exception, then there is no point in logging it since
something further up the call stack already has to deal with it. At
best, the exception gets logged twice, at worst we log potentially
confusing exceptions that end up not mattering.


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

Branch: refs/heads/master
Commit: df87585c86106b5d2e7c309676cbf67c9537ee56
Parents: f5767c8
Author: Mike Drob <md...@cloudera.com>
Authored: Fri Aug 1 12:08:47 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Mon Aug 4 17:18:40 2014 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/curator/ConnectionState.java       | 1 -
 .../main/java/org/apache/curator/CuratorZookeeperClient.java    | 5 ++---
 .../org/apache/curator/framework/imps/CuratorFrameworkImpl.java | 5 ++---
 .../apache/curator/framework/recipes/leader/LeaderSelector.java | 1 -
 .../framework/recipes/locks/StandardLockInternalsDriver.java    | 1 -
 .../framework/recipes/nodes/PersistentEphemeralNode.java        | 5 +----
 6 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/df87585c/curator-client/src/main/java/org/apache/curator/ConnectionState.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/ConnectionState.java b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
index 756626f..d3900a1 100644
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@ -77,7 +77,6 @@ class ConnectionState implements Watcher, Closeable
         Exception exception = backgroundExceptions.poll();
         if ( exception != null )
         {
-            log.error("Background exception caught", exception);
             tracer.get().addCount("background-exceptions", 1);
             throw exception;
         }

http://git-wip-us.apache.org/repos/asf/curator/blob/df87585c/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
index f14214f..09b28b2 100644
--- a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
+++ b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
@@ -182,9 +182,8 @@ public class CuratorZookeeperClient implements Closeable
 
         if ( !started.compareAndSet(false, true) )
         {
-            IllegalStateException error = new IllegalStateException();
-            log.error("Already started", error);
-            throw error;
+            IllegalStateException ise = new IllegalStateException("Already started");
+            throw ise;
         }
 
         state.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/df87585c/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 01cacee..e86b1e5 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -233,9 +233,8 @@ public class CuratorFrameworkImpl implements CuratorFramework
         log.info("Starting");
         if ( !state.compareAndSet(CuratorFrameworkState.LATENT, CuratorFrameworkState.STARTED) )
         {
-            IllegalStateException error = new IllegalStateException();
-            log.error("Cannot be started more than once", error);
-            throw error;
+            IllegalStateException ise = new IllegalStateException("Cannot be started more than once");
+            throw ise;
         }
 
         try

http://git-wip-us.apache.org/repos/asf/curator/blob/df87585c/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
index e7b61f9..3be941a 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
@@ -418,7 +418,6 @@ public class LeaderSelector implements Closeable
         }
         catch ( Exception e )
         {
-            log.error("mutex.acquire() threw an exception", e);
             throw e;
         }
         finally

http://git-wip-us.apache.org/repos/asf/curator/blob/df87585c/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
index d225bbb..25f07b8 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/StandardLockInternalsDriver.java
@@ -61,7 +61,6 @@ public class StandardLockInternalsDriver implements LockInternalsDriver
     {
         if ( ourIndex < 0 )
         {
-            log.error("Sequential path not found: " + sequenceNodeName);
             throw new KeeperException.NoNodeException("Sequential path not found: " + sequenceNodeName);
         }
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/df87585c/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
index 08cbe17..2b07586 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
@@ -320,7 +320,6 @@ public class PersistentEphemeralNode implements Closeable
             }
             catch ( Exception e )
             {
-                log.error("Deleting node: " + localNodePath, e);
                 throw e;
             }
         }
@@ -341,8 +340,7 @@ public class PersistentEphemeralNode implements Closeable
         }
         catch ( Exception e )
         {
-            log.error("Creating node. BasePath: " + basePath, e);
-            throw new RuntimeException(e);  // should never happen unless there's a programming error - so throw RuntimeException
+            throw new RuntimeException("Creating node. BasePath: " + basePath, e);  // should never happen unless there's a programming error - so throw RuntimeException
         }
     }
 
@@ -362,7 +360,6 @@ public class PersistentEphemeralNode implements Closeable
             }
             catch ( Exception e )
             {
-                log.error("Watching node: " + localNodePath, e);
                 throw e;
             }
         }


[4/4] git commit: Merge branch 'CURATOR-71'

Posted by ca...@apache.org.
Merge branch 'CURATOR-71'


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

Branch: refs/heads/master
Commit: 3c1a4edc21431668ca9ca8bd4e8a782a2fd5d1b7
Parents: adb93c0 a83bf36
Author: Cam McKenzie <ca...@apache.org>
Authored: Tue Aug 5 13:48:10 2014 +1000
Committer: Cam McKenzie <ca...@apache.org>
Committed: Tue Aug 5 13:48:10 2014 +1000

----------------------------------------------------------------------
 .../src/main/java/org/apache/curator/ConnectionState.java       | 1 -
 .../main/java/org/apache/curator/CuratorZookeeperClient.java    | 5 ++---
 .../org/apache/curator/framework/imps/CuratorFrameworkImpl.java | 5 ++---
 .../apache/curator/framework/recipes/leader/LeaderSelector.java | 1 -
 .../framework/recipes/locks/StandardLockInternalsDriver.java    | 1 -
 .../framework/recipes/nodes/PersistentEphemeralNode.java        | 5 +----
 6 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------