- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.zookeeper.ZooKeeper.getData()
方法的一些代码示例,展示了ZooKeeper.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeper.getData()
方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeper
类名称:ZooKeeper
方法名:getData
[英]The asynchronous version of getData.
[中]getData的异步版本。
代码示例来源:origin: apache/zookeeper
/**
* The asynchronous version of getData.
*
* @see #getData(String, boolean, Stat)
*/
public void getData(String path, boolean watch, DataCallback cb, Object ctx) {
getData(path, watch ? watchManager.defaultWatcher : null, cb, ctx);
}
代码示例来源:origin: apache/hbase
@Override
protected void doExec(ZooKeeper zk) {
zk.getData(path, false,
(rc, path, ctx, data, stat) -> onComplete(zk, rc, data, true), null);
}
});
代码示例来源:origin: apache/zookeeper
private void utestGet(int port)
throws IOException, InterruptedException, KeeperException
{
ZooKeeper zk =
new ZooKeeper("127.0.0.1:" + port, CONNECTION_TIMEOUT, this);
for (int i = 0; i < 10000; i++) {
Stat stat = new Stat();
zk.getData("/" + i, true, stat);
}
zk.close();
}
代码示例来源:origin: apache/zookeeper
private void compareStat(String path, int sid, int compareWithSid) throws Exception{
Stat stat1 = new Stat();
zk[sid].getData(path, null, stat1);
Stat stat2 = new Stat();
zk[compareWithSid].getData(path, null, stat2);
Assert.assertEquals(stat1, stat2);
}
代码示例来源:origin: apache/hbase
@Override
public void checkTaskStillAvailable(String path) {
// A negative retry count will lead to ignoring all error processing.
this.watcher
.getRecoverableZooKeeper()
.getZooKeeper()
.getData(path, this.watcher, new GetDataAsyncCallback(),
Long.valueOf(-1) /* retry count */);
SplitLogCounters.tot_mgr_get_data_queued.increment();
}
代码示例来源:origin: apache/ignite
/**
* @param path Path.
* @param watcher Watcher.
* @param cb Callback.
*/
void getDataAsync(String path, Watcher watcher, AsyncCallback.DataCallback cb) {
GetDataOperation op = new GetDataOperation(path, watcher, cb);
zk.getData(path, watcher, new DataCallbackWrapper(op), null);
}
代码示例来源:origin: apache/hbase
private void getDataSetWatch(String path, Long retry_count) {
this.watcher.getRecoverableZooKeeper().getZooKeeper()
.getData(path, this.watcher, new GetDataAsyncCallback(), retry_count);
SplitLogCounters.tot_mgr_get_data_queued.increment();
}
代码示例来源:origin: apache/hbase
public void getDataSetWatchAsync() {
watcher.getRecoverableZooKeeper().getZooKeeper()
.getData(currentTask, watcher, new GetDataAsyncCallback(), null);
SplitLogCounters.tot_wkr_get_data_queued.increment();
}
代码示例来源:origin: apache/zookeeper
void readAll() {
for (int i = 0; i < count; i++) {
String cpath = path + "/" + i;
zk.getData(cpath, false, this, null);
incOutstanding();
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public <T> T getData(String path) {
// 暂时不watch data change 所以第二个参数为false
try {
byte[] data = zk.getData(path, false, null);
return (T) serializer.deserialize(data);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testCreate() throws Exception {
multi(zk, Arrays.asList(
Op.create("/multi0", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
Op.create("/multi1", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT),
Op.create("/multi2", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT)
));
zk.getData("/multi0", false, null);
zk.getData("/multi1", false, null);
zk.getData("/multi2", false, null);
}
代码示例来源:origin: apache/zookeeper
/**
* Visits the subtree with root as given path and calls the passed callback with each znode
* found during the search. It performs a depth-first, pre-order traversal of the tree.
* <p>
* <b>Important:</b> This is <i>not an atomic snapshot</i> of the tree ever, but the
* state as it exists across multiple RPCs from zkClient to the ensemble.
* For practical purposes, it is suggested to bring the clients to the ensemble
* down (i.e. prevent writes to pathRoot) to 'simulate' a snapshot behavior.
*/
public static void visitSubTreeDFS(ZooKeeper zk, final String path, boolean watch,
StringCallback cb) throws KeeperException, InterruptedException {
PathUtils.validatePath(path);
zk.getData(path, watch, null);
cb.processResult(Code.OK.intValue(), path, null, path);
visitSubTreeDFSHelper(zk, path, watch, cb);
}
代码示例来源:origin: apache/zookeeper
public void verifyGetDataFailure_NoNode() {
rc = KeeperException.Code.NONODE;
data = null;
stat = null;
zk.getData(path, false, this, toString());
verify();
}
代码示例来源:origin: apache/zookeeper
@Test
public void testSetData() throws Exception {
String[] names = {"/multi0", "/multi1", "/multi2"};
List<Op> ops = new ArrayList<Op>();
for (int i = 0; i < names.length; i++) {
ops.add(Op.create(names[i], new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT));
ops.add(Op.setData(names[i], names[i].getBytes(), 0));
}
multi(zk, ops) ;
for (int i = 0; i < names.length; i++) {
Assert.assertArrayEquals(names[i].getBytes(), zk.getData(names[i], false, null));
}
}
代码示例来源:origin: apache/zookeeper
public void validAuth() throws Exception {
ZooKeeper zk = createClient();
// any multiple of 5 will do...
zk.addAuthInfo("key", "25".getBytes());
try {
createNodePrintAcl(zk, "/valid", "testValidAuth");
zk.getData("/abc", false, null);
zk.setData("/abc", "testData3".getBytes(), -1);
} catch (KeeperException.AuthFailedException e) {
Assert.fail("test failed :" + e);
} finally {
zk.close();
}
}
代码示例来源:origin: apache/zookeeper
public void validAuth2() throws Exception {
ZooKeeper zk = createClient();
// any multiple of 5 will do...
zk.addAuthInfo("key", "125".getBytes());
try {
createNodePrintAcl(zk, "/valid2", "testValidAuth2");
zk.getData("/abc", false, null);
zk.setData("/abc", "testData3".getBytes(), -1);
} catch (KeeperException.AuthFailedException e) {
Assert.fail("test failed :" + e);
} finally {
zk.close();
}
}
代码示例来源:origin: apache/zookeeper
public void missingAuth() throws Exception {
ZooKeeper zk = createClient();
try {
zk.getData("/abc", false, null);
Assert.fail("Should not be able to get data");
} catch (KeeperException correct) {
// correct
}
try {
zk.setData("/abc", "testData2".getBytes(), -1);
Assert.fail("Should not be able to set data");
} catch (KeeperException correct) {
// correct
} finally {
zk.close();
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testClientResponseStatsUpdate() throws IOException, InterruptedException, KeeperException {
try (ZooKeeper zk = createClient()) {
BufferStats clientResponseStats = serverFactory.getZooKeeperServer().serverStats().getClientResponseStats();
assertThat("Last client response size should be initialized with INIT_VALUE",
clientResponseStats.getLastBufferSize(), equalTo(BufferStats.INIT_VALUE));
zk.create("/a", "test".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
assertThat("Last client response size should be greater than 0 after client request was performed",
clientResponseStats.getLastBufferSize(), greaterThan(0));
byte[] contents = zk.getData("/a", null, null);
assertArrayEquals("unexpected data", "test".getBytes(), contents);
}
}
代码示例来源:origin: apache/zookeeper
public void verifyGetData() {
new StringCB(zk).verifyCreate();
zk.getData(path, false, this, toString());
verify();
}
代码示例来源:origin: twitter/distributedlog
private static MaxLogSegmentSequenceNo getMaxLogSegmentSequenceNo(ZooKeeperClient zkc, URI uri, String streamName,
DistributedLogConfiguration conf) throws Exception {
Stat stat = new Stat();
String logSegmentsPath = ZKLogMetadata.getLogSegmentsPath(
uri, streamName, conf.getUnpartitionedStreamName());
byte[] data = zkc.get().getData(logSegmentsPath, false, stat);
Versioned<byte[]> maxLSSNData = new Versioned<byte[]>(data, new ZkVersion(stat.getVersion()));
return new MaxLogSegmentSequenceNo(maxLSSNData);
}
我如何在Android工作室项目中实现OneSignal时解决这个问题?
我正在从另一个电子表格中导入一个范围,然后使用此脚本将其粘贴到当前电子表格中: function getdata() { var values = SpreadsheetApp.openById('X
我正在观看来自 Slidenerd 的关于在 Android 上制作 Recycle View 的 Android 教程。这个链接:https://www.youtube.com/watch?v=Oo
public function json_product_list($where, $order){ global $_M; $this->table = load::sys_clas
我正在开发一个 Silverlight 3 应用程序,我想将所有意外错误处理委托(delegate)给一个我命名为 ErrorHandler 的类的单个实例。 .这个类有一个名为 HandleAppl
我有一个网站,允许用户进行输入并创建新内容。我总是使用tinymce 作为输入字段。今天切换到 ckeditor 后,我注意到我遇到了与最初使用 tinymce 时遇到的相同问题: 提交表单时,编辑器
我知道这个问题已经被问过几次了,但还没有一个答案真正帮助我解决我的问题。 我为三个下拉菜单设置了三个事件订阅者,它们相互依赖。 所以在我的 FormType 中我说: public functio
我无法理解如何从 short[] 获取 RGBA 值,该值是从 bufferedImage.getRaster().dataBuffer.getData() 获取的,如果 dataBuffer 是Da
#include #include #define MAX 20 #define MAX_BASE 8 #define ROW 9 #define COLUMN_SCORE 12 #define
谁能帮我理解这背后的逻辑? $(document).ready(function() { getData([renderData]); }); function renderData(JSON
我有一个类,比如“CDownloader”,它读取一些 XML 数据并提供通过节点名称的访问。它具有一些 getter 函数,如下所示: BOOL CDownloader::getInteger (
对于大学来说,我必须制作一个带有 MVC 风格编码的 JavaScript 游戏。 (模型、 View 、 Controller )。我对此很陌生,所以请不要太难。我收到以下错误:“未捕获类型错误:无
我对 Python 模块 PIL 有疑问: 每当我在图像上调用 getdata() 方法时,都会返回一些奇怪的东西。 from PIL import Image # Histogram class t
我正在使用 Texture2D.GetData()创建 Tilemap 的方法。这在我第一次执行时总是有效,但第二次该方法只是返回其他颜色,混淆了整个算法。我完全没有理由这样做。 我的代码: swit
我刚开始学习XNA/MonoGame,遇到了一个奇怪的异常。 错误提示:未实现方法或操作。 更奇怪的是,一个非常相似、几乎相同的代码却能工作。唯一的区别是其他代码在 XNA 和另一台计算机上运行,
首先,我会先说我是 javascript 的新手,所以希望这不是一个完整的脸谱问题。话虽如此,当用户点击它时,以下代码应该提醒编辑器的值。 function openEditor(){ html =
我正在使用 Monogame 将一款游戏从 XNA 转换到 iOS。 在下面的代码片段中,smallDeform 是一个 Texture2D,我在其上调用了 GetData 方法。 smallDefo
我有一个属性 cdn_image_name,它适用于大约 90 000 种产品。最近,内容编辑报告说大约有三种产品缺少图片。我已将问题确定为 Magento 的 getData() 方法。 这是与原始
byte [] r = new byte[4096]; DatagramPacket dpr = new DatagramPacket(r, r.length); sock.receive(dpr);
本文整理了Java中org.zeromq.ZFrame.getData()方法的一些代码示例,展示了ZFrame.getData()的具体用法。这些代码示例主要来源于Github/Stackoverf
我是一名优秀的程序员,十分优秀!