You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/01/24 02:36:30 UTC

[GitHub] [hadoop-ozone] linyiqun commented on a change in pull request #480: HDDS-2927. Cache EndPoint tasks instead of creating them all the time in RunningDatanodeState

linyiqun commented on a change in pull request #480: HDDS-2927. Cache EndPoint tasks instead of creating them all the time in RunningDatanodeState
URL: https://github.com/apache/hadoop-ozone/pull/480#discussion_r370452243
 
 

 ##########
 File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java
 ##########
 @@ -49,14 +52,62 @@
   private final SCMConnectionManager connectionManager;
   private final Configuration conf;
   private final StateContext context;
-  private CompletionService<EndpointStateMachine.EndPointStates> ecs;
+  private CompletionService<EndPointStates> ecs;
+  /** Cache the end point task per end point per end point state. */
+  private Map<String, Map<EndPointStates,
+      Callable<EndPointStates>>> endpointTasks;
 
   public RunningDatanodeState(Configuration conf,
       SCMConnectionManager connectionManager,
       StateContext context) {
     this.connectionManager = connectionManager;
     this.conf = conf;
     this.context = context;
+    initEndPointTask();
+  }
+
+  /**
+   * Initialize end point tasks corresponding to each end point,
+   * each end point state.
+   */
+  private void initEndPointTask() {
+    endpointTasks = new HashMap<String, Map<EndPointStates,
+        Callable<EndPointStates>>>();
+    for (EndpointStateMachine endpoint : connectionManager.getValues()) {
+      Map<EndPointStates, Callable<EndPointStates>> endpointTaskForState
+          = new HashMap<EndPointStates, Callable<EndPointStates>>();
+
+      for (EndPointStates state : EndPointStates.values()) {
+        Callable<EndPointStates> endPointTask = null;
+        switch (endpoint.getState()) {
 
 Review comment:
   Yes, it should be state, it's my typo. Here we will create endpoint task for each state type.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org