changeset 810:22dd25425c8d

refactoring
author Devel 1
date Mon, 08 Jan 2018 11:32:22 +0100
parents 96f04c6b4080
children a6ca1dda7e52
files stress-tester/src/main/java/com/passus/st/emitter/nio/NioChannelContext.java stress-tester/src/main/java/com/passus/st/emitter/nio/NioDefaultEmitterWorker.java stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker2.java
diffstat 4 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioChannelContext.java	Mon Jan 08 11:18:46 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioChannelContext.java	Mon Jan 08 11:32:22 2018 +0100
@@ -18,7 +18,7 @@
  */
 public class NioChannelContext implements ChannelContext {
 
-    private final NioDefaultEmitterWorker worker;
+    private final NioEmitterWorker worker;
 
     private final SessionInfo sessionInfo;
 
@@ -32,7 +32,7 @@
 
     private SelectionKey key;
 
-    public NioChannelContext(NioDefaultEmitterWorker worker, SocketChannel channel, SocketAddress remoteAddress, SessionInfo sessionInfo) {
+    public NioChannelContext(NioEmitterWorker worker, SocketChannel channel, SocketAddress remoteAddress, SessionInfo sessionInfo) {
         this.worker = worker;
         this.channel = channel;
         this.remoteAddress = remoteAddress;
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioDefaultEmitterWorker.java	Mon Jan 08 11:18:46 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioDefaultEmitterWorker.java	Mon Jan 08 11:32:22 2018 +0100
@@ -67,6 +67,7 @@
         selector.wakeup();
     }
 
+    @Override
     void flush(SelectionKey key) {
         tasks.add(new FlushTask(key));
         selector.wakeup();
@@ -399,6 +400,7 @@
         key.selector().wakeup();
     }
 
+    @Override
     void requestClose(SelectionKey key) {
         tasks.add(new CloseTask(key));
         key.selector().wakeup();
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java	Mon Jan 08 11:18:46 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker.java	Mon Jan 08 11:32:22 2018 +0100
@@ -7,6 +7,7 @@
 import com.passus.st.emitter.SessionMapper;
 import com.passus.st.metric.MetricSource;
 import java.io.IOException;
+import java.nio.channels.SelectionKey;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -43,6 +44,10 @@
 
     public abstract void setWorking(boolean b);
 
+    abstract void flush(SelectionKey key);
+
+    abstract void requestClose(SelectionKey key);
+
     public long getSelectTimeout() {
         return selectTimeout;
     }
--- a/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker2.java	Mon Jan 08 11:18:46 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/emitter/nio/NioEmitterWorker2.java	Mon Jan 08 11:32:22 2018 +0100
@@ -138,6 +138,7 @@
         doRegister(sessionInfo, handler);
     }
 
+    @Override
     void flush(SelectionKey key) {
         tasks.add(new FlushTask(key));
         selector.wakeup();
@@ -632,6 +633,7 @@
         key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE);
     }
 
+    @Override
     void requestClose(SelectionKey key) {
         tasks.add(new CloseTask(key));
         wakeUp();