use of org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved in project wildfly by wildfly.
the class InfinispanSessionManager method removed.
@CacheEntryRemoved
public void removed(CacheEntryRemovedEvent<SessionCreationMetaDataKey, ?> event) {
if (event.isPre()) {
String id = event.getKey().getValue();
InfinispanWebLogger.ROOT_LOGGER.tracef("Session %s will be removed", id);
Map.Entry<MV, AV> value = this.factory.findValue(id);
if (value != null) {
ImmutableSession session = this.factory.createImmutableSession(id, value);
ImmutableSessionAttributes attributes = session.getAttributes();
HttpSession httpSession = new ImmutableHttpSessionAdapter(session, this.context);
for (String name : attributes.getAttributeNames()) {
Object attribute = attributes.getAttribute(name);
if (attribute instanceof HttpSessionBindingListener) {
HttpSessionBindingListener listener = (HttpSessionBindingListener) attribute;
listener.valueUnbound(new HttpSessionBindingEvent(httpSession, name, attribute));
}
}
if (this.recorder != null) {
this.recorder.record(session);
}
}
}
}
Aggregations