/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2014 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package io.undertow.server.session;

import io.undertow.server.HttpServerExchange;

/**
 *
 * A listener for session events.
 *
 *
 * @author Stuart Douglas
 */
public interface SessionListener {

    /**
     * Called when a session is created
     * @param session The new session
     * @param exchange The {@link HttpServerExchange} that created the session
     */
    void sessionCreated(final Session session, final HttpServerExchange exchange);

    /**
     * Called when a session is destroyed
     * @param session   The new session
     * @param exchange  The {@link HttpServerExchange} that destroyed the session, or null if the session timed out
     * @param reason    The reason why the session was expired
     */
    void sessionDestroyed(final Session session,  final HttpServerExchange exchange, SessionDestroyedReason reason);

    void attributeAdded(final Session session, final String name, final Object value);

    void attributeUpdated(final Session session, final String name, final Object newValue, final Object oldValue);

    void attributeRemoved(final Session session, final String name,final Object oldValue);

    void sessionIdChanged(final Session session, final String oldSessionId);

    enum SessionDestroyedReason {
        INVALIDATED,
        TIMEOUT,
        UNDEPLOY,
    }
}

@@ -1072,32 +1072,40 @@
 ion%0A     */%0A    
+default 
 void sessionCrea
@@ -1165,17 +1165,24 @@
 xchange)
-;
+ %7B%0A    %7D
 %0A%0A    /*
@@ -1452,24 +1452,32 @@
      */%0A    
+default 
 void session
@@ -1575,22 +1575,37 @@
  reason)
-;%0A%0A   
+ %7B%0A    %7D%0A%0A    default
  void at
@@ -1674,30 +1674,45 @@
 bject value)
-;%0A%0A   
+ %7B%0A    %7D%0A%0A    default
  void attrib
@@ -1805,30 +1805,45 @@
 ct oldValue)
-;%0A%0A   
+ %7B%0A    %7D%0A%0A    default
  void attrib
@@ -1916,22 +1916,37 @@
 ldValue)
-;%0A%0A   
+ %7B%0A    %7D%0A%0A    default
  void se
@@ -2009,17 +2009,24 @@
 ssionId)
-;
+ %7B%0A    %7D
 %0A%0A    en

Make all methods on SessionListener default / no-op so implementations can choose which ones they are interested in.