- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.twitter.distributedlog.exceptions.ZKException
类的一些代码示例,展示了ZKException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKException
类的具体详情如下:
包路径:com.twitter.distributedlog.exceptions.ZKException
类名称:ZKException
[英]TODO: move ZKException to distributedlog-protocol
[中]TODO:将ZKException移动到distributedlog协议
代码示例来源:origin: twitter/distributedlog
public static boolean isRetryableZKException(ZKException zke) {
KeeperException.Code code = zke.getKeeperExceptionCode();
return KeeperException.Code.CONNECTIONLOSS == code ||
KeeperException.Code.OPERATIONTIMEOUT == code ||
KeeperException.Code.SESSIONEXPIRED == code ||
KeeperException.Code.SESSIONMOVED == code;
}
}
代码示例来源:origin: twitter/distributedlog
@Override
public Boolean handle(ZooKeeperClient zkc) throws IOException {
// check existence after syncing
try {
return null != Utils.sync(zkc, logRootPath).exists(logRootPath, false);
} catch (KeeperException e) {
throw new ZKException("Error on checking if log " + logRootPath + " exists", e.code());
} catch (InterruptedException e) {
throw new DLInterruptedException("Interrupted on checking if log " + logRootPath + " exists", e);
}
}
}, conf, uri);
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testAclModifyPermsDlmConflict() throws Exception {
String streamName = "test-stream";
// Reopening and writing again with the same un will succeed.
initDlogMeta("/" + runtime.getMethodName(), "test-un", streamName);
try {
// Reopening and writing again with a different un will fail.
initDlogMeta("/" + runtime.getMethodName(), "not-test-un", streamName);
fail("write should have failed due to perms");
} catch (ZKException ex) {
LOG.info("caught exception trying to write with no perms {}", ex);
assertEquals(KeeperException.Code.NOAUTH, ex.getKeeperExceptionCode());
} catch (Exception ex) {
LOG.info("caught wrong exception trying to write with no perms {}", ex);
fail("wrong exception " + ex.getClass().getName() + " expected " + LockingException.class.getName());
}
// Should work again.
initDlogMeta("/" + runtime.getMethodName(), "test-un", streamName);
}
代码示例来源:origin: twitter/distributedlog
protected Future<List<LogSegmentMetadata>> asyncGetLedgerListWithRetries(Comparator<LogSegmentMetadata> comparator,
LogSegmentFilter segmentFilter,
Watcher watcher) {
final Promise<List<LogSegmentMetadata>> promise = new Promise<List<LogSegmentMetadata>>();
asyncGetLedgerListWithRetries(comparator, segmentFilter, watcher, new GenericCallback<List<LogSegmentMetadata>>() {
@Override
public void operationComplete(int rc, List<LogSegmentMetadata> segments) {
if (KeeperException.Code.OK.intValue() == rc) {
promise.setValue(segments);
} else if (KeeperException.Code.NONODE.intValue() == rc) {
promise.setException(new LogNotFoundException("Log " + getFullyQualifiedName() + " not found"));
} else {
String errMsg = "ZK Exception " + rc + " reading ledger list for " + getFullyQualifiedName();
promise.setException(new ZKException(errMsg, KeeperException.Code.get(rc)));
}
}
});
return promise;
}
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testToolCreateZkAclId() throws Exception {
createStream(defaultUri, "0", "CreateAclStream", defaultPrivilegedZkAclId);
try {
DistributedLogManager dlm = DLMTestUtil.createNewDLM("0CreateAclStream", conf, defaultUri);
DLMTestUtil.generateCompletedLogSegments(dlm, conf, 3, 1000);
dlm.close();
} catch (ZKException ex) {
assertEquals(KeeperException.Code.NOAUTH, ex.getKeeperExceptionCode());
}
}
代码示例来源:origin: twitter/distributedlog
throw new ZKException("Failed to get list of pools from " + rootPath, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new DLInterruptedException("Interrupted on collecting ledgers from allocation pool " + poolPath, e);
} catch (KeeperException e) {
throw new ZKException("Failed to collect ledgers from allocation pool " + poolPath, e.code());
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testUpdateNonExistentLogSegment() throws Exception {
LogSegmentMetadata segment = createLogSegment(1L);
Transaction<Object> updateTxn = lsmStore.transaction();
lsmStore.updateLogSegment(updateTxn, segment);
try {
FutureUtils.result(updateTxn.execute());
fail("Should fail update if log segment doesn't exist");
} catch (Throwable t) {
assertTrue("Should throw NoNodeException if log segment doesn't exist",
t instanceof ZKException);
ZKException zke = (ZKException) t;
assertEquals("Should throw NoNodeException if log segment doesn't exist",
KeeperException.Code.NONODE, zke.getKeeperExceptionCode());
}
}
代码示例来源:origin: twitter/distributedlog
promise.setValue(streams.iterator());
} else {
promise.setException(new ZKException("Error reading namespace " + nsRootPath,
KeeperException.Code.get(rc)));
promise.setValue(streams.iterator());
} else {
promise.setException(new ZKException("Error reading namespace " + nsRootPath,
KeeperException.Code.get(syncRc)));
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testDeleteNonExistentLogSegment() throws Exception {
LogSegmentMetadata segment = createLogSegment(1L);
Transaction<Object> deleteTxn = lsmStore.transaction();
lsmStore.deleteLogSegment(deleteTxn, segment);
try {
FutureUtils.result(deleteTxn.execute());
fail("Should fail deletion if log segment doesn't exist");
} catch (Throwable t) {
assertTrue("Should throw NoNodeException if log segment doesn't exist",
t instanceof ZKException);
ZKException zke = (ZKException) t;
assertEquals("Should throw NoNodeException if log segment doesn't exist",
KeeperException.Code.NONODE, zke.getKeeperExceptionCode());
}
}
代码示例来源:origin: twitter/distributedlog
promise.setException(new ZKException("Failed to create log " + logRootPath,
KeeperException.Code.get(rc)));
代码示例来源:origin: twitter/distributedlog
fail("Should fail allocating on second allocator as allocator1 is starting allocating something.");
} catch (ZKException zke) {
assertEquals(KeeperException.Code.BADVERSION, zke.getKeeperExceptionCode());
代码示例来源:origin: twitter/distributedlog
throw new ZKException("Error syncing zookeeper connection ",
KeeperException.Code.get(syncResult.get()));
代码示例来源:origin: twitter/distributedlog
fail("Should fail on storing log segment sequence number if providing bad version");
} catch (ZKException zke) {
assertEquals(KeeperException.Code.BADVERSION, zke.getKeeperExceptionCode());
代码示例来源:origin: twitter/distributedlog
/**
* Wait for the result for a given <i>duration</i>.
* <p>If the result is not ready within `duration`, an IOException will thrown wrapping with
* corresponding {@link com.twitter.util.TimeoutException}.
*
* @param result result to wait
* @param duration duration to wait
* @return the result
* @throws IOException when encountered exceptions on the result or waiting for the result.
*/
public static <T> T result(Future<T> result, Duration duration)
throws IOException {
try {
return Await.result(result, duration);
} catch (KeeperException ke) {
throw new ZKException("Encountered zookeeper exception on waiting result", ke);
} catch (BKException bke) {
throw new BKTransmitException("Encountered bookkeeper exception on waiting result", bke.getCode());
} catch (IOException ioe) {
throw ioe;
} catch (InterruptedException ie) {
throw new DLInterruptedException("Interrupted on waiting result", ie);
} catch (Exception e) {
throw new IOException("Encountered exception on waiting result", e);
}
}
代码示例来源:origin: twitter/distributedlog
fail("Should fail on storing log record transaction id if providing bad version");
} catch (ZKException zke) {
assertEquals(KeeperException.Code.BADVERSION, zke.getKeeperExceptionCode());
代码示例来源:origin: twitter/distributedlog
private void checkLogStreamExists() throws IOException {
try {
if (null == Utils.sync(zooKeeperClient, logMetadata.getLogSegmentsPath())
.exists(logMetadata.getLogSegmentsPath(), false)) {
throw new LogNotFoundException("Log " + getFullyQualifiedName() + " doesn't exist");
}
} catch (InterruptedException ie) {
LOG.error("Interrupted while reading {}", logMetadata.getLogSegmentsPath(), ie);
throw new DLInterruptedException("Interrupted while checking "
+ logMetadata.getLogSegmentsPath(), ie);
} catch (KeeperException ke) {
LOG.error("Error checking existence for {} : ", logMetadata.getLogSegmentsPath(), ke);
throw new ZKException("Error checking existence for " + getFullyQualifiedName() + " : ", ke);
}
}
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testCreateLogSegment() throws Exception {
LogSegmentMetadata segment = createLogSegment(1L);
Transaction<Object> createTxn = lsmStore.transaction();
lsmStore.createLogSegment(createTxn, segment);
FutureUtils.result(createTxn.execute());
// the log segment should be created
assertNotNull("LogSegment " + segment + " should be created",
zkc.get().exists(segment.getZkPath(), false));
LogSegmentMetadata segment2 = createLogSegment(1L);
Transaction<Object> createTxn2 = lsmStore.transaction();
lsmStore.createLogSegment(createTxn2, segment2);
try {
FutureUtils.result(createTxn2.execute());
fail("Should fail if log segment exists");
} catch (Throwable t) {
// expected
assertTrue("Should throw NodeExistsException if log segment exists",
t instanceof ZKException);
ZKException zke = (ZKException) t;
assertEquals("Should throw NodeExistsException if log segment exists",
KeeperException.Code.NODEEXISTS, zke.getKeeperExceptionCode());
}
}
代码示例来源:origin: twitter/distributedlog
@Override
public void processResult(int syncRc, String path, Object syncCtx) {
if (KeeperException.Code.NONODE.intValue() == syncRc) {
promise.setException(new LogNotFoundException(
String.format("Log %s does not exist or has been deleted", getFullyQualifiedName())));
return;
} else if (KeeperException.Code.OK.intValue() != syncRc){
promise.setException(new ZKException("Error on checking log existence for " + getFullyQualifiedName(),
KeeperException.create(KeeperException.Code.get(syncRc))));
return;
}
zk.exists(logMetadata.getLogSegmentsPath(), false, new AsyncCallback.StatCallback() {
@Override
public void processResult(int rc, String path, Object ctx, Stat stat) {
if (KeeperException.Code.OK.intValue() == rc) {
promise.setValue(null);
} else if (KeeperException.Code.NONODE.intValue() == rc) {
promise.setException(new LogNotFoundException(String.format("Log %s does not exist or has been deleted", getFullyQualifiedName())));
} else {
promise.setException(new ZKException("Error on checking log existence for " + getFullyQualifiedName(),
KeeperException.create(KeeperException.Code.get(rc))));
}
}
}, null);
}
}, null);
代码示例来源:origin: twitter/distributedlog
ZKException zke = (ZKException) t;
assertEquals("Transaction is aborted",
KeeperException.Code.NONODE, zke.getKeeperExceptionCode());
代码示例来源:origin: twitter/distributedlog
synchronized void store(ZooKeeperClient zkc, String path, long logSegmentSeqNo) throws IOException {
try {
Stat stat = zkc.get().setData(path,
DLUtils.serializeLogSegmentSequenceNumber(logSegmentSeqNo), getZkVersion());
update(stat.getVersion(), logSegmentSeqNo);
} catch (KeeperException ke) {
throw new ZKException("Error writing max ledger sequence number " + logSegmentSeqNo + " to "
+ path + " : ", ke);
} catch (ZooKeeperClient.ZooKeeperConnectionException zce) {
throw new IOException("Error writing max ledger sequence number " + logSegmentSeqNo + " to "
+ path + " : ", zce);
} catch (InterruptedException e) {
throw new DLInterruptedException("Error writing max ledger sequence number " + logSegmentSeqNo + " to "
+ path + " : ", e);
}
}
用户使用 oauth 登录我的应用程序,注销我的应用程序后,但 twitter 无法执行,问题是用户 twitter 帐户处于事件状态。 当注销我的应用程序的同时注销 Twitter twitter
我在 Twitter 的文本查询字符串参数方面遇到了一些字符编码问题。 a) http://www.twitter.com/share?url=http://www.example.com&text=
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我正在尝试执行3-legged authorization来在浏览器中调用Twitter API。该过程首先通过将签名的请求发布到 /oauth/request_token 来获得请求 token (
我正在做一个项目来识别用户是否是 Twitter 中的名人。有什么方法可以检查 Twitter 中的用户是否被验证为名人?我知道名人会在推特个人资料中用蓝色徽章来识别。但是我如何通过 Twitter
我想对推文进行一些挖掘。是否有更具体的推文停用词列表,例如删除“lol”和其他推特笑脸? 最佳答案 我想你应该合并普通的停用词列表,例如 this one或that ,带有特定的首字母缩略词词典,例如
我正在为我的期末项目建立一个网站,用于查找和显示 Twitter 上当前 HitTest 门的主题。有谁知道如何从上周或一天内的大量推文中提取主题?我还想知道如何在 http://tweet3d.co
我可以使用获取所有用户的详细信息 https://api.twitter.com/1/account/verify_credentials.json 但我只想通过使用 api 获取 ID 如何获得它。
我见过多个“允许此应用程序与 twitter 一起运行”的内容,但没有一个: 查看您的 Twitter 密码 在“此应用程序将能够”下 示例: 最佳答案 没有 Twitter 永远不会允许人们看到您的
我注意到最近的一些推文有与之相关的媒体,例如来自 TwitPic 或 Flickr 的照片以及来自 Youtube 的视频。你可以直接在 Twitter 网站上看到它们,所以它不仅仅是一个链接。我的想
在 Twitter API 中,有一个 status_lookup 方法可以“水化”推文。文档不清楚这意味着什么。那么我什么时候需要补充推文呢? 如果我有来自 /statuses/user_timel
我使用以下代码来显示一个带有已填充消息的 Twitter 框的页面: Click me 但是,在页面上,我在 Twitter 框中得到了这个: myMessage/ 注意结尾的斜杠。有什么想法可以解决
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 7 年前。 Improve
在开发包含 Twitter 客户端的 iOS 应用程序时,我必须允许用户生成主题标签(可以在应用程序内的其他位置创建,而不仅仅是在推文正文中创建)。 我想确保任何此类主题标签对于 Twitter 都有
我是集群新手,之前刚刚实现了一些算法。我需要根据推文的相似性对推文进行聚类。一种方法是仅使用哈希标签,但我认为这不会提供那么多信息。因此应该分析完整的推文。 此外,我还在网上搜索聚类提要的算法。 我遇
我想在 ios 7 中集成 twitter 并希望实现以下功能。1. 从 iOS 应用程序使用 Twitter 登录。2. 获取用户资料信息 我尝试了几个解决方案,但没有一个对我有用。请帮忙。 最佳答
是否有任何方法可以使用用户 ID 或屏幕名称构建个人资料图像 URL?我将用户 ID 存储在数据库中,但我不想存储个人资料图像 url。 编辑: 我也不想进行 api 调用。我想将 user_id 放
在 iOS5 上,是否可以提示用户并将其引导至 Twitter Settings.app 区域,以便他们可以将自己的 Twitter 帐户添加到手机中?如果是,你是怎么做到的? 作为解决方法,我可以指
有许多网站为 Twitter 提供附加服务: hashtags.org tweetmeme.com repeets.com dailyrt.com backtweets.com 他们都有一个共同点:他
我正在使用 Twitter Bootstrap 并尝试使用背景打印页面。 我尝试了网络浏览器中的所有选项,但它不起作用。 如果我不包括 twitter bootstrap,则背景的打印效果很好。 (顺
我是一名优秀的程序员,十分优秀!