curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [2/3] curator git commit: Merge branch 'CURATOR-111' of https://github.com/kambatla/curator into CURATOR-111
Date Mon, 12 Jan 2015 21:03:59 GMT
Merge branch 'CURATOR-111' of https://github.com/kambatla/curator into CURATOR-111

Conflicts:
	curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
	curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java


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

Branch: refs/heads/master
Commit: 58ecd64f0b0b05590f2bcd350d17c173a5c791ab
Parents: 84699d3 71dc640
Author: randgalt <randgalt@apache.org>
Authored: Mon Jan 12 15:55:20 2015 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Mon Jan 12 15:55:20 2015 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/AuthInfo.java  | 51 ++++++++++++++++++++
 .../framework/CuratorFrameworkFactory.java      | 23 +++++++++
 .../framework/imps/CuratorFrameworkImpl.java    | 42 ++++++----------
 .../curator/framework/imps/TestFramework.java   | 44 +++++++++++++++++
 4 files changed, 132 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/58ecd64f/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/curator/blob/58ecd64f/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --cc curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index fc462d4,f7b08a6..c38617d
--- 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
@@@ -60,60 -60,36 +63,39 @@@ import java.util.concurrent.atomic.Atom
  
  public class CuratorFrameworkImpl implements CuratorFramework
  {
 -
 -    private final Logger                                                log = LoggerFactory.getLogger(getClass());
 -    private final CuratorZookeeperClient                                client;
 -    private final ListenerContainer<CuratorListener>                    listeners;
 -    private final ListenerContainer<UnhandledErrorListener>             unhandledErrorListeners;
 -    private final ThreadFactory                                         threadFactory;
 -    private final BlockingQueue<OperationAndData<?>>                    backgroundOperations;
 -    private final NamespaceImpl                                         namespace;
 -    private final ConnectionStateManager                                connectionStateManager;
 -    private final List<AuthInfo>                                        authInfos;
 -    private final byte[]                                                defaultData;
 -    private final FailedDeleteManager                                   failedDeleteManager;
 -    private final CompressionProvider                                   compressionProvider;
 -    private final ACLProvider                                           aclProvider;
 -    private final NamespaceFacadeCache                                  namespaceFacadeCache;
 -    private final NamespaceWatcherMap                                   namespaceWatcherMap
= new NamespaceWatcherMap(this);
 -
 -    private volatile ExecutorService                                    executorService;
 -    private final AtomicBoolean                                         logAsErrorConnectionErrors
= new AtomicBoolean(false);
 -
 -    private static final boolean                                        LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL
= !Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL);
 +    private final Logger log = LoggerFactory.getLogger(getClass());
 +    private final CuratorZookeeperClient client;
 +    private final ListenerContainer<CuratorListener> listeners;
 +    private final ListenerContainer<UnhandledErrorListener> unhandledErrorListeners;
 +    private final ThreadFactory threadFactory;
 +    private final int maxCloseWaitMs;
 +    private final BlockingQueue<OperationAndData<?>> backgroundOperations;
 +    private final NamespaceImpl namespace;
 +    private final ConnectionStateManager connectionStateManager;
-     private final AtomicReference<AuthInfo> authInfo = new AtomicReference<AuthInfo>();
++    private final List<AuthInfo> authInfos;
 +    private final byte[] defaultData;
 +    private final FailedDeleteManager failedDeleteManager;
 +    private final CompressionProvider compressionProvider;
 +    private final ACLProvider aclProvider;
 +    private final NamespaceFacadeCache namespaceFacadeCache;
 +    private final NamespaceWatcherMap namespaceWatcherMap = new NamespaceWatcherMap(this);
 +
 +    private volatile ExecutorService executorService;
 +    private final AtomicBoolean logAsErrorConnectionErrors = new AtomicBoolean(false);
 +
 +    private static final boolean LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = !Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL);
  
      interface DebugBackgroundListener
      {
 -        void        listen(OperationAndData<?> data);
 +        void listen(OperationAndData<?> data);
      }
 -    volatile DebugBackgroundListener        debugListener = null;
  
 -    private final AtomicReference<CuratorFrameworkState>                    state;
 +    volatile DebugBackgroundListener debugListener = null;
 +    @VisibleForTesting
 +    public volatile UnhandledErrorListener debugUnhandledErrorListener = null;
 +
 +    private final AtomicReference<CuratorFrameworkState> state;
  
-     private static class AuthInfo
-     {
-         final String scheme;
-         final byte[] auth;
- 
-         private AuthInfo(String scheme, byte[] auth)
-         {
-             this.scheme = scheme;
-             this.auth = auth;
-         }
- 
-         @Override
-         public String toString()
-         {
-             return "AuthInfo{" +
-                 "scheme='" + scheme + '\'' +
-                 ", auth=" + Arrays.toString(auth) +
-                 '}';
-         }
-     }
- 
      public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder)
      {
          ZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.getZookeeperFactory());
@@@ -138,12 -135,17 +120,17 @@@
          aclProvider = builder.getAclProvider();
          state = new AtomicReference<CuratorFrameworkState>(CuratorFrameworkState.LATENT);
  
 -        byte[]      builderDefaultData = builder.getDefaultData();
 +        byte[] builderDefaultData = builder.getDefaultData();
          defaultData = (builderDefaultData != null) ? Arrays.copyOf(builderDefaultData, builderDefaultData.length)
: new byte[0];
  
+         authInfos = new ArrayList<AuthInfo>();
          if ( builder.getAuthScheme() != null )
          {
-             authInfo.set(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
+             authInfos.add(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
+         }
+         if ( builder.getAuthInfos() != null )
+         {
+             authInfos.addAll(builder.getAuthInfos());
          }
  
          failedDeleteManager = new FailedDeleteManager(this);
@@@ -238,8 -226,9 +225,7 @@@
          log.info("Starting");
          if ( !state.compareAndSet(CuratorFrameworkState.LATENT, CuratorFrameworkState.STARTED)
)
          {
-             IllegalStateException ise = new IllegalStateException("Cannot be started more
than once");
-             throw ise;
 -            IllegalStateException error = new IllegalStateException();
 -            log.error("Cannot be started more than once", error);
 -            throw error;
++            throw new IllegalStateException("Cannot be started more than once");
          }
  
          try

http://git-wip-us.apache.org/repos/asf/curator/blob/58ecd64f/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --cc curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 5a640db,0f51b25..c98dd0f
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@@ -19,6 -19,9 +19,7 @@@
  package org.apache.curator.framework.imps;
  
  import com.google.common.collect.Lists;
+ import org.apache.curator.framework.AuthInfo;
 -import org.apache.curator.test.BaseClassForTests;
 -import org.apache.curator.utils.CloseableUtils;
  import org.apache.curator.framework.CuratorFramework;
  import org.apache.curator.framework.CuratorFrameworkFactory;
  import org.apache.curator.framework.api.BackgroundCallback;
@@@ -41,6 -43,8 +42,7 @@@ import org.apache.zookeeper.data.ACL
  import org.apache.zookeeper.data.Stat;
  import org.testng.Assert;
  import org.testng.annotations.Test;
 -
+ import java.util.ArrayList;
  import java.util.List;
  import java.util.concurrent.BlockingQueue;
  import java.util.concurrent.CountDownLatch;


Mime
View raw message