- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.twitter.distributedlog.exceptions.ZKException.getKeeperExceptionCode()
方法的一些代码示例,展示了ZKException.getKeeperExceptionCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKException.getKeeperExceptionCode()
方法的具体详情如下:
包路径:com.twitter.distributedlog.exceptions.ZKException
类名称:ZKException
方法名:getKeeperExceptionCode
暂无
代码示例来源: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
@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
@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
@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
@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
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
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
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
@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
ZKException zke = (ZKException) t;
assertEquals("Transaction is aborted",
KeeperException.Code.NONODE, zke.getKeeperExceptionCode());
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testStoreMaxLogSegmentSequenceNumberOnNonExistentPath() throws Exception {
Transaction<Object> updateTxn = lsmStore.transaction();
Versioned<Long> value = new Versioned<Long>(999L, new ZkVersion(10));
final Promise<Version> result = new Promise<Version>();
String nonExistentPath = rootZkPath + "/non-existent";
lsmStore.storeMaxLogSegmentSequenceNumber(updateTxn, nonExistentPath, value,
new Transaction.OpListener<Version>() {
@Override
public void onCommit(Version r) {
result.setValue(r);
}
@Override
public void onAbort(Throwable t) {
result.setException(t);
}
});
try {
FutureUtils.result(updateTxn.execute());
fail("Should fail on storing log segment sequence number if path doesn't exist");
} catch (ZKException zke) {
assertEquals(KeeperException.Code.NONODE, zke.getKeeperExceptionCode());
}
try {
Await.result(result);
fail("Should fail on storing log segment sequence number if path doesn't exist");
} catch (KeeperException ke) {
assertEquals(KeeperException.Code.NONODE, ke.code());
}
}
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testStoreMaxTxnIdOnNonExistentPath() throws Exception {
Transaction<Object> updateTxn = lsmStore.transaction();
Versioned<Long> value = new Versioned<Long>(999L, new ZkVersion(10));
final Promise<Version> result = new Promise<Version>();
String nonExistentPath = rootZkPath + "/non-existent";
lsmStore.storeMaxLogSegmentSequenceNumber(updateTxn, nonExistentPath, value,
new Transaction.OpListener<Version>() {
@Override
public void onCommit(Version r) {
result.setValue(r);
}
@Override
public void onAbort(Throwable t) {
result.setException(t);
}
});
try {
FutureUtils.result(updateTxn.execute());
fail("Should fail on storing log record transaction id if path doesn't exist");
} catch (ZKException zke) {
assertEquals(KeeperException.Code.NONODE, zke.getKeeperExceptionCode());
}
try {
Await.result(result);
fail("Should fail on storing log record transaction id if path doesn't exist");
} catch (KeeperException ke) {
assertEquals(KeeperException.Code.NONODE, ke.code());
}
}
我是hadoop的新手,如果这看起来很愚蠢,我很抱歉,但这就是正在发生的事情。 我正在努力设置一个多节点 kakfa 代理,以便测试实时摄取,并且由于 kafka 需要 ZK,因此建议最好运行一个复制
本文整理了Java中org.I0Itec.zkclient.exception.ZkException.getMessage()方法的一些代码示例,展示了ZkException.getMessage(
本文整理了Java中org.I0Itec.zkclient.exception.ZkException.create()方法的一些代码示例,展示了ZkException.create()的具体用法。这
本文整理了Java中org.I0Itec.zkclient.exception.ZkException.()方法的一些代码示例,展示了ZkException.()的具体用法。这些代码示例主要来源于Gi
本文整理了Java中com.twitter.distributedlog.exceptions.ZKException.getKeeperExceptionCode()方法的一些代码示例,展示了ZKE
本文整理了Java中com.github.ltsopensource.zookeeper.lts.ZkException.getCause()方法的一些代码示例,展示了ZkException.getC
本文整理了Java中com.github.ltsopensource.zookeeper.lts.ZkException.isZkNoNodeException()方法的一些代码示例,展示了ZkExc
我是一名优秀的程序员,十分优秀!