001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.clustering; 018 019 /** 020 * Callback listener for inbound and outbound Session migration. 021 * <p> 022 * A Session is preemptively moved between its associated set of SessionManagers. For instance, when a 023 * ClusteredInvocation for a given Session is invoked on a Node where the local SessionManager, RequestingSM, does not 024 * own the targeted Session, the SessionManager owning the Session, OwningSM, the Session may be moved from OwningSM 025 * to RequestingSM. OwningSM, prior to relinquish the Session, executes notifyOutboundSessionMigration and provides 026 * the Session under migration. RequestingRM, after having acquired the Session ownership, executes 027 * notifyInboundSessionMigration and provides the Session under migration. 028 * <p> 029 * The typical usage of these migration callbacks are to allow a wrapping SessionManager, e.g. an HTTPSession manager, 030 * to perform bookkeeping operations. 031 * 032 * @version $Rev$ $Date$ 033 */ 034 public interface SessionListener { 035 036 /** 037 * Calls when the ownership of the provided Session is acquired by the SessionManager to which this listener 038 * is attached. 039 * 040 * @param session New Session now owned by the attached SessionManager. 041 */ 042 void notifyInboundSessionMigration(Session session); 043 044 /** 045 * Calls when the ownership of the provided Session is relinquished to another SessionManager. 046 * 047 * @param session Session now owned by another SessionManager. 048 */ 049 void notifyOutboundSessionMigration(Session session); 050 051 /** 052 * Calls when a Session is destroyed. 053 * 054 * @param session Destroyed session. 055 */ 056 void notifySessionDestruction(Session session); 057 }