Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
198e154e
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
198e154e
编写于
7月 19, 2019
作者:
Y
Yuto Furuta
提交者:
Jia Zhai
8月 28, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add timeout to internal rest api (#4762)
(cherry picked from commit
9605aede
)
上级
d2a4ca4f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
17 deletion
+53
-17
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NonPersistentTopicsImpl.java
...pulsar/client/admin/internal/NonPersistentTopicsImpl.java
+23
-7
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java
...a/org/apache/pulsar/client/admin/internal/TopicsImpl.java
+30
-10
未找到文件。
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NonPersistentTopicsImpl.java
浏览文件 @
198e154e
...
...
@@ -23,6 +23,8 @@ import static com.google.common.base.Preconditions.checkArgument;
import
java.util.List
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
javax.ws.rs.client.Entity
;
import
javax.ws.rs.client.InvocationCallback
;
...
...
@@ -52,12 +54,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
void
createPartitionedTopic
(
String
topic
,
int
numPartitions
)
throws
PulsarAdminException
{
try
{
createPartitionedTopicAsync
(
topic
,
numPartitions
).
get
();
createPartitionedTopicAsync
(
topic
,
numPartitions
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -72,12 +76,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
PartitionedTopicMetadata
getPartitionedTopicMetadata
(
String
topic
)
throws
PulsarAdminException
{
try
{
return
getPartitionedTopicMetadataAsync
(
topic
).
get
();
return
getPartitionedTopicMetadataAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -105,12 +111,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
NonPersistentTopicStats
getStats
(
String
topic
)
throws
PulsarAdminException
{
try
{
return
getStatsAsync
(
topic
).
get
();
return
getStatsAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -138,12 +146,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
PersistentTopicInternalStats
getInternalStats
(
String
topic
)
throws
PulsarAdminException
{
try
{
return
getInternalStatsAsync
(
topic
).
get
();
return
getInternalStatsAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -171,12 +181,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
void
unload
(
String
topic
)
throws
PulsarAdminException
{
try
{
unloadAsync
(
topic
).
get
();
unloadAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -190,12 +202,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
List
<
String
>
getListInBundle
(
String
namespace
,
String
bundleRange
)
throws
PulsarAdminException
{
try
{
return
getListInBundleAsync
(
namespace
,
bundleRange
).
get
();
return
getListInBundleAsync
(
namespace
,
bundleRange
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -221,12 +235,14 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public
List
<
String
>
getList
(
String
namespace
)
throws
PulsarAdminException
{
try
{
return
getListAsync
(
namespace
).
get
();
return
getListAsync
(
namespace
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java
浏览文件 @
198e154e
...
...
@@ -131,12 +131,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
List
<
String
>
getListInBundle
(
String
namespace
,
String
bundleRange
)
throws
PulsarAdminException
{
try
{
return
getListInBundleAsync
(
namespace
,
bundleRange
).
get
();
return
getListInBundleAsync
(
namespace
,
bundleRange
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -197,24 +199,28 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
void
createPartitionedTopic
(
String
topic
,
int
numPartitions
)
throws
PulsarAdminException
{
try
{
createPartitionedTopicAsync
(
topic
,
numPartitions
).
get
();
createPartitionedTopicAsync
(
topic
,
numPartitions
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
@Override
public
void
createNonPartitionedTopic
(
String
topic
)
throws
PulsarAdminException
{
try
{
createNonPartitionedTopicAsync
(
topic
).
get
(
);
createNonPartitionedTopicAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -236,12 +242,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
void
updatePartitionedTopic
(
String
topic
,
int
numPartitions
)
throws
PulsarAdminException
{
try
{
updatePartitionedTopicAsync
(
topic
,
numPartitions
).
get
();
updatePartitionedTopicAsync
(
topic
,
numPartitions
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -256,12 +264,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
PartitionedTopicMetadata
getPartitionedTopicMetadata
(
String
topic
)
throws
PulsarAdminException
{
try
{
return
getPartitionedTopicMetadataAsync
(
topic
).
get
();
return
getPartitionedTopicMetadataAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -294,12 +304,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
void
deletePartitionedTopic
(
String
topic
,
boolean
force
)
throws
PulsarAdminException
{
try
{
deletePartitionedTopicAsync
(
topic
,
force
).
get
();
deletePartitionedTopicAsync
(
topic
,
force
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -319,12 +331,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
void
delete
(
String
topic
,
boolean
force
)
throws
PulsarAdminException
{
try
{
deleteAsync
(
topic
,
force
).
get
();
deleteAsync
(
topic
,
force
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -339,12 +353,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
void
unload
(
String
topic
)
throws
PulsarAdminException
{
try
{
unloadAsync
(
topic
).
get
();
unloadAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -358,12 +374,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
List
<
String
>
getSubscriptions
(
String
topic
)
throws
PulsarAdminException
{
try
{
return
getSubscriptionsAsync
(
topic
).
get
();
return
getSubscriptionsAsync
(
topic
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
@@ -595,12 +613,14 @@ public class TopicsImpl extends BaseResource implements Topics {
@Override
public
void
skipAllMessages
(
String
topic
,
String
subName
)
throws
PulsarAdminException
{
try
{
skipAllMessagesAsync
(
topic
,
subName
).
get
();
skipAllMessagesAsync
(
topic
,
subName
).
get
(
this
.
readTimeoutMs
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
ExecutionException
e
)
{
throw
(
PulsarAdminException
)
e
.
getCause
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
throw
new
PulsarAdminException
(
e
);
}
catch
(
TimeoutException
e
)
{
throw
new
PulsarAdminException
.
TimeoutException
(
e
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录