xxubai commented on code in PR #4073:
URL: https://github.com/apache/amoro/pull/4073#discussion_r2851022535


##########
amoro-ams/src/main/java/org/apache/amoro/server/table/DefaultTableService.java:
##########
@@ -182,23 +136,46 @@ public void initialize() {
         continue;
       }
       List<TableRuntimeState> states = 
statesMap.get(tableRuntimeMeta.getTableId());
-      Optional<TableRuntime> tableRuntime =
-          createTableRuntime(identifier, tableRuntimeMeta, states);
-      if (!tableRuntime.isPresent()) {
-        LOG.warn("No available table runtime factory found for table {}", 
identifier);
-        continue;
-      }
-      tableRuntime.ifPresent(
-          t -> {
-            t.registerMetric(MetricManager.getInstance().getGlobalRegistry());
-            tableRuntimeMap.put(t.getTableIdentifier().getId(), t);
-            tableRuntimes.add(t);
-          });
+      createTableRuntime(identifier, tableRuntimeMeta, states)
+          .ifPresentOrElse(
+              tableRuntime ->
+                  
tableRuntimeMap.put(tableRuntime.getTableIdentifier().getId(), tableRuntime),
+              () -> LOG.warn("No available table runtime factory found for 
table {}", identifier));
     }
+  }
 
-    if (headHandler != null) {
-      headHandler.initialize(tableRuntimes);
-    }
+  private void initTableRuntimePlugins() {
+    List<TableRuntime> tableRuntimes = new 
ArrayList<>(tableRuntimeMap.values());
+    tableRuntimePlugins.forEach(plugin -> plugin.initialize(tableRuntimes));

Review Comment:
   I'm not sure if it occur NPE when invoke plugin functions



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

Reply via email to