jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r759568 - in /incubator/jspwiki/trunk: ./ src/java/org/apache/wiki/ src/java/org/apache/wiki/action/ src/java/org/apache/wiki/attachment/ src/java/org/apache/wiki/content/ src/java/org/apache/wiki/tags/ src/java/org/apache/wiki/ui/
Date Sat, 28 Mar 2009 20:06:26 GMT
Author: jalkanen
Date: Sat Mar 28 20:06:26 2009
New Revision: 759568

URL: http://svn.apache.org/viewvc?rev=759568&view=rev
Log:
Added WikiEngine.release() to make sure that JCR Sessions can
be released properly at the end of requests to prevent them from
growing uncontrollably.

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PageSizeTag.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/WikiServletFilter.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sat Mar 28 20:06:26 2009
@@ -1,3 +1,15 @@
+2009-03-28  Janne Jalkanen <jalkanen@apache.org>
+
+        * 3.0.0-svn-88
+        
+        * Added WikiEngine.release() to make sure that JCR Sessions can
+        be released properly at the end of requests to prevent them from
+        growing uncontrollably.
+        
+        * Removed some obsolete methods from WikiPage.
+        
+        * Cleaned up AbstractFileProvider
+        
 2009-03-28  Harry Metske <metskem@apache.org>
 
         * 3.0.0-svn-87

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Sat Mar 28 20:06:26 2009
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "87";
+    public static final String     BUILD         = "88";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java Sat Mar 28 20:06:26 2009
@@ -1568,6 +1568,7 @@
         fireEvent( WikiEngineEvent.SHUTDOWN );
         m_filterManager.destroy();
         LoggerFactory.unRegisterAllLoggerMBeans();
+        m_contentManager.release();
     }
 
     /**
@@ -2543,4 +2544,9 @@
     {
         return WatchDog.getCurrentWatchDog(this);
     }
+    
+    public void release()
+    {
+        m_contentManager.release();
+    }
 }

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java Sat Mar
28 20:06:26 2009
@@ -197,7 +197,6 @@
             att = engine.getContentManager().addPage( path, contentType );
             created = true;
         }
-        att.setSize( contentLength );
 
         if( user != null )
         {

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java Sat
Mar 28 20:06:26 2009
@@ -744,7 +744,6 @@
             }
             created = true;
         }
-        att.setSize( contentLength );
 
         //
         //  Check if we're allowed to do this?

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java Sat Mar 28
20:06:26 2009
@@ -290,13 +290,13 @@
     }
     
     /**
-     *  Discards all unsaved modifications made to this repository.
-     *  
-     *  @throws RepositoryException 
+     *  Discards all unsaved modifications made to this repository and releases
+     *  the Session.  Any calls after this will allocate a new Session. But
+     *  that's okay, since an unreleased Session will keep accumulating memory.
      */
-    public void discardModifications() throws RepositoryException
+    public void release()
     {
-        m_sessionManager.getSession().refresh( false );
+        m_sessionManager.releaseSession();
     }
         
     /*
@@ -904,7 +904,7 @@
             String proposedText = (String) getWorkflow().getAttribute( FACT_PROPOSED_TEXT
);
 
             WikiEngine engine = context.getEngine();
-            WikiPage page = context.getPage();
+            JCRWikiPage page = (JCRWikiPage)context.getPage();
 
             // Set the last-modified timestamp
             page.setLastModified( new Date() );
@@ -1264,12 +1264,17 @@
         {
             if( ownership != null && ((Owner)ownership).m_identity)
             {
-                Session session = m_currentSession.get();
-                session.logout();
-                m_currentSession.set(null);
+                releaseSession();
             }
         }
  
+        public void releaseSession()
+        {
+            Session session = m_currentSession.get();
+            session.logout();
+            m_currentSession.set(null);            
+        }
+        
         /**
          *  Between createSession() and destroySession() you may get the Session object
          *  with this call.

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PageSizeTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PageSizeTag.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PageSizeTag.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PageSizeTag.java Sat Mar 28 20:06:26
2009
@@ -22,9 +22,7 @@
 
 import java.io.IOException;
 
-import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.WikiPage;
-import org.apache.wiki.providers.ProviderException;
 
 
 /**
@@ -37,31 +35,19 @@
 {
     private static final long serialVersionUID = 0L;
     
+    /**
+     *  {@inheritDoc}
+     */
     public final int doWikiStartTag()
         throws IOException
     {
-        WikiEngine engine = m_wikiContext.getEngine();
         WikiPage   page   = m_wikiContext.getPage();
 
-        try
+        if( page != null )
         {
-            if( page != null )
-            {
-                long size = page.getSize();
-
-                if( size == -1 && engine.pageExists(page) ) // should never happen
with attachments
-                {
-                    size = engine.getPureText( page.getName(), page.getVersion() ).length();
-                    page.setSize( size );
-                }
+            long size = page.getSize();
 
-                pageContext.getOut().write( Long.toString(size) );
-            }
-        }
-        catch( ProviderException e )
-        {
-            log.warn("Providers did not work: ",e);
-            pageContext.getOut().write("Error determining page size: "+e.getMessage());
+            pageContext.getOut().write( Long.toString(size) );
         }
 
         return SKIP_BODY;

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/WikiServletFilter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/WikiServletFilter.java?rev=759568&r1=759567&r2=759568&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/WikiServletFilter.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/ui/WikiServletFilter.java Sat Mar 28
20:06:26 2009
@@ -186,6 +186,7 @@
         }
         finally
         {
+            m_engine.release(); // No longer used until next request.
             MDC.remove( m_engine.getApplicationName() + ":" + ((HttpServletRequest) request).getRequestURI()
);
         }
 



Mime
View raw message