if (hasActivationListener != Boolean.FALSE) {
boolean hasListener = false;
// Notify ActivationListeners
HttpSessionEvent event = null;
String[] keys = keys();
Map<String, Object> attrs = getAttributesInternal();
for (int i = 0; i < keys.length; i++) {
Object attribute = attrs.get(keys[i]);
if (attribute instanceof HttpSessionActivationListener) {
hasListener = true;
if (notificationPolicy.isHttpSessionActivationListenerInvocationAllowed(this.clusterStatus, cause, keys[i])) {
if (event == null)
event = new HttpSessionEvent(getSession());
try {
((HttpSessionActivationListener) attribute).sessionWillPassivate(event);
} catch (Throwable t) {
manager.getContainer().getLogger().error(MESSAGES.errorSessionActivationEvent(t));