本文整理汇总了Java中com.twitter.util.TimeoutException类的典型用法代码示例。如果您正苦于以下问题:Java TimeoutException类的具体用法?Java TimeoutException怎么用?Java TimeoutException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TimeoutException类属于com.twitter.util包,在下文中一共展示了TimeoutException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLog
import com.twitter.util.TimeoutException; //导入依赖的package包/类
public static void createLog(Settings settings, String indexName, String indexUUID, int shardId, String localNodeId) throws IOException {
int retryNum = 0;
while (true) {
try {
String tmpLogName = getLogName(indexName, indexUUID, shardId);
DistributedLogNamespace logNamespace = DLNamespace.getNamespace(settings, localNodeId);
boolean isLogExist = logNamespace.logExists(tmpLogName);
if (!isLogExist) {
logNamespace.createLog(tmpLogName);
continue;
}
return;
} catch (Throwable t) {
++ retryNum;
if ((t instanceof TimeoutException || t.getCause() instanceof TimeoutException) && retryNum <= 5) {
continue;
} else {
throw t;
}
}
}
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:DistributedTranslog.java
示例2: unlock
import com.twitter.util.TimeoutException; //导入依赖的package包/类
@Override
public void unlock() {
Future<BoxedUnit> unlockResult = asyncUnlock();
try {
Await.result(unlockResult, Duration.fromMilliseconds(lockOpTimeout));
} catch (TimeoutException toe) {
// This shouldn't happen unless we lose a watch, and may result in a leaked lock.
LOG.error("Timeout unlocking {} owned by {} : ", new Object[] { lockPath, lockId, toe });
} catch (Exception e) {
LOG.warn("{} failed to unlock {} : ", new Object[] { lockId, lockPath, e });
}
}
开发者ID:twitter,项目名称:distributedlog,代码行数:13,代码来源:ZKSessionLock.java
示例3: testLockStreamSameSubscriber
import com.twitter.util.TimeoutException; //导入依赖的package包/类
@Test(timeout = 60000)
public void testLockStreamSameSubscriber() throws Exception {
String streamName = runtime.getMethodName();
BKDistributedLogManager bkdlm = createNewDLM(conf, streamName);
DLMTestUtil.generateLogSegmentNonPartitioned(bkdlm, 0, 5, 1);
BKLogReadHandler readHandler = bkdlm.createReadHandler();
Await.result(readHandler.lockStream());
// same subscrbiers couldn't lock stream in parallel
BKDistributedLogManager bkdlm10 = createNewDLM(conf, streamName);
BKLogReadHandler s10Handler =
bkdlm10.createReadHandler(Optional.of("s1"));
Await.result(s10Handler.lockStream());
BKDistributedLogManager bkdlm11 = createNewDLM(conf, streamName);
BKLogReadHandler s11Handler =
bkdlm11.createReadHandler(Optional.of("s1"));
try {
Await.result(s11Handler.lockStream(), Duration.apply(10000, TimeUnit.MILLISECONDS));
fail("Should fail lock stream using same subscriber id");
} catch (OwnershipAcquireFailedException oafe) {
// expected
} catch (TimeoutException te) {
// expected.
}
readHandler.asyncClose();
bkdlm.close();
s10Handler.asyncClose();
bkdlm10.close();
s11Handler.asyncClose();
bkdlm11.close();
}
开发者ID:twitter,项目名称:distributedlog,代码行数:34,代码来源:TestBKLogReadHandler.java
示例4: main
import com.twitter.util.TimeoutException; //导入依赖的package包/类
public static void main(String[] args) throws TimeoutException, InterruptedException {
HelloService.FutureIface impl = new HelloImpl();
ListeningServer server = Thrift.server().serveIface("localhost:9097", impl);
Await.ready(server);
}
开发者ID:csaltos,项目名称:hello-finagle-maven,代码行数:6,代码来源:HelloThriftServer.java
注:本文中的com.twitter.util.TimeoutException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论