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/02/22 13:30:18 UTC

[GitHub] [incubator-inlong] kipshi opened a new pull request #2664: [INLONG=2662] Fix bug to avoid reinit of service task

kipshi opened a new pull request #2664:
URL: https://github.com/apache/incubator-inlong/pull/2664


   ### Title Name: [INLONG-XYZ][component] Title of the pull request
   
   where *XYZ* should be replaced by the actual issue number.
   
   Fixes #2662 
   
   ### Motivation
   
   ### Modifications
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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] gosonzhang commented on a change in pull request #2664: [INLONG-2662] Fix bug to avoid reinit of service task

Posted by GitBox <gi...@apache.org>.
gosonzhang commented on a change in pull request #2664:
URL: https://github.com/apache/incubator-inlong/pull/2664#discussion_r812516805



##########
File path: inlong-manager/manager-workflow/src/main/java/org/apache/inlong/manager/workflow/definition/ServiceTask.java
##########
@@ -42,6 +44,8 @@
 
     private ServiceTaskType serviceTaskType;
 
+    private boolean isInit;

Review comment:
       For isInit
   
   If there is multi-threaded access, it is recommended to add volatile define. If there is a multi-threaded concurrent modification, at least a lock is required to avoid reentrancy




-- 
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 #2664: [INLONG-2662][Manager] Fix bug to avoid reinit of service task

Posted by GitBox <gi...@apache.org>.
dockerzhang merged pull request #2664:
URL: https://github.com/apache/incubator-inlong/pull/2664


   


-- 
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] kipshi commented on a change in pull request #2664: [INLONG-2662] Fix bug to avoid reinit of service task

Posted by GitBox <gi...@apache.org>.
kipshi commented on a change in pull request #2664:
URL: https://github.com/apache/incubator-inlong/pull/2664#discussion_r812520173



##########
File path: inlong-manager/manager-workflow/src/main/java/org/apache/inlong/manager/workflow/definition/ServiceTask.java
##########
@@ -42,6 +44,8 @@
 
     private ServiceTaskType serviceTaskType;
 
+    private boolean isInit;

Review comment:
       Excellent comment !!




-- 
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] kipshi commented on a change in pull request #2664: [INLONG-2662] Fix bug to avoid reinit of service task

Posted by GitBox <gi...@apache.org>.
kipshi commented on a change in pull request #2664:
URL: https://github.com/apache/incubator-inlong/pull/2664#discussion_r812522898



##########
File path: inlong-manager/manager-workflow/src/main/java/org/apache/inlong/manager/workflow/definition/ServiceTask.java
##########
@@ -42,6 +44,8 @@
 
     private ServiceTaskType serviceTaskType;
 
+    private boolean isInit;

Review comment:
       I prefer to use CAS to avoid multi-thread modification like this;
   
   private AtomicBoolean isInit = new AtomicBoolean(false);
   
   public void initListeners(WorkflowContext workflowContext) {
           if (isInit.compareAndSet(false, true)) {
               if (listenerProvider == null || serviceTaskType == null) {
                   return;
               }
               Iterable<TaskEventListener> listeners = listenerProvider.get(workflowContext, serviceTaskType);
               addListeners(Lists.newArrayList(listeners));
           } else {
               log.debug("ServiceTask:{} is already init", getName());
           }
       }




-- 
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