You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by GitBox <gi...@apache.org> on 2019/11/22 15:54:27 UTC

[GitHub] [submarine] adamantal commented on a change in pull request #96: SUBMARINE-60. Remove stubServiceClient from YarnServiceUtils

adamantal commented on a change in pull request #96: SUBMARINE-60. Remove stubServiceClient from YarnServiceUtils
URL: https://github.com/apache/submarine/pull/96#discussion_r349666134
 
 

 ##########
 File path: submarine-server/server-submitter/submitter-yarnservice/src/main/java/org/apache/submarine/server/submitter/yarnservice/YarnServiceUtils.java
 ##########
 @@ -30,35 +30,31 @@
  * based on the provided parameters.
  */
 public final class YarnServiceUtils {
-  private YarnServiceUtils() {
-  }
-
-  // This will be true only in UT.
-  private static AppAdminClient stubServiceClient = null;
-
-  static AppAdminClient createServiceClient(
-      Configuration yarnConfiguration) {
-    if (stubServiceClient != null) {
-      return stubServiceClient;
-    }
+  private static AppAdminClientFactory appAdminClientFactory =
+          new AppAdminClientFactory();
 
-    return AppAdminClient.createAppAdminClient(DEFAULT_TYPE, yarnConfiguration);
+  private YarnServiceUtils() {
   }
 
   @VisibleForTesting
-  public static void setStubServiceClient(AppAdminClient stubServiceClient) {
-    YarnServiceUtils.stubServiceClient = stubServiceClient;
+  public static void setAppAdminClientFactory(
+          AppAdminClientFactory appAdminClientFactory) {
+    YarnServiceUtils.appAdminClientFactory = appAdminClientFactory;
   }
 
-  public static String getDNSName(String serviceName,
-      String componentInstanceName, String userName, String domain, int port) {
-    return componentInstanceName + getDNSNameCommonSuffix(serviceName, userName,
-        domain, port);
+  static AppAdminClient createServiceClient(
+          Configuration yarnConfiguration) {
+    return appAdminClientFactory.createDefault(yarnConfiguration);
   }
 
   public static String getDNSNameCommonSuffix(String serviceName,
-      String userName, String domain, int port) {
+                                              String userName, String domain, int port) {
 
 Review comment:
   Done (and also removed extra whitespaces from the whole class).

----------------------------------------------------------------
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: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org