You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2018/06/07 15:54:38 UTC
[02/50] [abbrv] storm git commit: STORM-2882: Shaded zookeeper
STORM-2882: Shaded zookeeper
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/9b83b46d
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/9b83b46d
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/9b83b46d
Branch: refs/heads/master
Commit: 9b83b46d55acdf20f62cfec15800d1898f0efe19
Parents: 8a95784
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed May 16 09:51:47 2018 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Jun 6 15:43:12 2018 -0500
----------------------------------------------------------------------
shaded-deps/pom.xml | 17 ++++-
storm-client/pom.xml | 6 --
.../storm/callback/DefaultWatcherCallBack.java | 2 +-
.../apache/storm/callback/WatcherCallBack.java | 4 +-
.../storm/callback/ZKStateChangedCallback.java | 2 +-
.../storm/cluster/ClusterStateContext.java | 2 +-
.../org/apache/storm/cluster/ClusterUtils.java | 8 +-
.../org/apache/storm/cluster/DaemonType.java | 4 +-
.../org/apache/storm/cluster/IStateStorage.java | 2 +-
.../storm/cluster/PaceMakerStateStorage.java | 2 +-
.../storm/cluster/StormClusterStateImpl.java | 6 +-
.../apache/storm/cluster/ZKStateStorage.java | 8 +-
.../netty/KerberosSaslNettyServer.java | 2 +-
.../org/apache/storm/messaging/netty/Login.java | 4 +-
.../kerberos/KerberosSaslTransportPlugin.java | 2 +-
.../state/TestTransactionalState.java | 4 +-
.../transactional/state/TransactionalState.java | 6 +-
.../state/RotatingTransactionalState.java | 2 +-
.../topology/state/TestTransactionalState.java | 4 +-
.../topology/state/TransactionalState.java | 6 +-
.../org/apache/storm/utils/CuratorUtils.java | 2 +-
.../src/jvm/org/apache/storm/utils/Utils.java | 6 +-
.../storm/utils/ZookeeperServerCnxnFactory.java | 77 --------------------
.../apache/storm/zookeeper/ClientZookeeper.java | 15 ++--
.../apache/storm/zookeeper/ZkEventTypes.java | 2 +-
.../apache/storm/zookeeper/ZkKeeperStates.java | 2 +-
.../apache/storm/cluster/DaemonTypeTest.java | 6 +-
.../utils/ZookeeperServerCnxnFactoryTest.java | 34 ---------
storm-core/pom.xml | 4 -
.../test/clj/org/apache/storm/cluster_test.clj | 2 +-
storm-server/pom.xml | 5 --
.../apache/storm/blobstore/BlobStoreUtils.java | 5 +-
.../storm/blobstore/KeySequenceNumber.java | 6 +-
.../storm/blobstore/LocalFsBlobStore.java | 4 +-
.../org/apache/storm/daemon/nimbus/Nimbus.java | 7 +-
.../storm/nimbus/LeaderListenerCallback.java | 4 +-
.../storm/testing/InProcessZookeeper.java | 5 +-
.../storm/utils/ZookeeperServerCnxnFactory.java | 77 ++++++++++++++++++++
.../apache/storm/zookeeper/AclEnforcement.java | 10 +--
.../storm/zookeeper/LeaderElectorImp.java | 2 +-
.../org/apache/storm/zookeeper/Zookeeper.java | 6 +-
.../blobstore/MockZookeeperClientBuilder.java | 2 +-
.../utils/ZookeeperServerCnxnFactoryTest.java | 33 +++++++++
43 files changed, 201 insertions(+), 208 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/shaded-deps/pom.xml
----------------------------------------------------------------------
diff --git a/shaded-deps/pom.xml b/shaded-deps/pom.xml
index f60b524..7977cb1 100644
--- a/shaded-deps/pom.xml
+++ b/shaded-deps/pom.xml
@@ -38,7 +38,7 @@
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
+ <artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
@@ -49,12 +49,16 @@
<artifactId>curator-client</artifactId>
</dependency>
<!-- recipes are not used by the client, but storm server uses the same
- shaded curator instance so we need to include it here so we have a
+ shaded curator instance so we need to include it here so we have a
single ZK connection per daemon. -->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -77,8 +81,9 @@
<minimizeJar>false</minimizeJar>
<artifactSet>
<includes>
- <include>com.google.guava:guava</include>
- <include>org.apache.curator:*</include>
+ <include>com.google.guava:guava</include>
+ <include>org.apache.curator:*</include>
+ <include>org.apache.zookeeper:zookeeper</include>
</includes>
</artifactSet>
<relocations>
@@ -94,6 +99,10 @@
<pattern>org.apache.curator</pattern>
<shadedPattern>org.apache.storm.shade.org.apache.curator</shadedPattern>
</relocation>
+ <relocation>
+ <pattern>org.apache.zookeeper</pattern>
+ <shadedPattern>org.apache.storm.shade.org.apache.zookeeper</shadedPattern>
+ </relocation>
</relocations>
<filters>
<filter>
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/pom.xml
----------------------------------------------------------------------
diff --git a/storm-client/pom.xml b/storm-client/pom.xml
index 59a7e36..37ad5c7 100644
--- a/storm-client/pom.xml
+++ b/storm-client/pom.xml
@@ -146,12 +146,6 @@
<artifactId>kryo</artifactId>
</dependency>
- <!-- zookeeper -->
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- </dependency>
-
<!-- jgrapht -->
<dependency>
<groupId>org.jgrapht</groupId>
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/callback/DefaultWatcherCallBack.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/callback/DefaultWatcherCallBack.java b/storm-client/src/jvm/org/apache/storm/callback/DefaultWatcherCallBack.java
index 8da94fe..1b16fed 100644
--- a/storm-client/src/jvm/org/apache/storm/callback/DefaultWatcherCallBack.java
+++ b/storm-client/src/jvm/org/apache/storm/callback/DefaultWatcherCallBack.java
@@ -12,9 +12,9 @@
package org.apache.storm.callback;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
import org.apache.storm.zookeeper.ZkEventTypes;
import org.apache.storm.zookeeper.ZkKeeperStates;
-import org.apache.zookeeper.Watcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/callback/WatcherCallBack.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/callback/WatcherCallBack.java b/storm-client/src/jvm/org/apache/storm/callback/WatcherCallBack.java
index 22b6fc4..f6b548a 100644
--- a/storm-client/src/jvm/org/apache/storm/callback/WatcherCallBack.java
+++ b/storm-client/src/jvm/org/apache/storm/callback/WatcherCallBack.java
@@ -12,8 +12,8 @@
package org.apache.storm.callback;
-import org.apache.zookeeper.Watcher;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
public interface WatcherCallBack {
- public void execute(Watcher.Event.KeeperState state, Watcher.Event.EventType type, String path);
+ void execute(Watcher.Event.KeeperState state, Watcher.Event.EventType type, String path);
}
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/callback/ZKStateChangedCallback.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/callback/ZKStateChangedCallback.java b/storm-client/src/jvm/org/apache/storm/callback/ZKStateChangedCallback.java
index 6d2ecc9..08672fa 100644
--- a/storm-client/src/jvm/org/apache/storm/callback/ZKStateChangedCallback.java
+++ b/storm-client/src/jvm/org/apache/storm/callback/ZKStateChangedCallback.java
@@ -12,7 +12,7 @@
package org.apache.storm.callback;
-import org.apache.zookeeper.Watcher;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
public interface ZKStateChangedCallback {
public void changed(Watcher.Event.EventType type, String path);
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/ClusterStateContext.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/ClusterStateContext.java b/storm-client/src/jvm/org/apache/storm/cluster/ClusterStateContext.java
index 753f1f6..9f5f8c6 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/ClusterStateContext.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/ClusterStateContext.java
@@ -16,7 +16,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.storm.generated.WorkerTokenServiceType;
-import org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
/**
* This class is intended to provide runtime-context to StateStorageFactory implementors, giving information such as what daemon is creating
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/ClusterUtils.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/ClusterUtils.java b/storm-client/src/jvm/org/apache/storm/cluster/ClusterUtils.java
index 8141e5f..28d5afb 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/ClusterUtils.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/ClusterUtils.java
@@ -29,11 +29,11 @@ import org.apache.storm.generated.ExecutorInfo;
import org.apache.storm.generated.ExecutorStats;
import org.apache.storm.generated.ProfileAction;
import org.apache.storm.generated.WorkerTokenServiceType;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.Id;
+import org.apache.storm.shade.org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
import org.apache.storm.utils.Utils;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Id;
-import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
public class ClusterUtils {
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/DaemonType.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/DaemonType.java b/storm-client/src/jvm/org/apache/storm/cluster/DaemonType.java
index f33f1e8..27df05b 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/DaemonType.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/DaemonType.java
@@ -18,9 +18,9 @@ import java.util.Map;
import org.apache.storm.Config;
import org.apache.storm.generated.WorkerTokenServiceType;
import org.apache.storm.shade.com.google.common.annotations.VisibleForTesting;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.Utils;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/IStateStorage.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/IStateStorage.java b/storm-client/src/jvm/org/apache/storm/cluster/IStateStorage.java
index b73ba4e..0889a26 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/IStateStorage.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/IStateStorage.java
@@ -15,7 +15,7 @@ package org.apache.storm.cluster;
import java.util.List;
import org.apache.storm.callback.ZKStateChangedCallback;
import org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener;
-import org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
/**
* StateStorage provides the API for the pluggable state store used by the Storm daemons. Data is stored in path/value format, and the store
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/PaceMakerStateStorage.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/PaceMakerStateStorage.java b/storm-client/src/jvm/org/apache/storm/cluster/PaceMakerStateStorage.java
index 308c756..277a150 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/PaceMakerStateStorage.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/PaceMakerStateStorage.java
@@ -31,9 +31,9 @@ import org.apache.storm.generated.HBServerMessageType;
import org.apache.storm.pacemaker.PacemakerClientPool;
import org.apache.storm.pacemaker.PacemakerConnectionException;
import org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.Utils;
import org.apache.storm.utils.WrappedHBExecutionException;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java b/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java
index 9390a9b..93dbdb7 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/StormClusterStateImpl.java
@@ -43,11 +43,11 @@ import org.apache.storm.generated.SupervisorInfo;
import org.apache.storm.generated.WorkerTokenServiceType;
import org.apache.storm.nimbus.NimbusInfo;
import org.apache.storm.shade.org.apache.curator.framework.state.ConnectionState;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.Time;
import org.apache.storm.utils.Utils;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/cluster/ZKStateStorage.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/cluster/ZKStateStorage.java b/storm-client/src/jvm/org/apache/storm/cluster/ZKStateStorage.java
index eac64e9..2477f34 100644
--- a/storm-client/src/jvm/org/apache/storm/cluster/ZKStateStorage.java
+++ b/storm-client/src/jvm/org/apache/storm/cluster/ZKStateStorage.java
@@ -29,12 +29,12 @@ import org.apache.storm.callback.WatcherCallBack;
import org.apache.storm.callback.ZKStateChangedCallback;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.Utils;
import org.apache.storm.zookeeper.ClientZookeeper;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/messaging/netty/KerberosSaslNettyServer.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/messaging/netty/KerberosSaslNettyServer.java b/storm-client/src/jvm/org/apache/storm/messaging/netty/KerberosSaslNettyServer.java
index 38e899e..3321e8f 100644
--- a/storm-client/src/jvm/org/apache/storm/messaging/netty/KerberosSaslNettyServer.java
+++ b/storm-client/src/jvm/org/apache/storm/messaging/netty/KerberosSaslNettyServer.java
@@ -33,7 +33,7 @@ import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
import org.apache.storm.security.auth.ClientAuthUtils;
import org.apache.storm.security.auth.KerberosPrincipalToLocal;
-import org.apache.zookeeper.server.auth.KerberosName;
+import org.apache.storm.shade.org.apache.zookeeper.server.auth.KerberosName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/messaging/netty/Login.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/messaging/netty/Login.java b/storm-client/src/jvm/org/apache/storm/messaging/netty/Login.java
index 7eeb275..1530d37 100644
--- a/storm-client/src/jvm/org/apache/storm/messaging/netty/Login.java
+++ b/storm-client/src/jvm/org/apache/storm/messaging/netty/Login.java
@@ -31,8 +31,8 @@ import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.apache.log4j.Logger;
-import org.apache.zookeeper.Shell;
-import org.apache.zookeeper.client.ZooKeeperSaslClient;
+import org.apache.storm.shade.org.apache.zookeeper.Shell;
+import org.apache.storm.shade.org.apache.zookeeper.client.ZooKeeperSaslClient;
public class Login {
// Login will sleep until 80% of time from last refresh to
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/KerberosSaslTransportPlugin.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/KerberosSaslTransportPlugin.java b/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/KerberosSaslTransportPlugin.java
index 07602fa..a5c5c6b 100644
--- a/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/KerberosSaslTransportPlugin.java
+++ b/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/KerberosSaslTransportPlugin.java
@@ -35,12 +35,12 @@ import org.apache.storm.security.auth.sasl.SaslTransportPlugin;
import org.apache.storm.security.auth.sasl.SimpleSaslServerCallbackHandler;
import org.apache.storm.security.auth.workertoken.WorkerTokenAuthorizer;
import org.apache.storm.security.auth.workertoken.WorkerTokenClientCallbackHandler;
+import org.apache.storm.shade.org.apache.zookeeper.server.auth.KerberosName;
import org.apache.thrift.transport.TSaslClientTransport;
import org.apache.thrift.transport.TSaslServerTransport;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.apache.thrift.transport.TTransportFactory;
-import org.apache.zookeeper.server.auth.KerberosName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/transactional/state/TestTransactionalState.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/transactional/state/TestTransactionalState.java b/storm-client/src/jvm/org/apache/storm/transactional/state/TestTransactionalState.java
index f3f1774..af0bbf5 100644
--- a/storm-client/src/jvm/org/apache/storm/transactional/state/TestTransactionalState.java
+++ b/storm-client/src/jvm/org/apache/storm/transactional/state/TestTransactionalState.java
@@ -15,8 +15,8 @@ package org.apache.storm.transactional.state;
import java.util.List;
import java.util.Map;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
/**
* Facilitates testing of non-public methods in the parent class.
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/transactional/state/TransactionalState.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/transactional/state/TransactionalState.java b/storm-client/src/jvm/org/apache/storm/transactional/state/TransactionalState.java
index 02d4a9c..4ebbc66 100644
--- a/storm-client/src/jvm/org/apache/storm/transactional/state/TransactionalState.java
+++ b/storm-client/src/jvm/org/apache/storm/transactional/state/TransactionalState.java
@@ -23,12 +23,12 @@ import org.apache.storm.serialization.KryoValuesSerializer;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.api.PathAndBytesable;
import org.apache.storm.shade.org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.CuratorUtils;
import org.apache.storm.utils.Utils;
import org.apache.storm.utils.ZookeeperAuthInfo;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/trident/topology/state/RotatingTransactionalState.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/trident/topology/state/RotatingTransactionalState.java b/storm-client/src/jvm/org/apache/storm/trident/topology/state/RotatingTransactionalState.java
index 89eeda9..81db7fa 100644
--- a/storm-client/src/jvm/org/apache/storm/trident/topology/state/RotatingTransactionalState.java
+++ b/storm-client/src/jvm/org/apache/storm/trident/topology/state/RotatingTransactionalState.java
@@ -16,8 +16,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
import org.apache.storm.utils.Utils;
-import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/trident/topology/state/TestTransactionalState.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/trident/topology/state/TestTransactionalState.java b/storm-client/src/jvm/org/apache/storm/trident/topology/state/TestTransactionalState.java
index 84f7a3d..ebcabaa 100644
--- a/storm-client/src/jvm/org/apache/storm/trident/topology/state/TestTransactionalState.java
+++ b/storm-client/src/jvm/org/apache/storm/trident/topology/state/TestTransactionalState.java
@@ -15,8 +15,8 @@ package org.apache.storm.trident.topology.state;
import java.util.List;
import java.util.Map;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
/**
* Facilitates testing of non-public methods in the parent class.
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/trident/topology/state/TransactionalState.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/trident/topology/state/TransactionalState.java b/storm-client/src/jvm/org/apache/storm/trident/topology/state/TransactionalState.java
index 5fec886..b86f82b 100644
--- a/storm-client/src/jvm/org/apache/storm/trident/topology/state/TransactionalState.java
+++ b/storm-client/src/jvm/org/apache/storm/trident/topology/state/TransactionalState.java
@@ -23,12 +23,12 @@ import org.apache.storm.cluster.DaemonType;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.api.PathAndBytesable;
import org.apache.storm.shade.org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.CuratorUtils;
import org.apache.storm.utils.Utils;
import org.apache.storm.utils.ZookeeperAuthInfo;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.ACL;
import org.json.simple.JSONValue;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/utils/CuratorUtils.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/utils/CuratorUtils.java b/storm-client/src/jvm/org/apache/storm/utils/CuratorUtils.java
index bb9c2da..a187b0a 100644
--- a/storm-client/src/jvm/org/apache/storm/utils/CuratorUtils.java
+++ b/storm-client/src/jvm/org/apache/storm/utils/CuratorUtils.java
@@ -29,7 +29,7 @@ import org.apache.storm.shade.org.apache.curator.ensemble.exhibitor.Exhibitors;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.storm.shade.org.apache.curator.framework.api.ACLProvider;
-import org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/utils/Utils.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/utils/Utils.java b/storm-client/src/jvm/org/apache/storm/utils/Utils.java
index 2dc66f2..051df17 100644
--- a/storm-client/src/jvm/org/apache/storm/utils/Utils.java
+++ b/storm-client/src/jvm/org/apache/storm/utils/Utils.java
@@ -89,13 +89,13 @@ import org.apache.storm.shade.com.google.common.annotations.VisibleForTesting;
import org.apache.storm.shade.com.google.common.collect.Lists;
import org.apache.storm.shade.com.google.common.collect.MapDifference;
import org.apache.storm.shade.com.google.common.collect.Maps;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.Id;
import org.apache.thrift.TBase;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.TException;
import org.apache.thrift.TSerializer;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Id;
import org.json.simple.JSONValue;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactory.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactory.java b/storm-client/src/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactory.java
deleted file mode 100644
index 565def7f..0000000
--- a/storm-client/src/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactory.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- */
-
-package org.apache.storm.utils;
-
-import java.io.IOException;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ZookeeperServerCnxnFactory {
- private static final Logger LOG = LoggerFactory.getLogger(ZookeeperServerCnxnFactory.class);
- int _port;
- NIOServerCnxnFactory _factory;
-
- public ZookeeperServerCnxnFactory(int port, int maxClientCnxns) {
- //port range
- int max;
- if (port <= 0) {
- _port = 2000;
- max = 65535;
- } else {
- _port = port;
- max = port;
- }
-
- try {
- _factory = new NIOServerCnxnFactory();
- } catch (IOException e) {
- _port = 0;
- _factory = null;
- e.printStackTrace();
- throw new RuntimeException(e.getMessage());
- }
-
- //look for available port
- for (; _port <= max; _port++) {
- try {
- _factory.configure(new InetSocketAddress(_port), maxClientCnxns);
- LOG.debug("Zookeeper server successfully binded at port " + _port);
- break;
- } catch (BindException e1) {
- } catch (IOException e2) {
- _port = 0;
- _factory = null;
- e2.printStackTrace();
- throw new RuntimeException(e2.getMessage());
- }
- }
-
- if (_port > max) {
- _port = 0;
- _factory = null;
- LOG.error("Failed to find a port for Zookeeper");
- throw new RuntimeException("No port is available to launch an inprocess zookeeper.");
- }
- }
-
- public int port() {
- return _port;
- }
-
- public NIOServerCnxnFactory factory() {
- return _factory;
- }
-}
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/zookeeper/ClientZookeeper.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/zookeeper/ClientZookeeper.java b/storm-client/src/jvm/org/apache/storm/zookeeper/ClientZookeeper.java
index bbf6e24..382b2da 100644
--- a/storm-client/src/jvm/org/apache/storm/zookeeper/ClientZookeeper.java
+++ b/storm-client/src/jvm/org/apache/storm/zookeeper/ClientZookeeper.java
@@ -29,13 +29,14 @@ import org.apache.storm.shade.org.apache.curator.framework.api.CuratorEvent;
import org.apache.storm.shade.org.apache.curator.framework.api.CuratorEventType;
import org.apache.storm.shade.org.apache.curator.framework.api.CuratorListener;
import org.apache.storm.shade.org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.WatchedEvent;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.Stat;
import org.apache.storm.utils.CuratorUtils;
import org.apache.storm.utils.Utils;
import org.apache.storm.utils.ZookeeperAuthInfo;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -90,7 +91,7 @@ public class ClientZookeeper {
}
}
- public static String createNode(CuratorFramework zk, String path, byte[] data, org.apache.zookeeper.CreateMode mode, List<ACL> acls) {
+ public static String createNode(CuratorFramework zk, String path, byte[] data, CreateMode mode, List<ACL> acls) {
String ret = null;
try {
String npath = normalizePath(path);
@@ -102,7 +103,7 @@ public class ClientZookeeper {
}
public static String createNode(CuratorFramework zk, String path, byte[] data, List<ACL> acls) {
- return createNode(zk, path, data, org.apache.zookeeper.CreateMode.PERSISTENT, acls);
+ return createNode(zk, path, data, CreateMode.PERSISTENT, acls);
}
public static List<String> tokenizePath(String path) {
@@ -290,7 +291,7 @@ public class ClientZookeeper {
byte[] byteArray = new byte[1];
byteArray[0] = (byte) 7;
try {
- ClientZookeeper.createNode(zk, npath, byteArray, org.apache.zookeeper.CreateMode.PERSISTENT, acls);
+ ClientZookeeper.createNode(zk, npath, byteArray, CreateMode.PERSISTENT, acls);
} catch (Exception e) {
if (Utils.exceptionCauseIsInstanceOf(KeeperException.NodeExistsException.class, e)) {
// this can happen when multiple clients doing mkdir at same time
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/zookeeper/ZkEventTypes.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/zookeeper/ZkEventTypes.java b/storm-client/src/jvm/org/apache/storm/zookeeper/ZkEventTypes.java
index d2ba17b..1ec6d2d 100644
--- a/storm-client/src/jvm/org/apache/storm/zookeeper/ZkEventTypes.java
+++ b/storm-client/src/jvm/org/apache/storm/zookeeper/ZkEventTypes.java
@@ -13,7 +13,7 @@
package org.apache.storm.zookeeper;
import java.util.HashMap;
-import org.apache.zookeeper.Watcher;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
public class ZkEventTypes {
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/src/jvm/org/apache/storm/zookeeper/ZkKeeperStates.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/zookeeper/ZkKeeperStates.java b/storm-client/src/jvm/org/apache/storm/zookeeper/ZkKeeperStates.java
index 8f7b4c0..48b0ea1 100644
--- a/storm-client/src/jvm/org/apache/storm/zookeeper/ZkKeeperStates.java
+++ b/storm-client/src/jvm/org/apache/storm/zookeeper/ZkKeeperStates.java
@@ -13,7 +13,7 @@
package org.apache.storm.zookeeper;
import java.util.HashMap;
-import org.apache.zookeeper.Watcher;
+import org.apache.storm.shade.org.apache.zookeeper.Watcher;
public class ZkKeeperStates {
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/test/jvm/org/apache/storm/cluster/DaemonTypeTest.java
----------------------------------------------------------------------
diff --git a/storm-client/test/jvm/org/apache/storm/cluster/DaemonTypeTest.java b/storm-client/test/jvm/org/apache/storm/cluster/DaemonTypeTest.java
index 969a92b..53ddb35 100644
--- a/storm-client/test/jvm/org/apache/storm/cluster/DaemonTypeTest.java
+++ b/storm-client/test/jvm/org/apache/storm/cluster/DaemonTypeTest.java
@@ -17,10 +17,10 @@ import java.util.List;
import java.util.Map;
import org.apache.storm.Config;
import org.apache.storm.security.auth.DefaultPrincipalToLocal;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.Id;
import org.apache.storm.utils.ConfigUtils;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Id;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-client/test/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java
----------------------------------------------------------------------
diff --git a/storm-client/test/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java b/storm-client/test/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java
deleted file mode 100644
index deae29c..0000000
--- a/storm-client/test/jvm/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- */
-
-package org.apache.storm.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class ZookeeperServerCnxnFactoryTest {
-
- @Test(expected = RuntimeException.class)
- public void test_Exception_In_Constructor_If_Port_Too_Large() {
- new ZookeeperServerCnxnFactory(65536, 42);
- }
-
- @Test
- public void testFactory() {
- int arbitraryTestClients = 42;
- ZookeeperServerCnxnFactory zkcfNegative = new ZookeeperServerCnxnFactory(-42, arbitraryTestClients);
- int nextPort = zkcfNegative.port() + 1;
- ZookeeperServerCnxnFactory zkcfNext = new ZookeeperServerCnxnFactory(nextPort, arbitraryTestClients);
- Assert.assertEquals(zkcfNext.factory().getMaxClientCnxnsPerHost(), arbitraryTestClients);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-core/pom.xml
----------------------------------------------------------------------
diff --git a/storm-core/pom.xml b/storm-core/pom.xml
index 44b9212..3619660 100644
--- a/storm-core/pom.xml
+++ b/storm-core/pom.xml
@@ -194,10 +194,6 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-core/test/clj/org/apache/storm/cluster_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/org/apache/storm/cluster_test.clj b/storm-core/test/clj/org/apache/storm/cluster_test.clj
index 65d95dc..7a34fbf 100644
--- a/storm-core/test/clj/org/apache/storm/cluster_test.clj
+++ b/storm-core/test/clj/org/apache/storm/cluster_test.clj
@@ -17,7 +17,7 @@
(:import [java.util Arrays]
[org.apache.storm.nimbus NimbusInfo])
(:import [org.apache.storm.generated SupervisorInfo StormBase Assignment NimbusSummary TopologyStatus NodeInfo Credentials])
- (:import [org.apache.zookeeper ZooDefs ZooDefs$Ids Watcher$Event$EventType])
+ (:import [org.apache.storm.shade.org.apache.zookeeper ZooDefs ZooDefs$Ids Watcher$Event$EventType])
(:import [org.mockito Mockito])
(:import [org.mockito.exceptions.base MockitoAssertionError])
(:import [org.apache.storm.shade.org.apache.curator.framework CuratorFramework CuratorFrameworkFactory CuratorFrameworkFactory$Builder])
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/pom.xml
----------------------------------------------------------------------
diff --git a/storm-server/pom.xml b/storm-server/pom.xml
index c5ab387..24a478c 100644
--- a/storm-server/pom.xml
+++ b/storm-server/pom.xml
@@ -43,11 +43,6 @@
when user needs to include 'storm-server' to topology jar due to LocalCluster.
-->
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- </dependency>
-
- <dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/blobstore/BlobStoreUtils.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/blobstore/BlobStoreUtils.java b/storm-server/src/main/java/org/apache/storm/blobstore/BlobStoreUtils.java
index a51223c..691956d 100644
--- a/storm-server/src/main/java/org/apache/storm/blobstore/BlobStoreUtils.java
+++ b/storm-server/src/main/java/org/apache/storm/blobstore/BlobStoreUtils.java
@@ -30,13 +30,12 @@ import org.apache.storm.generated.ReadableBlobMeta;
import org.apache.storm.nimbus.NimbusInfo;
import org.apache.storm.security.auth.NimbusPrincipal;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
import org.apache.storm.utils.CuratorUtils;
import org.apache.storm.utils.NimbusClient;
import org.apache.storm.utils.WrappedKeyNotFoundException;
import org.apache.storm.utils.ZookeeperAuthInfo;
import org.apache.thrift.transport.TTransportException;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -266,7 +265,7 @@ public class BlobStoreUtils {
LOG.debug("Updating state inside zookeeper for an update");
createStateInZookeeper(conf, key, nimbusDetails);
}
- } catch (NoNodeException | KeyNotFoundException e) {
+ } catch (KeeperException.NoNodeException | KeyNotFoundException e) {
//race condition with a delete
return;
} catch (Exception exp) {
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/blobstore/KeySequenceNumber.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/blobstore/KeySequenceNumber.java b/storm-server/src/main/java/org/apache/storm/blobstore/KeySequenceNumber.java
index 4dce22e..611d33c 100644
--- a/storm-server/src/main/java/org/apache/storm/blobstore/KeySequenceNumber.java
+++ b/storm-server/src/main/java/org/apache/storm/blobstore/KeySequenceNumber.java
@@ -19,9 +19,9 @@ import org.apache.storm.generated.KeyNotFoundException;
import org.apache.storm.nimbus.NimbusInfo;
import org.apache.storm.utils.WrappedKeyNotFoundException;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/blobstore/LocalFsBlobStore.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/blobstore/LocalFsBlobStore.java b/storm-server/src/main/java/org/apache/storm/blobstore/LocalFsBlobStore.java
index 4b10cd6..423a7a3 100644
--- a/storm-server/src/main/java/org/apache/storm/blobstore/LocalFsBlobStore.java
+++ b/storm-server/src/main/java/org/apache/storm/blobstore/LocalFsBlobStore.java
@@ -42,12 +42,12 @@ import org.apache.storm.generated.SettableBlobMeta;
import org.apache.storm.nimbus.ILeaderElector;
import org.apache.storm.nimbus.NimbusInfo;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
import org.apache.storm.utils.ConfigUtils;
import org.apache.storm.utils.ObjectReader;
import org.apache.storm.utils.Utils;
import org.apache.storm.utils.WrappedKeyAlreadyExistsException;
import org.apache.storm.utils.WrappedKeyNotFoundException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -424,7 +424,7 @@ public class LocalFsBlobStore extends BlobStore {
}
try {
replicationCount = zkClient.getChildren().forPath(BLOBSTORE_SUBTREE + key).size();
- } catch (NoNodeException e) {
+ } catch (KeeperException.NoNodeException e) {
//Race with delete
//If it is not here the replication is 0
}
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
index fc157a0..4a33d77 100644
--- a/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
+++ b/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
@@ -181,6 +181,8 @@ import org.apache.storm.security.auth.ThriftConnectionType;
import org.apache.storm.security.auth.ThriftServer;
import org.apache.storm.security.auth.workertoken.WorkerTokenManager;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.stats.StatsUtil;
import org.apache.storm.utils.BufferInputStream;
import org.apache.storm.utils.ConfigUtils;
@@ -206,16 +208,13 @@ import org.apache.storm.zookeeper.AclEnforcement;
import org.apache.storm.zookeeper.ClientZookeeper;
import org.apache.storm.zookeeper.Zookeeper;
import org.apache.thrift.TException;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
import org.json.simple.JSONValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Nimbus implements Iface, Shutdownable, DaemonCommon {
@VisibleForTesting
- public static final List<ACL> ZK_ACLS = Arrays.asList(ZooDefs.Ids.CREATOR_ALL_ACL.get(0),
- new ACL(ZooDefs.Perms.READ | ZooDefs.Perms.CREATE, ZooDefs.Ids.ANYONE_ID_UNSAFE));
+ public static final List<ACL> ZK_ACLS = Arrays.asList(ZooDefs.Ids.CREATOR_ALL_ACL.get(0));
public static final SimpleVersion MIN_VERSION_SUPPORT_RPC_HEARTBEAT = new SimpleVersion("2.0.0");
private static final Logger LOG = LoggerFactory.getLogger(Nimbus.class);
// Metrics
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/nimbus/LeaderListenerCallback.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/nimbus/LeaderListenerCallback.java b/storm-server/src/main/java/org/apache/storm/nimbus/LeaderListenerCallback.java
index 0035854..590cb13 100644
--- a/storm-server/src/main/java/org/apache/storm/nimbus/LeaderListenerCallback.java
+++ b/storm-server/src/main/java/org/apache/storm/nimbus/LeaderListenerCallback.java
@@ -34,10 +34,10 @@ import org.apache.storm.generated.StormTopology;
import org.apache.storm.security.auth.ReqContext;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.LeaderLatch;
+import org.apache.storm.shade.org.apache.zookeeper.CreateMode;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.Utils;
import org.apache.storm.zookeeper.ClientZookeeper;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/testing/InProcessZookeeper.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/testing/InProcessZookeeper.java b/storm-server/src/main/java/org/apache/storm/testing/InProcessZookeeper.java
index c18edcc..c3265df 100644
--- a/storm-server/src/main/java/org/apache/storm/testing/InProcessZookeeper.java
+++ b/storm-server/src/main/java/org/apache/storm/testing/InProcessZookeeper.java
@@ -12,15 +12,16 @@
package org.apache.storm.testing;
-import java.util.List;
+import org.apache.storm.shade.org.apache.zookeeper.server.NIOServerCnxnFactory;
import org.apache.storm.zookeeper.Zookeeper;
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
/**
* A local Zookeeper instance available for testing.
+ * ```java
* try (InProcessZookeeper zk = new InProcessZookeeper) {
* // Run Tests...
* }
+ * ```
*/
public class InProcessZookeeper implements AutoCloseable {
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/utils/ZookeeperServerCnxnFactory.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/utils/ZookeeperServerCnxnFactory.java b/storm-server/src/main/java/org/apache/storm/utils/ZookeeperServerCnxnFactory.java
new file mode 100644
index 0000000..eb7019e
--- /dev/null
+++ b/storm-server/src/main/java/org/apache/storm/utils/ZookeeperServerCnxnFactory.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+package org.apache.storm.utils;
+
+import java.io.IOException;
+import java.net.BindException;
+import java.net.InetSocketAddress;
+import org.apache.storm.shade.org.apache.zookeeper.server.NIOServerCnxnFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ZookeeperServerCnxnFactory {
+ private static final Logger LOG = LoggerFactory.getLogger(ZookeeperServerCnxnFactory.class);
+ int _port;
+ NIOServerCnxnFactory _factory;
+
+ public ZookeeperServerCnxnFactory(int port, int maxClientCnxns) {
+ //port range
+ int max;
+ if (port <= 0) {
+ _port = 2000;
+ max = 65535;
+ } else {
+ _port = port;
+ max = port;
+ }
+
+ try {
+ _factory = new NIOServerCnxnFactory();
+ } catch (IOException e) {
+ _port = 0;
+ _factory = null;
+ e.printStackTrace();
+ throw new RuntimeException(e.getMessage());
+ }
+
+ //look for available port
+ for (; _port <= max; _port++) {
+ try {
+ _factory.configure(new InetSocketAddress(_port), maxClientCnxns);
+ LOG.debug("Zookeeper server successfully binded at port " + _port);
+ break;
+ } catch (BindException e1) {
+ } catch (IOException e2) {
+ _port = 0;
+ _factory = null;
+ e2.printStackTrace();
+ throw new RuntimeException(e2.getMessage());
+ }
+ }
+
+ if (_port > max) {
+ _port = 0;
+ _factory = null;
+ LOG.error("Failed to find a port for Zookeeper");
+ throw new RuntimeException("No port is available to launch an inprocess zookeeper.");
+ }
+ }
+
+ public int port() {
+ return _port;
+ }
+
+ public NIOServerCnxnFactory factory() {
+ return _factory;
+ }
+}
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/zookeeper/AclEnforcement.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/zookeeper/AclEnforcement.java b/storm-server/src/main/java/org/apache/storm/zookeeper/AclEnforcement.java
index 7a8e3e3..9c02b03 100644
--- a/storm-server/src/main/java/org/apache/storm/zookeeper/AclEnforcement.java
+++ b/storm-server/src/main/java/org/apache/storm/zookeeper/AclEnforcement.java
@@ -31,14 +31,14 @@ import org.apache.storm.generated.WorkerTokenServiceType;
import org.apache.storm.nimbus.NimbusInfo;
import org.apache.storm.security.auth.NimbusPrincipal;
import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
+import org.apache.storm.shade.org.apache.zookeeper.KeeperException;
+import org.apache.storm.shade.org.apache.zookeeper.ZooDefs;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.data.Id;
+import org.apache.storm.shade.org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
import org.apache.storm.utils.ObjectReader;
import org.apache.storm.utils.ServerUtils;
import org.apache.storm.utils.Utils;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Id;
-import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/zookeeper/LeaderElectorImp.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/zookeeper/LeaderElectorImp.java b/storm-server/src/main/java/org/apache/storm/zookeeper/LeaderElectorImp.java
index bed2183..03fec1f 100644
--- a/storm-server/src/main/java/org/apache/storm/zookeeper/LeaderElectorImp.java
+++ b/storm-server/src/main/java/org/apache/storm/zookeeper/LeaderElectorImp.java
@@ -27,8 +27,8 @@ import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.LeaderLatchListener;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.Participant;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
import org.apache.storm.utils.Utils;
-import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/main/java/org/apache/storm/zookeeper/Zookeeper.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/zookeeper/Zookeeper.java b/storm-server/src/main/java/org/apache/storm/zookeeper/Zookeeper.java
index 82e97a6..f30c246 100644
--- a/storm-server/src/main/java/org/apache/storm/zookeeper/Zookeeper.java
+++ b/storm-server/src/main/java/org/apache/storm/zookeeper/Zookeeper.java
@@ -38,9 +38,9 @@ import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.LeaderLatchListener;
import org.apache.storm.shade.org.apache.curator.framework.recipes.leader.Participant;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
-import org.apache.zookeeper.server.ZooKeeperServer;
+import org.apache.storm.shade.org.apache.zookeeper.data.ACL;
+import org.apache.storm.shade.org.apache.zookeeper.server.NIOServerCnxnFactory;
+import org.apache.storm.shade.org.apache.zookeeper.server.ZooKeeperServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/test/java/org/apache/storm/blobstore/MockZookeeperClientBuilder.java
----------------------------------------------------------------------
diff --git a/storm-server/src/test/java/org/apache/storm/blobstore/MockZookeeperClientBuilder.java b/storm-server/src/test/java/org/apache/storm/blobstore/MockZookeeperClientBuilder.java
index 536beb2..19cdfed 100644
--- a/storm-server/src/test/java/org/apache/storm/blobstore/MockZookeeperClientBuilder.java
+++ b/storm-server/src/test/java/org/apache/storm/blobstore/MockZookeeperClientBuilder.java
@@ -19,7 +19,7 @@ import org.apache.storm.shade.org.apache.curator.framework.CuratorFramework;
import org.apache.storm.shade.org.apache.curator.framework.api.ExistsBuilder;
import org.apache.storm.shade.org.apache.curator.framework.api.GetChildrenBuilder;
import org.apache.storm.shade.org.apache.curator.framework.api.Pathable;
-import org.apache.zookeeper.data.Stat;
+import org.apache.storm.shade.org.apache.zookeeper.data.Stat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
http://git-wip-us.apache.org/repos/asf/storm/blob/9b83b46d/storm-server/src/test/java/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java
----------------------------------------------------------------------
diff --git a/storm-server/src/test/java/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java b/storm-server/src/test/java/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java
new file mode 100644
index 0000000..cfc9acb
--- /dev/null
+++ b/storm-server/src/test/java/org/apache/storm/utils/ZookeeperServerCnxnFactoryTest.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+package org.apache.storm.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ZookeeperServerCnxnFactoryTest {
+
+ @Test(expected = RuntimeException.class)
+ public void test_Exception_In_Constructor_If_Port_Too_Large() {
+ new ZookeeperServerCnxnFactory(65536, 42);
+ }
+
+ @Test
+ public void testFactory() {
+ int arbitraryTestClients = 42;
+ ZookeeperServerCnxnFactory zkcfNegative = new ZookeeperServerCnxnFactory(-42, arbitraryTestClients);
+ int nextPort = zkcfNegative.port() + 1;
+ ZookeeperServerCnxnFactory zkcfNext = new ZookeeperServerCnxnFactory(nextPort, arbitraryTestClients);
+ Assert.assertEquals(zkcfNext.factory().getMaxClientCnxnsPerHost(), arbitraryTestClients);
+ }
+}