You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/01/26 14:41:35 UTC
[09/16] flink git commit: [hotfix] Fix checkstyle violations in
ZooKeeperUtils
[hotfix] Fix checkstyle violations in ZooKeeperUtils
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/60f98df6
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/60f98df6
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/60f98df6
Branch: refs/heads/master
Commit: 60f98df63cb2ec2533e4eee1969a6d7917ac1521
Parents: c4ca863
Author: gyao <ga...@data-artisans.com>
Authored: Mon Jan 15 12:13:48 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Jan 26 13:50:22 2018 +0100
----------------------------------------------------------------------
.../flink/runtime/util/ZooKeeperUtils.java | 40 +++++++++-----------
1 file changed, 17 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/60f98df6/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
index a7ac500..43c930e 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
@@ -18,12 +18,6 @@
package org.apache.flink.runtime.util;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.api.ACLProvider;
-import org.apache.curator.framework.imps.DefaultACLProvider;
-import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.flink.api.common.JobID;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.HighAvailabilityOptions;
@@ -41,6 +35,13 @@ import org.apache.flink.runtime.leaderretrieval.ZooKeeperLeaderRetrievalService;
import org.apache.flink.runtime.zookeeper.RetrievableStateStorageHelper;
import org.apache.flink.runtime.zookeeper.filesystem.FileSystemStateStorageHelper;
import org.apache.flink.util.Preconditions;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.ACLProvider;
+import org.apache.curator.framework.imps.DefaultACLProvider;
+import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
@@ -92,14 +93,14 @@ public class ZooKeeperUtils {
ZkClientACLMode aclMode = ZkClientACLMode.fromConfig(configuration);
- if(disableSaslClient && aclMode == ZkClientACLMode.CREATOR) {
- String errorMessage = "Cannot set ACL role to " + aclMode +" since SASL authentication is " +
+ if (disableSaslClient && aclMode == ZkClientACLMode.CREATOR) {
+ String errorMessage = "Cannot set ACL role to " + aclMode + " since SASL authentication is " +
"disabled through the " + SecurityOptions.ZOOKEEPER_SASL_DISABLE.key() + " property";
LOG.warn(errorMessage);
throw new IllegalConfigurationException(errorMessage);
}
- if(aclMode == ZkClientACLMode.CREATOR) {
+ if (aclMode == ZkClientACLMode.CREATOR) {
LOG.info("Enforcing creator for ZK connections");
aclProvider = new SecureAclProvider();
} else {
@@ -107,7 +108,6 @@ public class ZooKeeperUtils {
aclProvider = new DefaultACLProvider();
}
-
String rootWithNamespace = generateZookeeperPath(root, namespace);
LOG.info("Using '{}' as Zookeeper namespace.", rootWithNamespace);
@@ -181,8 +181,7 @@ public class ZooKeeperUtils {
public static ZooKeeperLeaderRetrievalService createLeaderRetrievalService(
final CuratorFramework client,
final Configuration configuration,
- final String pathSuffix)
- {
+ final String pathSuffix) {
String leaderPath = configuration.getString(
HighAvailabilityOptions.HA_ZOOKEEPER_LEADER_PATH) + pathSuffix;
@@ -212,10 +211,9 @@ public class ZooKeeperUtils {
* @return {@link ZooKeeperLeaderElectionService} instance.
*/
public static ZooKeeperLeaderElectionService createLeaderElectionService(
- final CuratorFramework client,
- final Configuration configuration,
- final String pathSuffix)
- {
+ final CuratorFramework client,
+ final Configuration configuration,
+ final String pathSuffix) {
final String latchPath = configuration.getString(
HighAvailabilityOptions.HA_ZOOKEEPER_LATCH_PATH) + pathSuffix;
final String leaderPath = configuration.getString(
@@ -346,18 +344,14 @@ public class ZooKeeperUtils {
return root + namespace;
}
-
- public static class SecureAclProvider implements ACLProvider
- {
+ public static class SecureAclProvider implements ACLProvider {
@Override
- public List<ACL> getDefaultAcl()
- {
+ public List<ACL> getDefaultAcl() {
return ZooDefs.Ids.CREATOR_ALL_ACL;
}
@Override
- public List<ACL> getAclForPath(String path)
- {
+ public List<ACL> getAclForPath(String path) {
return ZooDefs.Ids.CREATOR_ALL_ACL;
}
}