@Override public void execute(Tuple tuple) { long start = System.nanoTime(); CDR cdr = fromTuple(tuple); UserPattern pattern = UserPattern.patternFor(cdr.src); if (pattern != null && pattern.isConverged()) { // is converged? 4 weeks;dispersion if (!pattern.isConform(cdr, useTrend)) { collector.emit(tuple.getValues()); } pattern.maintain(cdr); } long end = System.nanoTime(); monitoring.newMetricValue( "process_time", cdr.start, String.valueOf((end - start) / 1000. / 1000. / 1000.), "0.015"); }
@Override public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) { collector = outputCollector; UserPattern.init(); }