changeset 768:c01815e24aff

ReaderMain - performance, allocations
author Devel 1
date Fri, 15 Dec 2017 15:09:36 +0100
parents 70b55498fb7e
children 6300f55ac52b
files stress-tester/src/main/java/com/passus/st/ReaderMain.java stress-tester/src/main/java/com/passus/st/client/http/HttpSessionPayloadEvent.java
diffstat 2 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/ReaderMain.java	Mon Dec 18 08:43:58 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/ReaderMain.java	Fri Dec 15 15:09:36 2017 +0100
@@ -51,14 +51,20 @@
             printSessionInfo(payloadEvent.getSessionInfo());
             System.out.println(" payload: ");
 
-            if (payloadEvent.getRequest() != null) {
-                System.out.println(payloadEvent.getRequest());
-                System.out.println("");
-            }
+            try {
+                if (payloadEvent.getRequest() != null) {
+//                    System.out.println(payloadEvent.getRequest());
+                    payloadEvent.getRequest().writeTo(System.out);
+                    System.out.println("");
+                }
 
-            if (payloadEvent.getResponse() != null) {
-                System.out.println(payloadEvent.getResponse());
-                System.out.println("");
+                if (payloadEvent.getResponse() != null) {
+//                    System.out.println(payloadEvent.getResponse());
+                    payloadEvent.getResponse().writeTo(System.out);
+                    System.out.println("");
+                }
+            } catch (Exception ex) {
+                ex.printStackTrace(System.err);
             }
         }
     }
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpSessionPayloadEvent.java	Mon Dec 18 08:43:58 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpSessionPayloadEvent.java	Fri Dec 15 15:09:36 2017 +0100
@@ -43,7 +43,6 @@
         return new HttpSessionPayloadEvent(getSessionInfo(), reqCopy, payload.response, getSourceName());
     }
 
-
     @Override
     public String toString() {
         String req = null;
@@ -58,12 +57,13 @@
             resp = helper.firstLineToString(getResponse());
         }
 
-        return "HttpSessionPayloadEvent{"
-                + "timestamp=" + getTimestamp() + ", "
-                + "session=" + getSessionInfo() + ", "
-                + "request=" + req + ", "
-                + "response=" + resp
-                + '}';
+        StringBuilder sb = new StringBuilder();
+        sb.append("HttpSessionPayloadEvent{")
+                .append("timestamp=").append(getTimestamp()).append(", ")
+                .append("session=").append(getSessionInfo()).append(", ")
+                .append("request=").append(req).append(", ")
+                .append("response=").append(resp).append("}");
+        return sb.toString();
     }
 
 }