本文整理了Java中org.apache.kylin.storage.hbase.util.ZookeeperAclBuilder.invoke()
方法的一些代码示例,展示了ZookeeperAclBuilder.invoke()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperAclBuilder.invoke()
方法的具体详情如下:
包路径:org.apache.kylin.storage.hbase.util.ZookeeperAclBuilder
类名称:ZookeeperAclBuilder
方法名:invoke
暂无
代码示例来源:origin: apache/kylin
private static CuratorFramework getZKClient(KylinConfig config) {
CuratorFramework zkClient = CACHE.get(config);
if (zkClient == null) {
synchronized (ZookeeperDistributedLock.class) {
zkClient = CACHE.get(config);
if (zkClient == null) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
String zkConnectString = getZKConnectString(config);
ZookeeperAclBuilder zookeeperAclBuilder = new ZookeeperAclBuilder().invoke();
zkClient = zookeeperAclBuilder.setZKAclBuilder(CuratorFrameworkFactory.builder()).connectString(zkConnectString).sessionTimeoutMs(120000).connectionTimeoutMs(15000).retryPolicy(retryPolicy).build();
zkClient.start();
CACHE.put(config, zkClient);
if (CACHE.size() > 1) {
logger.warn("More than one singleton exist");
}
}
}
}
return zkClient;
}
代码示例来源:origin: apache/kylin
@Test
public void testAclEnabled() {
KylinConfig testConfig = KylinConfig.getInstanceFromEnv();
testConfig.setProperty("kylin.env.zookeeper-acl-enabled", "true");
ZookeeperAclBuilder zookeeperAclBuilder = new ZookeeperAclBuilder().invoke();
Assert.assertNotNull(zookeeperAclBuilder);
Assert.assertTrue(zookeeperAclBuilder.isNeedAcl());
List<ACL> zkAcls = Lists.newArrayList();
try {
zkAcls = ZookeeperAclBuilder.getZKAcls();
Assert.assertFalse(zkAcls.isEmpty());
} catch (Exception e) {
fail("Couldn't read ACLs based on 'kylin.env.zookeeper.zk-acl' in kylin.properties");
}
List<ZKUtil.ZKAuthInfo> zkAuthInfo = Lists.newArrayList();
try {
zkAuthInfo = ZookeeperAclBuilder.getZKAuths();
Assert.assertFalse(zkAuthInfo.isEmpty());
} catch (Exception e) {
fail("Couldn't read Auth based on 'kylin.env.zookeeper.zk-auth' in kylin.properties");
}
Builder builder = zookeeperAclBuilder.setZKAclBuilder(CuratorFrameworkFactory.builder());
Assert.assertNotNull(builder);
Assert.assertEquals(zkAcls, builder.getAclProvider().getDefaultAcl());
Assert.assertNotNull(builder.getAuthInfos());
}
代码示例来源:origin: apache/kylin
@Test
public void testAclDisabled() {
KylinConfig testConfig = KylinConfig.getInstanceFromEnv();
testConfig.setProperty("kylin.env.zookeeper-acl-enabled", "false");
ZookeeperAclBuilder zookeeperAclBuilder = new ZookeeperAclBuilder().invoke();
Assert.assertNotNull(zookeeperAclBuilder);
Assert.assertFalse(zookeeperAclBuilder.isNeedAcl());
Builder builder = zookeeperAclBuilder.setZKAclBuilder(CuratorFrameworkFactory.builder());
Assert.assertNotNull(builder);
Assert.assertEquals(ZooDefs.Ids.OPEN_ACL_UNSAFE, builder.getAclProvider().getDefaultAcl());
Assert.assertNull(builder.getAuthInfos());
}
代码示例来源:origin: org.apache.kylin/kylin-storage-hbase
private static CuratorFramework getZKClient(KylinConfig config) {
CuratorFramework zkClient = CACHE.get(config);
if (zkClient == null) {
synchronized (ZookeeperDistributedLock.class) {
zkClient = CACHE.get(config);
if (zkClient == null) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
String zkConnectString = getZKConnectString(config);
ZookeeperAclBuilder zookeeperAclBuilder = new ZookeeperAclBuilder().invoke();
zkClient = zookeeperAclBuilder.setZKAclBuilder(CuratorFrameworkFactory.builder()).connectString(zkConnectString).sessionTimeoutMs(120000).connectionTimeoutMs(15000).retryPolicy(retryPolicy).build();
zkClient.start();
CACHE.put(config, zkClient);
if (CACHE.size() > 1) {
logger.warn("More than one singleton exist");
}
}
}
}
return zkClient;
}
内容来源于网络,如有侵权,请联系作者删除!