odraese commented on a change in pull request #691: HIVE-21911: Pluggable 
LlapMetricsListener on Tez side to disable / resize Daemons
URL: https://github.com/apache/hive/pull/691#discussion_r298310874
 
 

 ##########
 File path: 
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/metrics/LlapMetricsCollector.java
 ##########
 @@ -58,26 +61,44 @@
   private final Map<String, LlapManagementProtocolClientImpl> llapClients;
   private final Map<String, LlapMetrics> instanceStatisticsMap;
   private final long metricsCollectionMs;
+  @VisibleForTesting
+  final LlapMetricsListener listener;
 
 
-  public LlapMetricsCollector(Configuration conf) {
+  public LlapMetricsCollector(Configuration conf, LlapRegistryService 
registry) {
     this(
             conf,
             Executors.newSingleThreadScheduledExecutor(
                     new 
ThreadFactoryBuilder().setDaemon(true).setNameFormat(THREAD_NAME)
                             .build()),
-            LlapManagementProtocolClientImplFactory.basicInstance(conf));
+            LlapManagementProtocolClientImplFactory.basicInstance(conf),
+            registry);
   }
 
   @VisibleForTesting
   LlapMetricsCollector(Configuration conf, ScheduledExecutorService 
scheduledMetricsExecutor,
-                       LlapManagementProtocolClientImplFactory clientFactory) {
+                       LlapManagementProtocolClientImplFactory clientFactory,
+                       LlapRegistryService registry) {
     this.scheduledMetricsExecutor = scheduledMetricsExecutor;
     this.clientFactory = clientFactory;
     this.llapClients = new HashMap<>();
     this.instanceStatisticsMap = new ConcurrentHashMap<>();
     this.metricsCollectionMs = HiveConf.getTimeVar(conf,
             
HiveConf.ConfVars.LLAP_TASK_SCHEDULER_AM_COLLECT_DAEMON_METRICS_MS, 
TimeUnit.MILLISECONDS);
+    String listenerClass = HiveConf.getVar(conf,
+        
HiveConf.ConfVars.LLAP_TASK_SCHEDULER_AM_COLLECT_DAEMON_METRICS_LISTENER);
+    if (Strings.isBlank(listenerClass)) {
+      listener = null;
+    } else {
+      try {
+        listener = 
(LlapMetricsListener)Class.forName(listenerClass.trim()).newInstance();
 
 Review comment:
   Maybe the instance should be created through something like the 
ReflectionUtil?
   This would ensure that we have an accessible constructor and be the common 
way.... (I believe).

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


With regards,
Apache Git Services

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

Reply via email to