changeset 575:5076b7ad9328

HttpAsynchClientWorker invalidated session support
author Devel 2
date Wed, 27 Sep 2017 16:56:44 +0200
parents f7c2e8285d7c
children 27c9d6ce06bb
files stress-tester/src/main/java/com/passus/st/client/http/HttpAsynchClientWorker.java
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpAsynchClientWorker.java	Wed Sep 27 16:33:50 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpAsynchClientWorker.java	Wed Sep 27 16:56:44 2017 +0200
@@ -157,6 +157,23 @@
     }
 
     @Override
+    public void sessionInvalidated(SessionInfo session) throws Exception {
+        synchronized (lock) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Session {} invalidated.", session);
+            }
+
+            HttpFlowContext flowContext = flowContext(session);
+            if (flowContext != null) {
+                changeFlowState(flowContext, HttpFlowContext.STATE_DISCONNECTING);
+            }
+
+            addBlockedSession(session);
+            lock.notifyAll();
+        }
+    }
+
+    @Override
     protected void flowStateChanged(HttpFlowContext context, int oldState) {
         synchronized (lock) {
             flowStateChanged = true;
@@ -312,6 +329,12 @@
                             switch (task.type()) {
                                 case SessionEventsTask.TYPE:
                                     SessionEventsTask sessionTask = (SessionEventsTask) task;
+                                    if (isBlockedSession(sessionTask.session)) {
+                                        sessionTask.events.clear();
+                                        it.remove();
+                                        return;
+                                    }
+
                                     if (!sessionTask.events.isEmpty()) {
                                         Event event = sessionTask.events.get(0);
                                         if (processSessionEvent((SessionEvent) event)) {