You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/03/03 07:36:35 UTC
[GitHub] [incubator-inlong] zk1510 opened a new pull request #2864: [INLONG-2859][Agent] Optimize stopping Kafka tasks
zk1510 opened a new pull request #2864:
URL: https://github.com/apache/incubator-inlong/pull/2864
### Title Name: [INLONG-2859][Agent] Optimize stopping Kafka tasks
Fixes #2859
### Motivation
optimize stopping kafka tasks
### Modifications
simiplify code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-inlong] EMsnap commented on a change in pull request #2864: [INLONG-2859][Agent] Optimize stopping Kafka tasks
Posted by GitBox <gi...@apache.org>.
EMsnap commented on a change in pull request #2864:
URL: https://github.com/apache/incubator-inlong/pull/2864#discussion_r818406199
##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/KafkaReader.java
##########
@@ -147,29 +150,14 @@ public Message read() {
@Override
public boolean isFinished() {
- if (iterator == null) {
- // fetch data
- fetchData(5000);
- return false;
- }
- if (iterator.hasNext()) {
- lastTime = 0;
- return false;
- }
- // fetch data
- boolean fetchDataSuccess = fetchData(5000);
- if (fetchDataSuccess && iterator.hasNext()) {
- lastTime = 0;
- return false;
- } else {
- if (lastTime == 0) {
- lastTime = System.currentTimeMillis();
+ if (!isFinished) {
+ if (iterator == null || !iterator.hasNext()) {
+ // fetch data
+ fetchData(5000);
Review comment:
why fetch data occured in isFinished () ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-inlong] zk1510 commented on a change in pull request #2864: [INLONG-2859][Agent] Optimize stopping Kafka tasks
Posted by GitBox <gi...@apache.org>.
zk1510 commented on a change in pull request #2864:
URL: https://github.com/apache/incubator-inlong/pull/2864#discussion_r818426221
##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/KafkaReader.java
##########
@@ -147,29 +150,14 @@ public Message read() {
@Override
public boolean isFinished() {
- if (iterator == null) {
- // fetch data
- fetchData(5000);
- return false;
- }
- if (iterator.hasNext()) {
- lastTime = 0;
- return false;
- }
- // fetch data
- boolean fetchDataSuccess = fetchData(5000);
- if (fetchDataSuccess && iterator.hasNext()) {
- lastTime = 0;
- return false;
- } else {
- if (lastTime == 0) {
- lastTime = System.currentTimeMillis();
+ if (!isFinished) {
+ if (iterator == null || !iterator.hasNext()) {
+ // fetch data
+ fetchData(5000);
Review comment:
1.first,fetch data occured in init()
2.After the consumer poll data is read,then continue fetch data, but The premise is that the task does not stop
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-inlong] EMsnap commented on a change in pull request #2864: [INLONG-2859][Agent] Optimize stopping Kafka tasks
Posted by GitBox <gi...@apache.org>.
EMsnap commented on a change in pull request #2864:
URL: https://github.com/apache/incubator-inlong/pull/2864#discussion_r818440035
##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/KafkaReader.java
##########
@@ -147,29 +150,14 @@ public Message read() {
@Override
public boolean isFinished() {
- if (iterator == null) {
- // fetch data
- fetchData(5000);
- return false;
- }
- if (iterator.hasNext()) {
- lastTime = 0;
- return false;
- }
- // fetch data
- boolean fetchDataSuccess = fetchData(5000);
- if (fetchDataSuccess && iterator.hasNext()) {
- lastTime = 0;
- return false;
- } else {
- if (lastTime == 0) {
- lastTime = System.currentTimeMillis();
+ if (!isFinished) {
+ if (iterator == null || !iterator.hasNext()) {
+ // fetch data
+ fetchData(5000);
Review comment:
fetch data should be extracted to read() I think
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-inlong] dockerzhang merged pull request #2864: [INLONG-2859][Agent] Optimize stopping Kafka tasks
Posted by GitBox <gi...@apache.org>.
dockerzhang merged pull request #2864:
URL: https://github.com/apache/incubator-inlong/pull/2864
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org