fuweng11 commented on code in PR #10602:
URL: https://github.com/apache/inlong/pull/10602#discussion_r1673588923


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AgentServiceImpl.java:
##########
@@ -293,6 +302,43 @@ public void report(TaskRequest request) {
         }
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    public void reload() {
+        LOGGER.debug("start to reload agent task config.");
+        try {
+            Map<String, TaskResult> tempTaskConfigMap = new 
ConcurrentHashMap<>();
+            Map<String, AgentConfigInfo> tempAgentConfigMap = new 
ConcurrentHashMap<>();
+            List<AgentTaskConfigEntity> agentTaskConfigEntityList = 
configLoader.loadAllAgentTaskConfigEntity();
+            agentTaskConfigEntityList.forEach(agentTaskConfigEntity -> {
+                try {
+                    String key = agentTaskConfigEntity.getAgentIp() + 
InlongConstants.UNDERSCORE
+                            + agentTaskConfigEntity.getClusterName();
+                    TaskResult taskResult = 
JsonUtils.parseObject(agentTaskConfigEntity.getTaskParams(),
+                            TaskResult.class);
+                    if (taskResult != null) {
+                        
taskResult.setVersion(agentTaskConfigEntity.getVersion());
+                        tempTaskConfigMap.putIfAbsent(key, taskResult);
+                    }
+                    AgentConfigInfo agentConfigInfo = 
JsonUtils.parseObject(agentTaskConfigEntity.getConfigParams(),
+                            AgentConfigInfo.class);
+                    if (agentConfigInfo != null) {
+                        
agentConfigInfo.setVersion(agentTaskConfigEntity.getVersion());
+                        tempAgentConfigMap.putIfAbsent(key, agentConfigInfo);
+                    }
+                } catch (Exception e) {
+                    LOGGER.error("failed to get agent task confgi for agent 
ip={}, cluster name={}",

Review Comment:
   Fixed.



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AgentServiceImpl.java:
##########
@@ -266,6 +269,12 @@ private void startHeartbeatTask() {
         }
     }
 
+    private void setReloadTimer() {
+        ScheduledExecutorService executorService = 
Executors.newSingleThreadScheduledExecutor();
+        long reloadInterval = 60000L;

Review Comment:
   Fixed.



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AgentServiceImpl.java:
##########
@@ -293,6 +302,43 @@ public void report(TaskRequest request) {
         }
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    public void reload() {
+        LOGGER.debug("start to reload agent task config.");
+        try {
+            Map<String, TaskResult> tempTaskConfigMap = new 
ConcurrentHashMap<>();

Review Comment:
   Fixed.



-- 
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-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to