Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
2ee109ee
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
2ee109ee
编写于
8月 21, 2020
作者:
B
Boyang Jerry Peng
提交者:
GitHub
8月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: close() never gets called for BatchSource (#7866)
Motivation close() method never gets called in BatchSource
上级
7d9319d8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
2 deletion
+13
-2
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutor.java
...he/pulsar/functions/source/batch/BatchSourceExecutor.java
+3
-0
pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutorTest.java
...ulsar/functions/source/batch/BatchSourceExecutorTest.java
+10
-2
未找到文件。
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutor.java
浏览文件 @
2ee109ee
...
...
@@ -183,6 +183,9 @@ public class BatchSourceExecutor<T> implements Source<T> {
intermediateTopicConsumer
.
close
();
intermediateTopicConsumer
=
null
;
}
if
(
batchSource
!=
null
)
{
batchSource
.
close
();
}
}
private
void
setupInstanceSubscription
()
{
...
...
pulsar-functions/instance/src/test/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutorTest.java
浏览文件 @
2ee109ee
...
...
@@ -54,6 +54,8 @@ public class BatchSourceExecutorTest {
private
static
int
discoverCount
;
@Getter
private
static
int
recordCount
;
@Getter
private
static
int
closeCount
;
private
Record
record
=
Mockito
.
mock
(
Record
.
class
);
public
TestBatchSource
()
{
}
...
...
@@ -87,7 +89,7 @@ public class BatchSourceExecutorTest {
@Override
public
void
close
()
throws
Exception
{
closeCount
++;
}
}
...
...
@@ -98,6 +100,8 @@ public class BatchSourceExecutorTest {
private
static
int
discoverCount
;
@Getter
private
static
int
recordCount
;
@Getter
private
static
int
closeCount
;
private
Record
record
=
Mockito
.
mock
(
Record
.
class
);
public
TestBatchPushSource
()
{
}
...
...
@@ -127,7 +131,7 @@ public class BatchSourceExecutorTest {
@Override
public
void
close
()
throws
Exception
{
closeCount
++;
}
}
...
...
@@ -344,6 +348,8 @@ public class BatchSourceExecutorTest {
discoveryBarrier
.
await
();
Assert
.
assertTrue
(
testBatchSource
.
getDiscoverCount
()
>=
2
);
Assert
.
assertTrue
(
testBatchSource
.
getDiscoverCount
()
<=
3
);
batchSourceExecutor
.
close
();
Assert
.
assertEquals
(
testBatchSource
.
getCloseCount
(),
1
);
}
@Test
...
...
@@ -362,5 +368,7 @@ public class BatchSourceExecutorTest {
discoveryBarrier
.
await
();
Assert
.
assertTrue
(
testBatchPushSource
.
getDiscoverCount
()
>=
2
);
Assert
.
assertTrue
(
testBatchPushSource
.
getDiscoverCount
()
<=
3
);
batchSourceExecutor
.
close
();
Assert
.
assertEquals
(
testBatchPushSource
.
getCloseCount
(),
1
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录