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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]