- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.helix.manager.zk.zookeeper.ZkConnection.getZookeeper()
方法的一些代码示例,展示了ZkConnection.getZookeeper()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkConnection.getZookeeper()
方法的具体详情如下:
包路径:org.apache.helix.manager.zk.zookeeper.ZkConnection
类名称:ZkConnection
方法名:getZookeeper
暂无
代码示例来源:origin: apache/helix
@Override
public Stat call() throws Exception {
Stat stat = ((ZkConnection) getConnection()).getZookeeper().exists(path, false);
return stat;
}
});
代码示例来源:origin: apache/helix
public long getSessionId() {
ZkConnection zkConnection = ((ZkConnection) getConnection());
ZooKeeper zk = zkConnection.getZookeeper();
if (zk == null) {
throw new HelixException(
"ZooKeeper connection information is not available now. ZkClient might be disconnected.");
} else {
return zkConnection.getZookeeper().getSessionId();
}
}
代码示例来源:origin: apache/helix
@Override public Object call() throws Exception {
((ZkConnection) getConnection()).getZookeeper().exists(path, null, cb,
new ZkAsyncCallbacks.ZkAsyncCallContext(_monitor, startT, 0, true));
return null;
}
});
代码示例来源:origin: apache/helix
@Override public Object call() throws Exception {
((ZkConnection) getConnection()).getZookeeper().create(path, data, ZooDefs.Ids.OPEN_ACL_UNSAFE,
// Arrays.asList(DEFAULT_ACL),
mode, cb, new ZkAsyncCallbacks.ZkAsyncCallContext(_monitor, startT,
data == null ? 0 : data.length, false));
return null;
}
});
代码示例来源:origin: apache/helix
@Override public Object call() throws Exception {
((ZkConnection) getConnection()).getZookeeper().getData(path, null, cb,
new ZkAsyncCallbacks.ZkAsyncCallContext(_monitor, startT, 0, true));
return null;
}
});
代码示例来源:origin: apache/helix
@Override public Object call() throws Exception {
((ZkConnection) getConnection()).getZookeeper().setData(path, data, version, cb,
new ZkAsyncCallbacks.ZkAsyncCallContext(_monitor, startT,
data == null ? 0 : data.length, false));
return null;
}
});
代码示例来源:origin: apache/helix
@Override public Object call() throws Exception {
((ZkConnection) getConnection()).getZookeeper().delete(path, -1, cb,
new ZkAsyncCallbacks.ZkAsyncCallContext(_monitor, startT, 0, false));
return null;
}
});
代码示例来源:origin: apache/helix
/**
* Get zk connection session id
* @param client
* @return
*/
public static String getSessionId(HelixZkClient client) {
ZkConnection connection = (ZkConnection) ((ZkClient) client).getConnection();
ZooKeeper curZookeeper = connection.getZookeeper();
return Long.toHexString(curZookeeper.getSessionId());
}
代码示例来源:origin: apache/helix
@Override
public void handleNewSession() throws Exception {
// make sure zkclient is connected again
zkClient.waitUntilConnected(HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS);
ZkConnection connection = ((ZkConnection) zkClient.getConnection());
ZooKeeper curZookeeper = connection.getZookeeper();
LOG.info("handleNewSession. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));
waitNewSession.countDown();
}
代码示例来源:origin: apache/helix
@Override
public void handleNewSession() throws Exception {
// make sure zkclient is connected again
zkClient.waitUntilConnected(HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.SECONDS);
ZkConnection connection = ((ZkConnection) zkClient.getConnection());
ZooKeeper curZookeeper = connection.getZookeeper();
LOG.info("handleNewSession. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));
}
代码示例来源:origin: apache/helix
public static Map<String, List<String>> getZkWatch(HelixZkClient client) throws Exception {
Map<String, List<String>> lists = new HashMap<String, List<String>>();
ZkClient zkClient = (ZkClient) client;
ZkConnection connection = ((ZkConnection) zkClient.getConnection());
ZooKeeper zk = connection.getZookeeper();
java.lang.reflect.Field field = getField(zk.getClass(), "watchManager");
field.setAccessible(true);
Object watchManager = field.get(zk);
java.lang.reflect.Field field2 = getField(watchManager.getClass(), "dataWatches");
field2.setAccessible(true);
HashMap<String, Set<Watcher>> dataWatches =
(HashMap<String, Set<Watcher>>) field2.get(watchManager);
field2 = getField(watchManager.getClass(), "existWatches");
field2.setAccessible(true);
HashMap<String, Set<Watcher>> existWatches =
(HashMap<String, Set<Watcher>>) field2.get(watchManager);
field2 = getField(watchManager.getClass(), "childWatches");
field2.setAccessible(true);
HashMap<String, Set<Watcher>> childWatches =
(HashMap<String, Set<Watcher>>) field2.get(watchManager);
lists.put("dataWatches", new ArrayList<>(dataWatches.keySet()));
lists.put("existWatches", new ArrayList<>(existWatches.keySet()));
lists.put("childWatches", new ArrayList<>(childWatches.keySet()));
return lists;
}
代码示例来源:origin: apache/helix
final ZkConnection zkConnection = (ZkConnection) getConnection();
if (zkConnection == null || zkConnection.getZookeeper() == null) {
throw new IllegalStateException(
"ZkConnection is in invalid state! Please close this ZkClient and create new client.");
代码示例来源: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: apache/helix
_eventThread.join(2000);
if (isManagingZkConnection()) {
LOG.info("Closing zkclient: " + ((ZkConnection) connection).getZookeeper());
connection.close();
代码示例来源:origin: apache/helix
/**
* expire zk session asynchronously
* @param client
* @throws Exception
*/
public static void asyncExpireSession(HelixZkClient client) throws Exception {
final ZkClient zkClient = (ZkClient) client;
ZkConnection connection = ((ZkConnection) zkClient.getConnection());
ZooKeeper curZookeeper = connection.getZookeeper();
LOG.info("Before expiry. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));
Watcher watcher = new Watcher() {
@Override
public void process(WatchedEvent event) {
LOG.info("Process watchEvent: " + event);
}
};
final ZooKeeper dupZookeeper =
new ZooKeeper(connection.getServers(), curZookeeper.getSessionTimeout(), watcher,
curZookeeper.getSessionId(), curZookeeper.getSessionPasswd());
// wait until connected, then close
while (dupZookeeper.getState() != States.CONNECTED) {
Thread.sleep(10);
}
dupZookeeper.close();
connection = (ZkConnection) zkClient.getConnection();
curZookeeper = connection.getZookeeper();
// System.err.println("zk: " + oldZookeeper);
LOG.info("After expiry. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));
}
代码示例来源:origin: apache/helix
ZooKeeper zookeeper = connection.getZookeeper();
System.out.println("old sessionId= " + zookeeper.getSessionId());
Watcher watcher = new Watcher() {
Thread.sleep(10000);
connection = ((ZkConnection) _zkClient.getConnection());
zookeeper = connection.getZookeeper();
System.out.println("After session expiry sessionId= " + zookeeper.getSessionId());
代码示例来源:origin: apache/helix
zkClient.subscribeStateChanges(listener);
ZkConnection connection = ((ZkConnection) zkClient.getConnection());
ZooKeeper oldZookeeper = connection.getZookeeper();
LOG.info("Old sessionId = " + oldZookeeper.getSessionId());
Thread.sleep(10000);
connection = (ZkConnection) zkClient.getConnection();
oldZookeeper = connection.getZookeeper();
LOG.info("After session expiry sessionId = " + oldZookeeper.getSessionId());
代码示例来源:origin: apache/helix
ZooKeeper curZookeeper = connection.getZookeeper();
LOG.info("Before expiry. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));
curZookeeper = connection.getZookeeper();
zkClient.unsubscribeStateChanges(listener);
代码示例来源:origin: apache/helix
ZooKeeper curZookeeper = connection.getZookeeper();
String oldSessionId = Long.toHexString(curZookeeper.getSessionId());
LOG.info("Before session expiry. sessionId: " + oldSessionId + ", zk: " + curZookeeper);
curZookeeper = connection.getZookeeper();
本文整理了Java中org.apache.pulsar.zookeeper.ZooKeeperCache.getZooKeeper()方法的一些代码示例,展示了ZooKeeperCache.getZo
本文整理了Java中com.yahoo.pulsar.zookeeper.ZooKeeperCache.getZooKeeper()方法的一些代码示例,展示了ZooKeeperCache.getZoo
本文整理了Java中org.apache.accumulo.core.client.ZooKeeperInstance.getZooKeepers()方法的一些代码示例,展示了ZooKeeperIns
本文整理了Java中org.apache.accumulo.server.zookeeper.ZooReaderWriter.getZooKeeper()方法的一些代码示例,展示了ZooReaderW
本文整理了Java中org.apache.accumulo.fate.zookeeper.ZooReaderWriter.getZooKeeper()方法的一些代码示例,展示了ZooReaderWri
本文整理了Java中org.apache.accumulo.fate.zookeeper.ZooUtil.getZooKeeper()方法的一些代码示例,展示了ZooUtil.getZooKeeper
本文整理了Java中org.apache.helix.manager.zk.zookeeper.ZkConnection.getZookeeper()方法的一些代码示例,展示了ZkConnection
我是一名优秀的程序员,十分优秀!