roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r369261 - /incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
Date Sun, 15 Jan 2006 20:30:17 GMT
Author: agilliland
Date: Sun Jan 15 12:30:13 2006
New Revision: 369261

URL: http://svn.apache.org/viewcvs?rev=369261&view=rev
Log:
removing old memory debug flag ... we can just use our normal logger instead.


Modified:
    incubator/roller/trunk/src/org/roller/presentation/RollerContext.java

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerContext.java?rev=369261&r1=369260&r2=369261&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerContext.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerContext.java Sun Jan 15 12:30:13
2006
@@ -71,7 +71,6 @@
     private static ServletContext mContext = null;
     private static Authenticator mAuthenticator = null;
     private final SynchronizedInt mSessionCount = new SynchronizedInt(0);
-    private boolean mMemDebug = false;
     
     
     /**
@@ -119,33 +118,33 @@
         mContext = sce.getServletContext();
         mContext.setAttribute(ROLLER_CONTEXT, this);
         
+        // get the *real* path to <context>/resources
+        String ctxPath = mContext.getRealPath("/");
+        if(!ctxPath.endsWith(File.separator))
+            ctxPath += File.separator + "resources";
+        else
+            ctxPath += "resources";
+        
+        // try setting the uploads path to <context>/resources
+        // NOTE: this should go away at some point
+        // we leave it here for now to allow users to keep writing
+        // uploads into their webapp context, but this is a bad idea
+        //
+        // also, the RollerConfig.setUploadsDir() method is smart
+        // enough to disregard this call unless the uploads.path
+        // is set to ${webapp.context}
+        RollerConfig.setUploadsDir(ctxPath);
+        
+        // set the roller context real path in RollerConfig
+        // NOTE: it seems that a few backend classes do actually need
+        //       to know what the real path to the roller context is,
+        //       so we set this property to give them the info they need.
+        //
+        //       this is really not a best practice and we should try to
+        //       remove these dependencies on the webapp context if possible
+        RollerConfig.setContextRealPath(mContext.getRealPath("/"));
+        
         try {
-            // get the *real* path to <context>/resources
-            String ctxPath = mContext.getRealPath("/");
-            if(!ctxPath.endsWith(File.separator))
-                ctxPath += File.separator + "resources";
-            else
-                ctxPath += "resources";
-            
-            // try setting the uploads path to <context>/resources
-            // NOTE: this should go away at some point
-            // we leave it here for now to allow users to keep writing
-            // uploads into their webapp context, but this is a bad idea
-            //
-            // also, the RollerConfig.setUploadsDir() method is smart
-            // enough to disregard this call unless the uploads.path
-            // is set to ${webapp.context}
-            RollerConfig.setUploadsDir(ctxPath);
-            
-            // set the roller context real path in RollerConfig
-            // NOTE: it seems that a few backend classes do actually need
-            //       to know what the real path to the roller context is,
-            //       so we set this property to give them the info they need.
-            //
-            //       this is really not a best practice and we should try to
-            //       remove these dependencies on the webapp context if possible
-            RollerConfig.setContextRealPath(mContext.getRealPath("/"));
-            
             // always upgrade database first
             upgradeDatabaseIfNeeded();
             
@@ -171,15 +170,11 @@
             roller.commit();
             roller.release();
             
-            String flag = RollerConfig.getProperty("debug.memory.enabled");
-            if (flag != null && !flag.equalsIgnoreCase("false")) {
-                mMemDebug = true;
-            }
-            
-            mLogger.debug("RollerContext initialization complete");
         } catch (Throwable t) {
             mLogger.fatal("RollerContext initialization failed", t);
         }
+        
+        mLogger.debug("RollerContext initialization complete");
     }
     
     
@@ -358,30 +353,20 @@
     
     
     public void sessionCreated(HttpSessionEvent se) {
-        if (mMemDebug) {
-            mSessionCount.increment();
-            mContext.log(
-                    "Roller:SESSION_CREATED:count="
-                    + mSessionCount
-                    + ":freemem="
-                    + Runtime.getRuntime().freeMemory()
-                    + ":totmem="
-                    + Runtime.getRuntime().totalMemory());
-        }
+        mSessionCount.increment();
+        
+        mLogger.debug("sessions="+ mSessionCount
+                    + ":freemem=" + Runtime.getRuntime().freeMemory()
+                    + ":totmem=" + Runtime.getRuntime().totalMemory());
     }
     
     
     public void sessionDestroyed(HttpSessionEvent se) {
-        if (mMemDebug) {
-            mSessionCount.decrement();
-            mContext.log(
-                    "Roller:SESSION_DESTROY:count="
-                    + mSessionCount
-                    + ":freemem="
-                    + Runtime.getRuntime().freeMemory()
-                    + ":totalmem="
-                    + Runtime.getRuntime().totalMemory());
-        }
+        mSessionCount.decrement();
+        
+        mLogger.debug("sessions=" + mSessionCount
+                    + ":freemem=" + Runtime.getRuntime().freeMemory()
+                    + ":totalmem=" + Runtime.getRuntime().totalMemory());
     }
     
     



Mime
View raw message