@Override public boolean isMet() { return AbstractTestRealtimeRecordDelayFilter.this.throughputStage.getRecordsInputPort().isClosed(); // NOPMD } };
@Override protected void onStarting() { super.onStarting(); this.resetTimestamp(System.nanoTime()); }
public RealtimeRecordDelayFilterConfig(final InitialElementProducer<IMonitoringRecord> recordProducer, final Counter<IMonitoringRecord> preDelayCounter, final RealtimeRecordDelayFilter delayFilter, final Clock clock, final AnalysisThroughputFilter throughputStage, final Counter<IMonitoringRecord> postDelayCounter, final CollectorSink<IMonitoringRecord> recordCollectorSink, final CollectorSink<Long> throughputCollectorSink) { this.connectPorts(recordProducer.getOutputPort(), preDelayCounter.getInputPort()); this.connectPorts(preDelayCounter.getOutputPort(), delayFilter.getInputPort()); this.connectPorts(delayFilter.getOutputPort(), postDelayCounter.getInputPort()); this.connectPorts(postDelayCounter.getOutputPort(), throughputStage.getRecordsInputPort()); this.connectPorts(throughputStage.getRecordsOutputPort(), recordCollectorSink.getInputPort()); this.connectPorts(clock.getOutputPort(), throughputStage.getTimestampsInputPort()); this.connectPorts(throughputStage.getRecordsCountOutputPort(), throughputCollectorSink.getInputPort()); } }
this.clock.setInitialDelayInMs(5000); this.clock.setIntervalDelayInMs(5000); this.throughputStage = new AnalysisThroughputFilter(); this.throughputStage.declareActive(); this.postDelayCounter = new Counter<>(); this.recordCollectorSink = new CollectorSink<>();
@Override protected void execute() { final IMonitoringRecord record = this.recordsInputPort.receive(); if (record != null) { this.numPassedElements++; this.recordsOutputPort.send(record); } final Long timestampInNs = this.timestampsInputPort.receive(); if (timestampInNs != null) { final long duration = timestampInNs - this.lastTimestampInNs; final StringBuilder sb = new StringBuilder(256).append(this.numPassedElements).append(" objects within ") .append(duration).append(' ').append(TimeUnit.NANOSECONDS.toString()); this.plainTextDisplayObject.setText(sb.toString()); this.recordsCountOutputPort.send(this.numPassedElements); this.resetTimestamp(timestampInNs); } }