Author: hlship
Date: Thu May 27 00:09:21 2010
New Revision: 948640

URL: http://svn.apache.org/viewvc?rev=948640&view=rev
Log:
Add a clear() method to the internal PagePool service

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePool.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePool.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePool.java?rev=948640&r1=948639&r2=948640&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePool.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePool.java
 Thu May 27 00:09:21 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
 //
 // Licensed 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
+// 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,
@@ -23,28 +23,39 @@ public interface PagePool
 {
     /**
      * Obtains a page instance from the pool via a logical page name. A page 
instance is created if no such page is
-     * currently available.  The page pool enforces limits on the number of 
page instances (for any page name / locale
+     * currently available. The page pool enforces limits on the number of 
page instances (for any page name / locale
      * combination) and may wait for a page to become available rather than 
create a new instance. There's also a hard
      * limit, at which point an exception is raised.
-     *
-     * @param pageName the canonical page name
+     * 
+     * @param pageName
+     *            the canonical page name
      * @return a page instance
-     * @throws RuntimeException if the name is not valid, if the page cannot 
be loaded, or if an instance of the page
-     *                          can't be created.
+     * @throws RuntimeException
+     *             if the name is not valid, if the page cannot be loaded, or 
if an instance of the page
+     *             can't be created.
      */
     Page checkout(String pageName);
 
     /**
      * Releases a previously checked-out page.
-     *
-     * @param page a previously checked-out page
+     * 
+     * @param page
+     *            a previously checked-out page
      */
     void release(Page page);
 
     /**
      * Discards a page, which occurs when there are errors invoking lifecycle 
methods on the page.
-     *
-     * @param page a previously checked-out page
+     * 
+     * @param page
+     *            a previously checked-out page
      */
     void discard(Page page);
+
+    /**
+     * Forces the page pool to discard all pooled pages.
+     * 
+     * @since 5.2.0
+     */
+    void clear();
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java?rev=948640&r1=948639&r2=948640&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java
 Thu May 27 00:09:21 2010
@@ -4,7 +4,7 @@
 // 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
+// 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,
@@ -45,7 +45,7 @@ import java.util.Map;
  * <p/>
  * As an {...@link org.apache.tapestry5.services.UpdateListener}, the service 
will reduce the size of each page's pool by
  * eliminating pages that haven't been used recently.
- *
+ * 
  * @see org.apache.tapestry5.internal.services.PagePoolCache
  */
 public class PagePoolImpl implements PagePool, InvalidationListener, 
UpdateListener, PagePoolImplMBean
@@ -68,21 +68,23 @@ public class PagePoolImpl implements Pag
 
     public PagePoolImpl(Logger logger,
 
-                        PageLoader pageLoader,
+    PageLoader pageLoader,
 
-                        ThreadLocale threadLocale,
+    ThreadLocale threadLocale,
 
-                        @Symbol(SymbolConstants.PAGE_POOL_SOFT_LIMIT)
-                        int softLimit,
+    @Symbol(SymbolConstants.PAGE_POOL_SOFT_LIMIT)
+    int softLimit,
 
-                        @Symbol(SymbolConstants.PAGE_POOL_SOFT_WAIT) 
@IntermediateType(TimeInterval.class)
-                        long softWait,
+    @Symbol(SymbolConstants.PAGE_POOL_SOFT_WAIT)
+    @IntermediateType(TimeInterval.class)
+    long softWait,
 
-                        @Symbol(SymbolConstants.PAGE_POOL_HARD_LIMIT)
-                        int hardLimit,
+    @Symbol(SymbolConstants.PAGE_POOL_HARD_LIMIT)
+    int hardLimit,
 
-                        @Symbol(SymbolConstants.PAGE_POOL_ACTIVE_WINDOW) 
@IntermediateType(TimeInterval.class)
-                        long activeWindow)
+    @Symbol(SymbolConstants.PAGE_POOL_ACTIVE_WINDOW)
+    @IntermediateType(TimeInterval.class)
+    long activeWindow)
     {
         this.logger = logger;
         this.pageLoader = pageLoader;
@@ -152,7 +154,7 @@ public class PagePoolImpl implements Pag
      */
     public synchronized void objectWasInvalidated()
     {
-        pool.clear();
+        clear();
     }
 
     /**
@@ -167,6 +169,11 @@ public class PagePoolImpl implements Pag
         }
     }
 
+    public void clear()
+    {
+        pool.clear();
+    }
+
     public int getSoftLimit()
     {
         return softLimit;
@@ -175,7 +182,7 @@ public class PagePoolImpl implements Pag
     public void setSoftLimit(int softLimit)
     {
         this.softLimit = softLimit;
-        
+
         objectWasInvalidated();
     }
 
@@ -187,7 +194,7 @@ public class PagePoolImpl implements Pag
     public void setSoftWait(long softWait)
     {
         this.softWait = softWait;
-        
+
         objectWasInvalidated();
     }
 
@@ -199,7 +206,7 @@ public class PagePoolImpl implements Pag
     public void setHardLimit(int hardLimit)
     {
         this.hardLimit = hardLimit;
-        
+
         objectWasInvalidated();
     }
 
@@ -211,7 +218,7 @@ public class PagePoolImpl implements Pag
     public void setActiveWindow(long activeWindow)
     {
         this.activeWindow = activeWindow;
-        
+
         objectWasInvalidated();
     }
 


Reply via email to