portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r663332 - in /portals/jetspeed-2/portal: branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/ branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/val...
Date Wed, 04 Jun 2008 18:08:49 GMT
Author: taylor
Date: Wed Jun  4 11:08:49 2008
New Revision: 663332

URL: http://svn.apache.org/viewvc?rev=663332&view=rev
Log:
session debug information (turned off by default). I will create an issue around general monitoring
for 2.2

Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java?rev=663332&r1=663331&r2=663332&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
Wed Jun  4 11:08:49 2008
@@ -16,6 +16,9 @@
  */
 package org.apache.jetspeed.pipeline.valve.impl;
 
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.Enumeration;
 import java.util.Stack;
 
 import javax.servlet.RequestDispatcher;
@@ -47,7 +50,7 @@
 
     public static final String RENDER_STACK_ATTR = "org.apache.jetspeed.renderStack";
 
-    private static final Log log = LogFactory.getLog(CleanupValveImpl.class);
+    private static final Log log = LogFactory.getLog("org.apache.jetspeed.cleanup");
 
     
     public CleanupValveImpl()
@@ -59,9 +62,7 @@
      */
     public void invoke(RequestContext request, ValveContext context) throws PipelineException
     {
-
         // Complete any renderings that are on the rendering stack 
-
         // TODO: we should abstract the rendering as we will
         // want to eventually support other types of templates
         // other than JSPs.
@@ -79,6 +80,7 @@
                     rd.include(httpRequest, request.getResponse());
                 }
             }
+            // this.dumpSession(request);
         }
         catch (Exception e)
         {
@@ -95,4 +97,46 @@
         return "CleanupValveImpl";
     }
 
+
+    public void dumpSession(RequestContext context)
+    {
+        try
+        {
+            int count = 0;
+            ByteArrayOutputStream bout =  new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream (bout);
+            Enumeration e = context.getRequest().getSession().getAttributeNames();
+            while (e.hasMoreElements())
+            {
+                String name = (String)e.nextElement();
+                Object o = context.getSessionAttribute(name);
+                serializeObject(name, o);
+                out.writeObject(o); 
+                count++;
+            }
+            out.close();
+            log.info("Session object: " + count);
+            log.info("Session footprint: " + bout.size());
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }
+    
+    public void serializeObject(String name, Object o)
+    {
+        try
+        {
+            ByteArrayOutputStream bout =  new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream (bout);
+            out.writeObject(o);
+            out.close();
+            log.info("o = " + name + ", " + o + ", size = " + bout.size() );            
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }    
 }

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java?rev=663332&r1=663331&r2=663332&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
Wed Jun  4 11:08:49 2008
@@ -16,6 +16,9 @@
  */
 package org.apache.jetspeed.pipeline.valve.impl;
 
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.Enumeration;
 import java.util.Stack;
 
 import javax.servlet.RequestDispatcher;
@@ -79,6 +82,7 @@
                     rd.include(httpRequest, request.getResponse());
                 }
             }
+            // this.dumpSession(request);            
         }
         catch (Exception e)
         {
@@ -95,4 +99,45 @@
         return "CleanupValveImpl";
     }
 
+    public void dumpSession(RequestContext context)
+    {
+        try
+        {
+            int count = 0;
+            ByteArrayOutputStream bout =  new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream (bout);
+            Enumeration e = context.getRequest().getSession().getAttributeNames();
+            while (e.hasMoreElements())
+            {
+                String name = (String)e.nextElement();
+                Object o = context.getSessionAttribute(name);
+                serializeObject(name, o);
+                out.writeObject(o); 
+                count++;
+            }
+            out.close();
+            log.info("Session object: " + count);
+            log.info("Session footprint: " + bout.size());
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }
+    
+    public void serializeObject(String name, Object o)
+    {
+        try
+        {
+            ByteArrayOutputStream bout =  new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream (bout);
+            out.writeObject(o);
+            out.close();
+            log.info("o = " + name + ", " + o + ", size = " + bout.size() );            
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }        
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java?rev=663332&r1=663331&r2=663332&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/CleanupValveImpl.java
Wed Jun  4 11:08:49 2008
@@ -16,6 +16,9 @@
  */
 package org.apache.jetspeed.pipeline.valve.impl;
 
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.Enumeration;
 import java.util.Stack;
 
 import javax.servlet.RequestDispatcher;
@@ -79,6 +82,7 @@
                     rd.include(httpRequest, request.getResponse());
                 }
             }
+            // this.dumpSession(request);            
         }
         catch (Exception e)
         {
@@ -95,4 +99,47 @@
         return "CleanupValveImpl";
     }
 
+
+
+    public void dumpSession(RequestContext context)
+    {
+        try
+        {
+            int count = 0;
+            ByteArrayOutputStream bout =  new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream (bout);
+            Enumeration e = context.getRequest().getSession().getAttributeNames();
+            while (e.hasMoreElements())
+            {
+                String name = (String)e.nextElement();
+                Object o = context.getSessionAttribute(name);
+                serializeObject(name, o);
+                out.writeObject(o); 
+                count++;
+            }
+            out.close();
+            log.info("Session object: " + count);
+            log.info("Session footprint: " + bout.size());
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }
+    
+    public void serializeObject(String name, Object o)
+    {
+        try
+        {
+            ByteArrayOutputStream bout =  new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream (bout);
+            out.writeObject(o);
+            out.close();
+            log.info("o = " + name + ", " + o + ", size = " + bout.size() );            
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+        }
+    }            
 }



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


Mime
View raw message