Author: markt Date: Fri Feb 3 09:44:00 2012 New Revision: 1240047 URL: http://svn.apache.org/viewvc?rev=1240047&view=rev Log: New interface to remove dependency between valve and session packages
Added: tomcat/trunk/java/org/apache/catalina/StoreManager.java Modified: tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java tomcat/trunk/java/org/apache/catalina/valves/PersistentValve.java Added: tomcat/trunk/java/org/apache/catalina/StoreManager.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/StoreManager.java?rev=1240047&view=auto ============================================================================== --- tomcat/trunk/java/org/apache/catalina/StoreManager.java (added) +++ tomcat/trunk/java/org/apache/catalina/StoreManager.java Fri Feb 3 09:44:00 2012 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.catalina; + +/** + * PersistentManager would have been a better name but that would have clashed + * with the implementation name. + */ +public interface StoreManager { + + /** + * Return the Store object which manages persistent Session + * storage for this Manager. + */ + Store getStore(); + + /** + * Remove this Session from the active Sessions for this Manager, + * but not from the Store. (Used by the PersistentValve) + * + * @param session Session to be removed + */ + void removeSuper(Session session); +} Modified: tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=1240047&r1=1240046&r2=1240047&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java (original) +++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java Fri Feb 3 09:44:00 2012 @@ -30,6 +30,7 @@ import org.apache.catalina.LifecycleExce import org.apache.catalina.LifecycleState; import org.apache.catalina.Session; import org.apache.catalina.Store; +import org.apache.catalina.StoreManager; import org.apache.catalina.security.SecurityUtil; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -47,7 +48,8 @@ import org.apache.juli.logging.LogFactor * @version $Id$ */ -public abstract class PersistentManagerBase extends ManagerBase { +public abstract class PersistentManagerBase extends ManagerBase + implements StoreManager { private static final Log log = LogFactory.getLog(PersistentManagerBase.class); Modified: tomcat/trunk/java/org/apache/catalina/valves/PersistentValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/PersistentValve.java?rev=1240047&r1=1240046&r2=1240047&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/valves/PersistentValve.java (original) +++ tomcat/trunk/java/org/apache/catalina/valves/PersistentValve.java Fri Feb 3 09:44:00 2012 @@ -26,9 +26,9 @@ import org.apache.catalina.Context; import org.apache.catalina.Manager; import org.apache.catalina.Session; import org.apache.catalina.Store; +import org.apache.catalina.StoreManager; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; -import org.apache.catalina.session.PersistentManager; /** @@ -86,8 +86,8 @@ public class PersistentValve extends Val String sessionId = request.getRequestedSessionId(); Manager manager = context.getManager(); if (sessionId != null && manager != null) { - if (manager instanceof PersistentManager) { - Store store = ((PersistentManager) manager).getStore(); + if (manager instanceof StoreManager) { + Store store = ((StoreManager) manager).getStore(); if (store != null) { Session session = null; try { @@ -144,15 +144,15 @@ public class PersistentValve extends Val } if (newsessionId!=null) { /* store the session and remove it from the manager */ - if (manager instanceof PersistentManager) { + if (manager instanceof StoreManager) { Session session = manager.findSession(newsessionId); - Store store = ((PersistentManager) manager).getStore(); + Store store = ((StoreManager) manager).getStore(); if (store != null && session!=null && session.isValid() && !isSessionStale(session, System.currentTimeMillis())) { // ((StandardSession)session).passivate(); store.save(session); - ((PersistentManager) manager).removeSuper(session); + ((StoreManager) manager).removeSuper(session); session.recycle(); } else { if (container.getLogger().isDebugEnabled()) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org