@Override public void cleanup() { _running = false; _metricsConsumer.cleanup(); _taskExecuteThread.interrupt(); }
@Override public void run() { while (_running) { try { MetricsTask task = _taskQueue.take(); _metricsConsumer.handleDataPoints(task.getTaskInfo(), task.getDataPoints()); } catch (InterruptedException e) { break; } catch (Throwable t) { LOG.error("Exception occurred during handle metrics", t); } } } }
@Override public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { try { _metricsConsumer = (IMetricsConsumer) Class.forName(_consumerClassName).newInstance(); } catch (Exception e) { throw new RuntimeException("Could not instantiate a class listed in config under section " + Config.TOPOLOGY_METRICS_CONSUMER_REGISTER + " with fully qualified name " + _consumerClassName, e); } _metricsConsumer.prepare(topoConf, _registrationArgument, context, collector); _collector = collector; _taskExecuteThread = new Thread(new MetricsHandlerRunnable()); _taskExecuteThread.setDaemon(true); _taskExecuteThread.start(); }
@Override public void cleanup() { _running = false; _metricsConsumer.cleanup(); _taskExecuteThread.interrupt(); }
@Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { try { _metricsConsumer = (IMetricsConsumer) Class.forName(_consumerClassName).newInstance(); } catch (Exception e) { throw new RuntimeException("Could not instantiate a class listed in config under section " + Config.TOPOLOGY_METRICS_CONSUMER_REGISTER + " with fully qualified name " + _consumerClassName, e); } _metricsConsumer.prepare(stormConf, _registrationArgument, context, collector); _collector = collector; _taskExecuteThread = new Thread(new MetricsHandlerRunnable()); _taskExecuteThread.setDaemon(true); _taskExecuteThread.start(); }
@Override public void run() { while (_running) { try { MetricsTask task = _taskQueue.take(); _metricsConsumer.handleDataPoints(task.getTaskInfo(), task.getDataPoints()); } catch (InterruptedException e) { break; } catch (Throwable t) { LOG.error("Exception occurred during handle metrics", t); } } } }