changeset 775:c55915d92f35

ReaderMain improvements
author Devel 2
date Mon, 18 Dec 2017 15:32:45 +0100
parents c3e5932e8411
children 43eecfd20a76
files stress-tester/src/main/java/com/passus/st/ReaderMain.java
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/ReaderMain.java	Mon Dec 18 15:03:41 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/ReaderMain.java	Mon Dec 18 15:32:45 2017 +0100
@@ -50,27 +50,27 @@
         return options;
     }
 
-    private void printSessionInfo(SessionInfo session) {
-        System.out.print("----- ");
-        System.out.print(session);
+    private void printSessionInfo(SessionInfo session, PrintStream ps) {
+        ps.print("----- ");
+        ps.print(session);
     }
 
     private void printEvent(Event event, PrintStream ps) {
         if (event.getType() == SessionStatusEvent.TYPE) {
             SessionStatusEvent statusEvent = (SessionStatusEvent) event;
-            printSessionInfo(statusEvent.getSessionInfo());
-            System.out.print(" status: ");
-            System.out.println(SessionStatusEvent.statusToString(statusEvent.getStatus()));
+            printSessionInfo(statusEvent.getSessionInfo(), ps);
+            ps.print(" status: ");
+            ps.println(SessionStatusEvent.statusToString(statusEvent.getStatus()));
         } else if (event.getType() == HttpSessionPayloadEvent.TYPE) {
             HttpSessionPayloadEvent payloadEvent = (HttpSessionPayloadEvent) event;
-            printSessionInfo(payloadEvent.getSessionInfo());
+            printSessionInfo(payloadEvent.getSessionInfo(), ps);
             System.out.println(" payload: ");
 
             HttpRequest req = payloadEvent.getRequest();
             if (req != null) {
                 try {
                     req.writeTo(ps);
-                    System.out.println("");
+                    ps.println("");
                 } catch (IOException ex) {
                     logger.debug(ex.getMessage(), ex);
                 } finally {
@@ -82,7 +82,7 @@
             if (resp != null) {
                 try {
                     resp.writeTo(ps);
-                    System.out.println("");
+                    ps.println("");
                 } catch (IOException ex) {
                     logger.debug(ex.getMessage(), ex);
                 } finally {
@@ -94,6 +94,7 @@
 
     private void readNcFile(NcEventSource src, PrintStream ps) throws Exception {
         src.setParallel(false);
+        //src.setAllocator(new PooledAllocator(64 * 1024, 100, 0));
         src.setHandler((event) -> printEvent(event, ps));
 
         try {