本文整理了Java中org.apache.zookeeper.ZooKeeper.getSessionPasswd()
方法的一些代码示例,展示了ZooKeeper.getSessionPasswd()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeper.getSessionPasswd()
方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeper
类名称:ZooKeeper
方法名:getSessionPasswd
[英]The session password for this ZooKeeper client instance. The value returned is not valid until the client connects to a server and may change after a re-connect. This method is NOT thread safe
[中]此ZooKeeper客户端实例的会话密码。在客户端连接到服务器之前,返回的值无效,重新连接后可能会更改。此方法不是线程安全的
代码示例来源:origin: apache/hbase
public synchronized byte[] getSessionPasswd() {
return zk == null ? null : zk.getSessionPasswd();
}
代码示例来源:origin: twitter/distributedlog
private void expireZooKeeperSession(ZooKeeper zk, int timeout)
throws IOException, InterruptedException, KeeperException {
final CountDownLatch latch = new CountDownLatch(1);
ZooKeeper newZk = new ZooKeeper(zkServers, timeout, new Watcher() {
@Override
public void process(WatchedEvent event) {
if (event.getType() == EventType.None && event.getState() == KeeperState.SyncConnected) {
latch.countDown();
}
}},
zk.getSessionId(),
zk.getSessionPasswd());
if (!latch.await(timeout, TimeUnit.MILLISECONDS)) {
throw KeeperException.create(KeeperException.Code.CONNECTIONLOSS);
}
newZk.close();
}
代码示例来源:origin: twitter/distributedlog
}, oldZk.getSessionId(), oldZk.getSessionPasswd());
if (!latch.await(timeout, TimeUnit.MILLISECONDS)) {
throw KeeperException.create(KeeperException.Code.CONNECTIONLOSS);
代码示例来源:origin: apache/hbase
String quorumServers = ZKConfig.getZKQuorumServersString(c);
ZooKeeper zk = nodeZK.getRecoverableZooKeeper().getZooKeeper();
byte[] password = zk.getSessionPasswd();
long sessionID = zk.getSessionId();
代码示例来源:origin: NGDATA/hbase-indexer
@Override
public byte[] getSessionPasswd() {
return delegate.getSessionPasswd();
}
代码示例来源:origin: com.linkedin.pegasus/d2
@Override
public byte[] getSessionPasswd()
{
return _zk.getSessionPasswd();
}
代码示例来源:origin: com.ngdata/hbase-sep-impl-common
@Override
public byte[] getSessionPasswd() {
return delegate.getSessionPasswd();
}
代码示例来源:origin: NGDATA/lilyproject
@Override
public byte[] getSessionPasswd() {
return delegate.getSessionPasswd();
}
代码示例来源:origin: alibaba/wasp
public byte[] getSessionPasswd() {
return zk.getSessionPasswd();
}
代码示例来源:origin: indeedeng/util
public byte[] getSessionPasswd() {
return zooKeeper.getSessionPasswd();
}
代码示例来源:origin: harbby/presto-connectors
public synchronized byte[] getSessionPasswd() {
return zk == null ? null : zk.getSessionPasswd();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
public synchronized byte[] getSessionPasswd() {
return zk == null ? null : zk.getSessionPasswd();
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
public synchronized byte[] getSessionPasswd() {
return zk == null ? null : zk.getSessionPasswd();
}
代码示例来源:origin: co.cask.hbase/hbase
public byte[] getSessionPasswd() {
return zk.getSessionPasswd();
}
代码示例来源:origin: org.apache.pulsar/pulsar-proxy
@Override
public byte[] getSessionPasswd() {
ZooKeeper zkHandle = zk.get();
if (null == zkHandle) {
return super.getSessionPasswd();
}
return zkHandle.getSessionPasswd();
}
代码示例来源:origin: org.apache.bookkeeper/bookkeeper-server
@Override
public byte[] getSessionPasswd() {
ZooKeeper zkHandle = zk.get();
if (null == zkHandle) {
return super.getSessionPasswd();
}
return zkHandle.getSessionPasswd();
}
代码示例来源:origin: griddynamics/jagger
@Override
public byte[] getSessionPasswd() {
return getDelegate().getSessionPasswd();
}
代码示例来源:origin: org.pongasoft/org.linkedin.zookeeper-impl
@Override
public byte[] getSessionPasswd()
{
return getZk().getSessionPasswd();
}
代码示例来源:origin: apache/helix
protected void simulateSessionExpiry(ZkConnection zkConnection) throws IOException,
InterruptedException {
ZooKeeper oldZookeeper = zkConnection.getZookeeper();
LOG.info("Old sessionId = " + oldZookeeper.getSessionId());
Watcher watcher = new Watcher() {
@Override
public void process(WatchedEvent event) {
LOG.info("In New connection, process event:" + event);
}
};
ZooKeeper newZookeeper =
new ZooKeeper(zkConnection.getServers(), oldZookeeper.getSessionTimeout(), watcher,
oldZookeeper.getSessionId(), oldZookeeper.getSessionPasswd());
LOG.info("New sessionId = " + newZookeeper.getSessionId());
// Thread.sleep(3000);
newZookeeper.close();
Thread.sleep(10000);
oldZookeeper = zkConnection.getZookeeper();
LOG.info("After session expiry sessionId = " + oldZookeeper.getSessionId());
}
代码示例来源:origin: caskdata/tephra
private void expireZkSession(ZKClientService zkClientService) throws Exception {
ZooKeeper zooKeeper = zkClientService.getZooKeeperSupplier().get();
final SettableFuture<?> connectFuture = SettableFuture.create();
Watcher watcher = new Watcher() {
@Override
public void process(WatchedEvent event) {
if (event.getState() == Event.KeeperState.SyncConnected) {
connectFuture.set(null);
}
}
};
// Create another Zookeeper session with the same sessionId so that the original one expires.
final ZooKeeper dupZookeeper =
new ZooKeeper(zkClientService.getConnectString(), zooKeeper.getSessionTimeout(), watcher,
zooKeeper.getSessionId(), zooKeeper.getSessionPasswd());
connectFuture.get(30, TimeUnit.SECONDS);
Assert.assertEquals("Failed to re-create current session", dupZookeeper.getState(), ZooKeeper.States.CONNECTED);
dupZookeeper.close();
}
内容来源于网络,如有侵权,请联系作者删除!