Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,14 @@ protected void filter(IoFilterEvent event) throws Exception {

private Map<String, String> getAndFillContext(final IoSession session) {
Map<String, String> context = getContext(session);

if (context.isEmpty()) {
fillContext(session, context);

// make sure that context returned is fully filled and doesn't return partial context
synchronized (context) {
if (context.isEmpty()) {
fillContext(session, context);
}
}

return context;
}

Expand All @@ -190,7 +193,7 @@ private static Map<String, String> getContext(final IoSession session) {

if (context == null) {
context = new ConcurrentHashMap<>();
session.setAttribute(CONTEXT_KEY, context);
session.setAttributeIfAbsent(CONTEXT_KEY, context);
}

return context;
Expand Down
Loading