narendly commented on a change in pull request #1011:
URL: https://github.com/apache/helix/pull/1011#discussion_r425534270



##########
File path: helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
##########
@@ -1137,4 +1140,89 @@ private void validateZKNodeLimitation(int 
newConfigNodeCount) {
           "Cannot create more workflows or jobs because there are already too 
many items created in the path CONFIGS.");
     }
   }
+
+  /**
+   * Get the target task thread pool size of an instance, a value that's used 
to construct the task
+   * thread pool and is created by users.
+   * @param instanceName - name of the instance
+   * @return the target task thread pool size of the instance
+   */
+  public int getTargetTaskThreadPoolSize(String instanceName) {
+    InstanceConfig instanceConfig =
+        
_accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName));
+    if (instanceConfig == null) {
+      throw new IllegalArgumentException(
+          "Failed to find InstanceConfig with provided instance name " + 
instanceName);
+    }
+
+    return instanceConfig.getTargetTaskThreadPoolSize();
+  }
+
+  /**
+   * Set the target task thread pool size of an instance. The target task 
thread pool size goes to
+   * InstanceConfig, and is used to construct the task thread pool. The 
construction of thread pool
+   * requires JVM restart after the target value has been set.
+   * @param instanceName - name of the instance
+   * @param targetTaskThreadPoolSize - the target task thread pool size of the 
instance
+   */
+  public void setTargetTaskThreadPoolSize(String instanceName, int 
targetTaskThreadPoolSize) {
+    InstanceConfig instanceConfig =
+        
_accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName));
+    if (instanceConfig == null) {
+      throw new IllegalArgumentException(
+          "Failed to find InstanceConfig with provided instance name " + 
instanceName + "!");
+    }
+
+    instanceConfig.setTargetTaskThreadPoolSize(targetTaskThreadPoolSize);
+  }
+
+  /**
+   * Get the global target task thread pool size of the cluster, a value 
that's used to construct
+   * task thread pools for the cluster's instances and is created by users.
+   * @return the global target task thread pool size of the cluster
+   */
+  public int getGlobalTargetTaskThreadPoolSize() {
+    ClusterConfig clusterConfig = 
_accessor.getProperty(_accessor.keyBuilder().clusterConfig());
+    if (clusterConfig == null) {
+      throw new IllegalStateException("Failed to find ClusterConfig!");

Review comment:
       Nit: add the cluster name here as well?

##########
File path: helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
##########
@@ -1137,4 +1140,89 @@ private void validateZKNodeLimitation(int 
newConfigNodeCount) {
           "Cannot create more workflows or jobs because there are already too 
many items created in the path CONFIGS.");
     }
   }
+
+  /**
+   * Get the target task thread pool size of an instance, a value that's used 
to construct the task
+   * thread pool and is created by users.
+   * @param instanceName - name of the instance
+   * @return the target task thread pool size of the instance
+   */
+  public int getTargetTaskThreadPoolSize(String instanceName) {
+    InstanceConfig instanceConfig =
+        
_accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName));
+    if (instanceConfig == null) {
+      throw new IllegalArgumentException(
+          "Failed to find InstanceConfig with provided instance name " + 
instanceName);
+    }
+
+    return instanceConfig.getTargetTaskThreadPoolSize();
+  }
+
+  /**
+   * Set the target task thread pool size of an instance. The target task 
thread pool size goes to
+   * InstanceConfig, and is used to construct the task thread pool. The 
construction of thread pool
+   * requires JVM restart after the target value has been set.

Review comment:
       A better way to say this is "the newly-set task thread pool size will 
take effect upon a JVM restart"

##########
File path: helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
##########
@@ -1137,4 +1140,89 @@ private void validateZKNodeLimitation(int 
newConfigNodeCount) {
           "Cannot create more workflows or jobs because there are already too 
many items created in the path CONFIGS.");
     }
   }
+
+  /**
+   * Get the target task thread pool size of an instance, a value that's used 
to construct the task
+   * thread pool and is created by users.
+   * @param instanceName - name of the instance
+   * @return the target task thread pool size of the instance
+   */
+  public int getTargetTaskThreadPoolSize(String instanceName) {
+    InstanceConfig instanceConfig =
+        
_accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName));
+    if (instanceConfig == null) {
+      throw new IllegalArgumentException(
+          "Failed to find InstanceConfig with provided instance name " + 
instanceName);
+    }
+
+    return instanceConfig.getTargetTaskThreadPoolSize();
+  }
+
+  /**
+   * Set the target task thread pool size of an instance. The target task 
thread pool size goes to
+   * InstanceConfig, and is used to construct the task thread pool. The 
construction of thread pool
+   * requires JVM restart after the target value has been set.
+   * @param instanceName - name of the instance
+   * @param targetTaskThreadPoolSize - the target task thread pool size of the 
instance
+   */
+  public void setTargetTaskThreadPoolSize(String instanceName, int 
targetTaskThreadPoolSize) {
+    InstanceConfig instanceConfig =
+        
_accessor.getProperty(_accessor.keyBuilder().instanceConfig(instanceName));
+    if (instanceConfig == null) {
+      throw new IllegalArgumentException(
+          "Failed to find InstanceConfig with provided instance name " + 
instanceName + "!");
+    }
+
+    instanceConfig.setTargetTaskThreadPoolSize(targetTaskThreadPoolSize);
+  }
+
+  /**
+   * Get the global target task thread pool size of the cluster, a value 
that's used to construct
+   * task thread pools for the cluster's instances and is created by users.
+   * @return the global target task thread pool size of the cluster
+   */
+  public int getGlobalTargetTaskThreadPoolSize() {
+    ClusterConfig clusterConfig = 
_accessor.getProperty(_accessor.keyBuilder().clusterConfig());
+    if (clusterConfig == null) {
+      throw new IllegalStateException("Failed to find ClusterConfig!");
+    }
+
+    return clusterConfig.getGlobalTargetTaskThreadPoolSize();
+  }
+
+  /**
+   * Set the global target task thread pool size of the cluster. The global 
target task thread pool
+   * size goes to ClusterConfig, and is applied to all instances of the 
cluster. If an instance
+   * doesn't specify its target thread pool size in InstanceConfig, then this 
value in ClusterConfig
+   * will be used to construct its task thread pool. The construction of 
thread pools requires JVM
+   * restart. If none of the global and per-instance target thread pool sizes 
are set, a default
+   * size will be used.
+   * @param globalTargetTaskThreadPoolSize - the global target task thread 
pool size of the cluster
+   */
+  public void setGlobalTargetTaskThreadPoolSize(int 
globalTargetTaskThreadPoolSize) {
+    ClusterConfig clusterConfig = 
_accessor.getProperty(_accessor.keyBuilder().clusterConfig());
+    if (clusterConfig == null) {
+      throw new IllegalStateException("Failed to find ClusterConfig!");

Review comment:
       Nit: add cluster name?




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to