curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [01/14] git commit: If mutex. acquire() throws a KeeperException.SessionExpiredException in LeaderSelector.doWork(), the exception is not handled in LeaderSelector.doWorkLoop(), causing the loop to terminate even when autoRequeue is true.
Date Thu, 20 Jun 2013 17:50:47 GMT
Updated Branches:
  refs/heads/master b766eb76a -> a95842651


If mutex. acquire() throws a KeeperException.SessionExpiredException in LeaderSelector.doWork(),
the exception is not handled in LeaderSelector.doWorkLoop(), causing the loop to terminate
even when autoRequeue is true.


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

Branch: refs/heads/master
Commit: 0c1af3bdd974cfbfc308783aed1afe743a3c1f62
Parents: aec1cfd
Author: randgalt <randgalt@apache.org>
Authored: Mon Jun 10 07:58:48 2013 -0700
Committer: randgalt <randgalt@apache.org>
Committed: Mon Jun 10 07:58:48 2013 -0700

----------------------------------------------------------------------
 .../framework/recipes/leader/LeaderSelector.java      | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/0c1af3bd/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 21d34c7..5c33622 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
@@ -370,22 +370,28 @@ public class LeaderSelector implements Closeable
     {
         do
         {
+            KeeperException exception = null;
             try
             {
                 doWork();
             }
             catch ( KeeperException.ConnectionLossException e )
             {
-                if ( !autoRequeue.get() )   // autoRequeue should ignore connection loss
and just keep trying
-                {
-                    throw e;
-                }
+                exception = e;
+            }
+            catch ( KeeperException.SessionExpiredException e )
+            {
+                exception = e;
             }
             catch ( InterruptedException ignore )
             {
                 Thread.currentThread().interrupt();
                 break;
             }
+            if ( (exception != null) && !autoRequeue.get() )   // autoRequeue should
ignore connection loss or session expired and just keep trying
+            {
+                throw exception;
+            }
         } while ( autoRequeue.get() && (state.get() == State.STARTED) &&
!Thread.currentThread().isInterrupted() );
     }
 


Mime
View raw message