tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1357415 - in /tomcat/trunk: java/org/apache/catalina/core/ java/org/apache/catalina/ha/session/ java/org/apache/catalina/ha/tcp/ java/org/apache/catalina/session/ test/org/apache/catalina/session/
Date Wed, 04 Jul 2012 21:24:28 GMT
Author: markt
Date: Wed Jul  4 21:24:28 2012
New Revision: 1357415

URL: http://svn.apache.org/viewvc?rev=1357415&view=rev
Log:
Switch from deprecated Manager.getContainer() to Manager.getContext()

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
    tomcat/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java
    tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
    tomcat/trunk/java/org/apache/catalina/session/FileStore.java
    tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
    tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
    tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
    tomcat/trunk/java/org/apache/catalina/session/StoreBase.java
    tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Jul  4 21:24:28 2012
@@ -1937,7 +1937,7 @@ public class StandardContext extends Con
 
         // Start the new component if necessary
         if (manager != null)
-            manager.setContainer(this);
+            manager.setContext(this);
         if (getState().isAvailable() && (manager != null) &&
             (manager instanceof Lifecycle)) {
             try {

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java Wed Jul  4 21:24:28
2012
@@ -152,7 +152,7 @@ public class BackupManager extends Clust
 
         try {
             if (getCluster() == null) {
-                Cluster cluster = getContainer().getCluster();
+                Cluster cluster = getContext().getCluster();
                 if (cluster instanceof CatalinaCluster) {
                     setCluster((CatalinaCluster)cluster);
                 } else {

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Wed Jul  4 21:24:28
2012
@@ -740,8 +740,8 @@ public class DeltaManager extends Cluste
             // stop remove cluster binding
             //wow, how many nested levels of if statements can we have ;)
             if(cluster == null) {
-                Container context = getContainer() ;
-                if(context != null && context instanceof Context) {
+                Context context = getContext() ;
+                if (context != null) {
                      Container host = context.getParent() ;
                      if(host != null && host instanceof Host) {
                          cluster = host.getCluster();
@@ -1465,7 +1465,7 @@ public class DeltaManager extends Cluste
             session.setPrimarySession(false);
             session.setId(newSessionID, false);
             if (notifyContainerListenersOnReplication) {
-                getContainer().fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT,
+                getContext().fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT,
                         new String[] {msg.getSessionID(), newSessionID});
             }
         }

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Wed Jul  4 21:24:28
2012
@@ -151,10 +151,10 @@ public class DeltaSession extends Standa
         else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders();
         else if ( manager instanceof StandardManager ) {
             StandardManager sm = (StandardManager)manager;
-            return ClusterManagerBase.getClassLoaders(sm.getContainer());
+            return ClusterManagerBase.getClassLoaders(sm.getContext());
         } else if ( manager instanceof ManagerBase ) {
             ManagerBase mb = (ManagerBase)manager;
-            return ClusterManagerBase.getClassLoaders(mb.getContainer());
+            return ClusterManagerBase.getClassLoaders(mb.getContext());
         }//end if
         return null;
     }

Modified: tomcat/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java Wed Jul  4 21:24:28
2012
@@ -274,7 +274,7 @@ public class ReplicationValve
                 if(log.isDebugEnabled()) {
                     log.debug(sm.getString("ReplicationValve.crossContext.registerSession",
                         session.getIdInternal(),
-                        session.getManager().getContainer().getName()));
+                        session.getManager().getContext().getName()));
                 }
                 sessions.add(session);
             }
@@ -417,7 +417,7 @@ public class ReplicationValve
                 Session session = iter.next();
                 if(log.isDebugEnabled()) {
                     log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",
-                            session.getManager().getContainer().getName() ));
+                            session.getManager().getContext().getName() ));
                 }
                 sendMessage(session,(ClusterManager)session.getManager(),containerCluster);
                 if(doStatistics()) {
@@ -461,7 +461,7 @@ public class ReplicationValve
     protected void resetDeltaRequest(Session session) {
         if(log.isDebugEnabled()) {
             log.debug(sm.getString("ReplicationValve.resetDeltaRequest" ,
-                session.getManager().getContainer().getName() ));
+                session.getManager().getContext().getName() ));
         }
         ((DeltaSession)session).resetDeltaRequest();
     }

Modified: tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Wed Jul  4 21:24:28
2012
@@ -554,11 +554,11 @@ public class SimpleTcpCluster extends Li
     @Override
     public String getManagerName(String name, Manager manager) {
         String clusterName = name ;
-        if ( clusterName == null ) clusterName = manager.getContainer().getName();
-        if(getContainer() instanceof Engine) {
-            Container context = manager.getContainer() ;
-            if(context != null && context instanceof Context) {
-                Container host = ((Context)context).getParent();
+        if (clusterName == null) clusterName = manager.getContext().getName();
+        if (getContainer() instanceof Engine) {
+            Context context = manager.getContext() ;
+            if(context != null) {
+                Container host = context.getParent();
                 if(host != null && host instanceof Host && clusterName!=null
&&
                         !(clusterName.startsWith(host.getName() +"#"))) {
                     clusterName = host.getName() +"#" + clusterName ;

Modified: tomcat/trunk/java/org/apache/catalina/session/FileStore.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/FileStore.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/FileStore.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/FileStore.java Wed Jul  4 21:24:28 2012
@@ -32,7 +32,6 @@ import java.util.ArrayList;
 
 import javax.servlet.ServletContext;
 
-import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Loader;
 import org.apache.catalina.Session;
@@ -241,8 +240,8 @@ public final class FileStore extends Sto
         if (! file.exists()) {
             return (null);
         }
-        if (manager.getContainer().getLogger().isDebugEnabled()) {
-            manager.getContainer().getLogger().debug(sm.getString(getStoreName()+".loading",
+        if (manager.getContext().getLogger().isDebugEnabled()) {
+            manager.getContext().getLogger().debug(sm.getString(getStoreName()+".loading",
                              id, file.getAbsolutePath()));
         }
 
@@ -254,9 +253,9 @@ public final class FileStore extends Sto
         try {
             fis = new FileInputStream(file.getAbsolutePath());
             bis = new BufferedInputStream(fis);
-            Container container = manager.getContainer();
-            if (container instanceof Context)
-                loader = ((Context) container).getLoader();
+            Context context = manager.getContext();
+            if (context != null)
+                loader = context.getLoader();
             if (loader != null)
                 classLoader = loader.getClassLoader();
             if (classLoader != null)
@@ -264,8 +263,8 @@ public final class FileStore extends Sto
             else
                 ois = new ObjectInputStream(bis);
         } catch (FileNotFoundException e) {
-            if (manager.getContainer().getLogger().isDebugEnabled())
-                manager.getContainer().getLogger().debug("No persisted data file found");
+            if (manager.getContext().getLogger().isDebugEnabled())
+                manager.getContext().getLogger().debug("No persisted data file found");
             return (null);
         } catch (IOException e) {
             if (bis != null) {
@@ -318,8 +317,8 @@ public final class FileStore extends Sto
         if (file == null) {
             return;
         }
-        if (manager.getContainer().getLogger().isDebugEnabled()) {
-            manager.getContainer().getLogger().debug(sm.getString(getStoreName()+".removing",
+        if (manager.getContext().getLogger().isDebugEnabled()) {
+            manager.getContext().getLogger().debug(sm.getString(getStoreName()+".removing",
                              id, file.getAbsolutePath()));
         }
         file.delete();
@@ -343,8 +342,8 @@ public final class FileStore extends Sto
         if (file == null) {
             return;
         }
-        if (manager.getContainer().getLogger().isDebugEnabled()) {
-            manager.getContainer().getLogger().debug(sm.getString(getStoreName()+".saving",
+        if (manager.getContext().getLogger().isDebugEnabled()) {
+            manager.getContext().getLogger().debug(sm.getString(getStoreName()+".saving",
                              session.getIdInternal(), file.getAbsolutePath()));
         }
         FileOutputStream fos = null;
@@ -391,10 +390,9 @@ public final class FileStore extends Sto
         }
         File file = new File(this.directory);
         if (!file.isAbsolute()) {
-            Container container = manager.getContainer();
-            if (container instanceof Context) {
-                ServletContext servletContext =
-                    ((Context) container).getServletContext();
+            Context context = manager.getContext();
+            if (context != null) {
+                ServletContext servletContext = context.getServletContext();
                 File work = (File)
                     servletContext.getAttribute(ServletContext.TEMPDIR);
                 file = new File(work, this.directory);

Modified: tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/JDBCStore.java Wed Jul  4 21:24:28 2012
@@ -188,7 +188,7 @@ public class JDBCStore extends StoreBase
      */
     public String getName() {
         if (name == null) {
-            Container container = manager.getContainer();
+            Container container = manager.getContext();
             String contextName = container.getName();
             if (!contextName.startsWith("/")) {
                 contextName = "/" + contextName;
@@ -445,7 +445,7 @@ public class JDBCStore extends StoreBase
      */
     public void setDataSourceName(String dataSourceName) {
         if (dataSourceName == null || "".equals(dataSourceName.trim())) {
-            manager.getContainer().getLogger().warn(
+            manager.getContext().getLogger().warn(
                     sm.getString(getStoreName() + ".missingDataSourceName"));
             return;
         }
@@ -500,7 +500,7 @@ public class JDBCStore extends StoreBase
                     // Break out after the finally block
                     numberOfTries = 0;
                 } catch (SQLException e) {
-                    manager.getContainer().getLogger().error(sm.getString(getStoreName()
+ ".SQLException", e));
+                    manager.getContext().getLogger().error(sm.getString(getStoreName() +
".SQLException", e));
                     keys = new String[0];
                     // Close the connection so that it gets reopened next time
                     if (dbConnection != null)
@@ -560,7 +560,7 @@ public class JDBCStore extends StoreBase
                     // Break out after the finally block
                     numberOfTries = 0;
                 } catch (SQLException e) {
-                    manager.getContainer().getLogger().error(sm.getString(getStoreName()
+ ".SQLException", e));
+                    manager.getContext().getLogger().error(sm.getString(getStoreName() +
".SQLException", e));
                     if (dbConnection != null)
                         close(dbConnection);
                 } finally {
@@ -597,7 +597,7 @@ public class JDBCStore extends StoreBase
         ClassLoader classLoader = null;
         ObjectInputStream ois = null;
         BufferedInputStream bis = null;
-        Container container = manager.getContainer();
+        org.apache.catalina.Context context = manager.getContext();
 
         synchronized (this) {
             int numberOfTries = 2;
@@ -622,8 +622,8 @@ public class JDBCStore extends StoreBase
                     if (rst.next()) {
                         bis = new BufferedInputStream(rst.getBinaryStream(2));
 
-                        if (container instanceof org.apache.catalina.Context) {
-                            loader = ((org.apache.catalina.Context) container).getLoader();
+                        if (context != null) {
+                            loader = context.getLoader();
                         }
                         if (loader != null) {
                             classLoader = loader.getClassLoader();
@@ -635,21 +635,21 @@ public class JDBCStore extends StoreBase
                             ois = new ObjectInputStream(bis);
                         }
 
-                        if (manager.getContainer().getLogger().isDebugEnabled()) {
-                            manager.getContainer().getLogger().debug(sm.getString(getStoreName()
+ ".loading",
+                        if (manager.getContext().getLogger().isDebugEnabled()) {
+                            manager.getContext().getLogger().debug(sm.getString(getStoreName()
+ ".loading",
                                     id, sessionTable));
                         }
 
                         _session = (StandardSession) manager.createEmptySession();
                         _session.readObjectData(ois);
                         _session.setManager(manager);
-                      } else if (manager.getContainer().getLogger().isDebugEnabled()) {
-                        manager.getContainer().getLogger().debug(getStoreName() + ": No persisted
data object found");
+                      } else if (manager.getContext().getLogger().isDebugEnabled()) {
+                        manager.getContext().getLogger().debug(getStoreName() + ": No persisted
data object found");
                     }
                     // Break out after the finally block
                     numberOfTries = 0;
                 } catch (SQLException e) {
-                    manager.getContainer().getLogger().error(sm.getString(getStoreName()
+ ".SQLException", e));
+                    manager.getContext().getLogger().error(sm.getString(getStoreName() +
".SQLException", e));
                     if (dbConnection != null)
                         close(dbConnection);
                 } finally {
@@ -702,7 +702,7 @@ public class JDBCStore extends StoreBase
                     // Break out after the finally block
                     numberOfTries = 0;
                 } catch (SQLException e) {
-                    manager.getContainer().getLogger().error(sm.getString(getStoreName()
+ ".SQLException", e));
+                    manager.getContext().getLogger().error(sm.getString(getStoreName() +
".SQLException", e));
                     if (dbConnection != null)
                         close(dbConnection);
                 } finally {
@@ -712,8 +712,8 @@ public class JDBCStore extends StoreBase
             }
         }
 
-        if (manager.getContainer().getLogger().isDebugEnabled()) {
-            manager.getContainer().getLogger().debug(sm.getString(getStoreName() + ".removing",
id, sessionTable));
+        if (manager.getContext().getLogger().isDebugEnabled()) {
+            manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".removing",
id, sessionTable));
         }
     }
 
@@ -767,7 +767,7 @@ public class JDBCStore extends StoreBase
                     // Break out after the finally block
                     numberOfTries = 0;
                 } catch (SQLException e) {
-                    manager.getContainer().getLogger().error(sm.getString(getStoreName()
+ ".SQLException", e));
+                    manager.getContext().getLogger().error(sm.getString(getStoreName() +
".SQLException", e));
                     if (dbConnection != null)
                         close(dbConnection);
                 } finally {
@@ -836,7 +836,7 @@ public class JDBCStore extends StoreBase
                     // Break out after the finally block
                     numberOfTries = 0;
                 } catch (SQLException e) {
-                    manager.getContainer().getLogger().error(sm.getString(getStoreName()
+ ".SQLException", e));
+                    manager.getContext().getLogger().error(sm.getString(getStoreName() +
".SQLException", e));
                     if (dbConnection != null)
                         close(dbConnection);
                 } catch (IOException e) {
@@ -858,8 +858,8 @@ public class JDBCStore extends StoreBase
             }
         }
 
-        if (manager.getContainer().getLogger().isDebugEnabled()) {
-            manager.getContainer().getLogger().debug(sm.getString(getStoreName() + ".saving",
+        if (manager.getContext().getLogger().isDebugEnabled()) {
+            manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".saving",
                     session.getIdInternal(), sessionTable));
         }
     }
@@ -878,14 +878,14 @@ public class JDBCStore extends StoreBase
         try {
             conn = open();
             if (conn == null || conn.isClosed()) {
-                manager.getContainer().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBClosed"));
+                manager.getContext().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBClosed"));
                 conn = open();
                 if (conn == null || conn.isClosed()) {
-                    manager.getContainer().getLogger().info(sm.getString(getStoreName() +
".checkConnectionDBReOpenFail"));
+                    manager.getContext().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBReOpenFail"));
                 }
             }
         } catch (SQLException ex) {
-            manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".checkConnectionSQLException",
+            manager.getContext().getLogger().error(sm.getString(getStoreName() + ".checkConnectionSQLException",
                     ex.toString()));
         }
 
@@ -911,7 +911,7 @@ public class JDBCStore extends StoreBase
                 Context envCtx = (Context) initCtx.lookup("java:comp/env");
                 this.dataSource = (DataSource) envCtx.lookup(this.dataSourceName);
             } catch (NamingException e) {
-                manager.getContainer().getLogger().error(
+                manager.getContext().getLogger().error(
                         sm.getString(getStoreName() + ".wrongDataSource",
                                 this.dataSourceName), e);
            }
@@ -927,13 +927,13 @@ public class JDBCStore extends StoreBase
                 Class<?> clazz = Class.forName(driverName);
                 driver = (Driver) clazz.newInstance();
             } catch (ClassNotFoundException ex) {
-                manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException",
+                manager.getContext().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException",
                         ex.toString()));
             } catch (InstantiationException ex) {
-                manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException",
+                manager.getContext().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException",
                         ex.toString()));
             } catch (IllegalAccessException ex) {
-                manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException",
+                manager.getContext().getLogger().error(sm.getString(getStoreName() + ".checkConnectionClassNotFoundException",
                         ex.toString()));
             }
         }
@@ -1009,14 +1009,14 @@ public class JDBCStore extends StoreBase
                 dbConnection.commit();
             }
         } catch (SQLException e) {
-            manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".commitSQLException"),
e);
+            manager.getContext().getLogger().error(sm.getString(getStoreName() + ".commitSQLException"),
e);
         }
 
         // Close this database connection, and log any errors
         try {
             dbConnection.close();
         } catch (SQLException e) {
-            manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".close",
e.toString())); // Just log it here
+            manager.getContext().getLogger().error(sm.getString(getStoreName() + ".close",
e.toString())); // Just log it here
         } finally {
             this.dbConnection = null;
         }

Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Wed Jul  4 21:24:28 2012
@@ -534,7 +534,7 @@ public abstract class ManagerBase extend
 
         super.initInternal();
 
-        setDistributable(((Context) getContainer()).getDistributable());
+        setDistributable(getContext().getDistributable());
     }
 
     @Override
@@ -809,7 +809,7 @@ public abstract class ManagerBase extend
      */
     public Engine getEngine() {
         Engine e = null;
-        for (Container c = getContainer(); e == null && c != null ; c = c.getParent())
{
+        for (Container c = getContext(); e == null && c != null ; c = c.getParent())
{
             if (c instanceof Engine) {
                 e = (Engine)c;
             }

Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Wed Jul  4 21:24:28
2012
@@ -400,7 +400,7 @@ public class StandardSession implements 
         fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
 
         // Notify interested application event listeners
-        Context context = (Context) manager.getContainer();
+        Context context = manager.getContext();
         Object listeners[] = context.getApplicationLifecycleListeners();
         if (listeners != null && listeners.length > 0) {
             HttpSessionEvent event =
@@ -423,7 +423,7 @@ public class StandardSession implements 
                     } catch (Exception e) {
                         // Ignore
                     }
-                    manager.getContainer().getLogger().error
+                    manager.getContext().getLogger().error
                         (sm.getString("standardSession.sessionEvent"), t);
                 }
             }
@@ -751,7 +751,7 @@ public class StandardSession implements 
 
             // Notify interested application event listeners
             // FIXME - Assumes we call listeners in reverse order
-            Context context = (Context) manager.getContainer();
+            Context context = manager.getContext();
 
             // The call to expire() may not have been triggered by the webapp.
             // Make sure the webapp's class loader is set when calling the
@@ -795,7 +795,7 @@ public class StandardSession implements 
                                 } catch (Exception e) {
                                     // Ignore
                                 }
-                                manager.getContainer().getLogger().error
+                                manager.getContext().getLogger().error
                                     (sm.getString("standardSession.sessionEvent"), t);
                             }
                         }
@@ -832,7 +832,7 @@ public class StandardSession implements 
                 try {
                     gp.logout();
                 } catch (Exception e) {
-                    manager.getContainer().getLogger().error(
+                    manager.getContext().getLogger().error(
                             sm.getString("standardSession.logoutfail"),
                             e);
                 }
@@ -873,7 +873,7 @@ public class StandardSession implements 
                         .sessionWillPassivate(event);
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
-                    manager.getContainer().getLogger().error
+                    manager.getContext().getLogger().error
                         (sm.getString("standardSession.attributeEvent"), t);
                 }
             }
@@ -909,7 +909,7 @@ public class StandardSession implements 
                         .sessionDidActivate(event);
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
-                    manager.getContainer().getLogger().error
+                    manager.getContext().getLogger().error
                         (sm.getString("standardSession.attributeEvent"), t);
                 }
             }
@@ -1101,7 +1101,7 @@ public class StandardSession implements 
 
         if (manager == null)
             return (null);
-        Context context = (Context) manager.getContainer();
+        Context context = manager.getContext();
         if (context == null)
             return (null);
         else
@@ -1434,7 +1434,7 @@ public class StandardSession implements 
                 try {
                     ((HttpSessionBindingListener) value).valueBound(event);
                 } catch (Throwable t){
-                    manager.getContainer().getLogger().error
+                    manager.getContext().getLogger().error
                     (sm.getString("standardSession.bindingEvent"), t);
                 }
             }
@@ -1451,7 +1451,7 @@ public class StandardSession implements 
                     (new HttpSessionBindingEvent(getSession(), name));
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
-                manager.getContainer().getLogger().error
+                manager.getContext().getLogger().error
                     (sm.getString("standardSession.bindingEvent"), t);
             }
         }
@@ -1459,7 +1459,7 @@ public class StandardSession implements 
         if ( !notify ) return;
 
         // Notify interested application event listeners
-        Context context = (Context) manager.getContainer();
+        Context context = manager.getContext();
         Object listeners[] = context.getApplicationEventListeners();
         if (listeners == null)
             return;
@@ -1503,7 +1503,7 @@ public class StandardSession implements 
                 } catch (Exception e) {
                     // Ignore
                 }
-                manager.getContainer().getLogger().error
+                manager.getContext().getLogger().error
                     (sm.getString("standardSession.attributeEvent"), t);
             }
         }
@@ -1562,8 +1562,8 @@ public class StandardSession implements 
         principal = null;        // Transient only
         //        setId((String) stream.readObject());
         id = (String) stream.readObject();
-        if (manager.getContainer().getLogger().isDebugEnabled())
-            manager.getContainer().getLogger().debug
+        if (manager.getContext().getLogger().isDebugEnabled())
+            manager.getContext().getLogger().debug
                 ("readObject() loading session " + id);
 
         // Deserialize the attribute count and attribute values
@@ -1577,8 +1577,8 @@ public class StandardSession implements 
             Object value = stream.readObject();
             if ((value instanceof String) && (value.equals(NOT_SERIALIZED)))
                 continue;
-            if (manager.getContainer().getLogger().isDebugEnabled())
-                manager.getContainer().getLogger().debug("  loading attribute '" + name +
+            if (manager.getContext().getLogger().isDebugEnabled())
+                manager.getContext().getLogger().debug("  loading attribute '" + name +
                     "' with value '" + value + "'");
             attributes.put(name, value);
         }
@@ -1623,8 +1623,8 @@ public class StandardSession implements 
         stream.writeObject(Boolean.valueOf(isValid));
         stream.writeObject(Long.valueOf(thisAccessedTime));
         stream.writeObject(id);
-        if (manager.getContainer().getLogger().isDebugEnabled())
-            manager.getContainer().getLogger().debug
+        if (manager.getContext().getLogger().isDebugEnabled())
+            manager.getContext().getLogger().debug
                 ("writeObject() storing session " + id);
 
         // Accumulate the names of serializable and non-serializable attributes
@@ -1651,17 +1651,17 @@ public class StandardSession implements 
             stream.writeObject(saveNames.get(i));
             try {
                 stream.writeObject(saveValues.get(i));
-                if (manager.getContainer().getLogger().isDebugEnabled())
-                    manager.getContainer().getLogger().debug
+                if (manager.getContext().getLogger().isDebugEnabled())
+                    manager.getContext().getLogger().debug
                         ("  storing attribute '" + saveNames.get(i) +
                         "' with value '" + saveValues.get(i) + "'");
             } catch (NotSerializableException e) {
-                manager.getContainer().getLogger().warn
+                manager.getContext().getLogger().warn
                     (sm.getString("standardSession.notSerializable",
                      saveNames.get(i), id), e);
                 stream.writeObject(NOT_SERIALIZED);
-                if (manager.getContainer().getLogger().isDebugEnabled())
-                    manager.getContainer().getLogger().debug
+                if (manager.getContext().getLogger().isDebugEnabled())
+                    manager.getContext().getLogger().debug
                        ("  storing attribute '" + saveNames.get(i) +
                         "' with value NOT_SERIALIZED");
             }
@@ -1757,7 +1757,7 @@ public class StandardSession implements 
         }
 
         // Notify interested application event listeners
-        Context context = (Context) manager.getContainer();
+        Context context = manager.getContext();
         Object listeners[] = context.getApplicationEventListeners();
         if (listeners == null)
             return;
@@ -1784,7 +1784,7 @@ public class StandardSession implements 
                 } catch (Exception e) {
                     // Ignore
                 }
-                manager.getContainer().getLogger().error
+                manager.getContext().getLogger().error
                     (sm.getString("standardSession.attributeEvent"), t);
             }
         }

Modified: tomcat/trunk/java/org/apache/catalina/session/StoreBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StoreBase.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StoreBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StoreBase.java Wed Jul  4 21:24:28 2012
@@ -132,11 +132,11 @@ public abstract class StoreBase extends 
         try {
             keys = keys();
         } catch (IOException e) {
-            manager.getContainer().getLogger().error("Error getting keys", e);
+            manager.getContext().getLogger().error("Error getting keys", e);
             return;
         }
-        if (manager.getContainer().getLogger().isDebugEnabled()) {
-            manager.getContainer().getLogger().debug(getStoreName()+ ": processExpires check
number of " + keys.length + " sessions" );
+        if (manager.getContext().getLogger().isDebugEnabled()) {
+            manager.getContext().getLogger().debug(getStoreName()+ ": processExpires check
number of " + keys.length + " sessions" );
         }
 
         long timeNow = System.currentTimeMillis();
@@ -151,8 +151,8 @@ public abstract class StoreBase extends 
                 if (timeIdle < session.getMaxInactiveInterval()) {
                     continue;
                 }
-                if (manager.getContainer().getLogger().isDebugEnabled()) {
-                    manager.getContainer().getLogger().debug(getStoreName()+ ": processExpires
expire store session " + keys[i] );
+                if (manager.getContext().getLogger().isDebugEnabled()) {
+                    manager.getContext().getLogger().debug(getStoreName()+ ": processExpires
expire store session " + keys[i] );
                 }
                 boolean isLoaded = false;
                 if (manager instanceof PersistentManagerBase) {
@@ -175,11 +175,11 @@ public abstract class StoreBase extends 
                 }
                 remove(keys[i]);
             } catch (Exception e) {
-                manager.getContainer().getLogger().error("Session: "+keys[i]+"; ", e);
+                manager.getContext().getLogger().error("Session: "+keys[i]+"; ", e);
                 try {
                     remove(keys[i]);
                 } catch (IOException e2) {
-                    manager.getContainer().getLogger().error("Error removing key", e2);
+                    manager.getContext().getLogger().error("Error removing key", e2);
                 }
             }
         }

Modified: tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java?rev=1357415&r1=1357414&r2=1357415&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java (original)
+++ tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java Wed Jul  4 21:24:28 2012
@@ -173,7 +173,7 @@ public class Benchmarks {
         } catch (LifecycleException e) {
             // Ignore - this is expected
         }
-        mgr.setContainer(new StandardContext());
+        mgr.setContext(new StandardContext());
         mgr.generateSessionId();
         while (mgr.sessionCreationTiming.size() <
                 ManagerBase.TIMING_STATS_CACHE_SIZE) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message