1 /*** 2 * 3 * Copyright 2004 Protique Ltd 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 **/ 18 19 package org.codehaus.activemq.web; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 import javax.servlet.http.HttpSessionEvent; 25 import javax.servlet.http.HttpSessionListener; 26 27 /*** 28 * Listens to sessions closing to ensure that JMS connections are 29 * cleaned up nicely 30 * 31 * @version $Revision: 1.2 $ 32 */ 33 public class ConnectionManager implements HttpSessionListener { 34 private static final Log log = LogFactory.getLog(ConnectionManager.class); 35 36 public void sessionCreated(HttpSessionEvent event) { 37 } 38 39 public void sessionDestroyed(HttpSessionEvent event) { 40 /*** TODO we can't use the session any more now! 41 WebClient client = WebClient.getWebClient(event.getSession()); 42 try { 43 client.stop(); 44 } 45 catch (JMSException e) { 46 log.warn("Error closing connection: " + e, e); 47 } 48 */ 49 } 50 }