Mercurial > stress-tester
changeset 1289:7d538c69a6e1
NioEmitterWorkerImpl - datagram connection metrics bugfix
author | Devel 2 |
---|---|
date | Tue, 14 Jul 2020 15:32:25 +0200 |
parents | ded8813add01 |
children | b8dcd14f0c95 |
files | stress-tester/src/main/java/com/passus/st/emitter/nio/NioAbstractEmitterWorker.java stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorkerImpl.java |
diffstat | 3 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioAbstractEmitterWorker.java Tue Jul 14 14:13:00 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioAbstractEmitterWorker.java Tue Jul 14 15:32:25 2020 +0200 @@ -48,14 +48,6 @@ } @Override - public void writeMetrics(MetricsContainer container) { - if (collectMetrics) { - container.update(System.currentTimeMillis(), metric); - metric.reset(); - } - } - - @Override protected void flush(SelectionKey key) { tasks.add(new FlushTask(key)); selector.wakeup();
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java Tue Jul 14 14:13:00 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java Tue Jul 14 15:32:25 2020 +0200 @@ -6,6 +6,8 @@ import com.passus.st.metric.MetricSource; import java.io.IOException; import java.nio.channels.SelectionKey; + +import com.passus.st.metric.MetricsContainer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -116,4 +118,15 @@ } } + @Override + public void writeMetrics(MetricsContainer container) { + if (collectMetrics) { + synchronized (metric) { + container.update(System.currentTimeMillis(), metric); + metric.reset(); + } + } + } + + }
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorkerImpl.java Tue Jul 14 14:13:00 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorkerImpl.java Tue Jul 14 15:32:25 2020 +0200 @@ -135,6 +135,13 @@ return; } + if (collectMetrics) { + synchronized (metric) { + metric.addRemoteSocketConnection(keyContext.channelContext.getRemoteAddress()); + metric.addBindAddress(keyContext.channelContext.getLocalAddress().getIp()); + } + } + selector.wakeup(); } catch (Exception e) { if (collectMetrics) {