Skip to content

Commit 8fb90fd

Browse files
committed
SessionEventRegistry doneWaiting if result found
Previously doneWaiting was only computed based upon the time rather than if the result was found. Issue gh-3398
1 parent 19d7c03 commit 8fb90fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-session-data-redis/src/integration-test/java/org/springframework/session/data/SessionEventRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public class SessionEventRegistry implements ApplicationListener<AbstractSession
3838
@Override
3939
public void onApplicationEvent(AbstractSessionEvent event) {
4040
String sessionId = event.getSessionId();
41-
this.events.computeIfAbsent(sessionId, (key) -> new ArrayList<>()).add(event);
4241
Object lock = getLock(sessionId);
4342
synchronized (lock) {
43+
this.events.computeIfAbsent(sessionId, (key) -> new ArrayList<>()).add(event);
4444
lock.notifyAll();
4545
}
4646
}
@@ -72,7 +72,7 @@ public <E extends AbstractSessionEvent> E waitForEvent(String sessionId, Class<E
7272
lock.wait(waitInMs);
7373
}
7474
long now = System.currentTimeMillis();
75-
doneWaiting = (now - start) >= waitInMs;
75+
doneWaiting = result != null || (now - start) >= waitInMs;
7676
}
7777
return getEvent(sessionId, type);
7878
}

0 commit comments

Comments
 (0)