Author: hlship
Date: Mon Jul 25 18:03:51 2011
New Revision: 1150818

URL: http://svn.apache.org/viewvc?rev=1150818&view=rev
Log:
TAP5-1580: Provide more logging information about pruned pages

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/ComponentResourceSelector.java
    
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app5/SkinningTests.groovy
    
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/pageload/ComponentResourceSelectorTests.groovy

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java?rev=1150818&r1=1150817&r2=1150818&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageSourceImpl.java
 Mon Jul 25 18:03:51 2011
@@ -117,14 +117,17 @@ public class PageSourceImpl implements P
             {
                 count++;
                 iterator.remove();
+
+                logger.info(String.format("Pruned page %s (%s), not accessed 
since %s.",
+                        page.getName(),
+                        page.getSelector().toShortString(),
+                        new Date(page.getLastAttachTime())));
             }
         }
 
         if (count > 0)
         {
-            logger.info(String.format("Pruned %d page %s that had not been 
accessed since %s.", count,
-                    count == 1 ? "instance" : "instances",
-                    new Date(cutoff)));
+            logger.info(String.format("Pruned %d page %s.", count, count == 1 
? "instance" : "instances"));
         }
     }
 

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/ComponentResourceSelector.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/ComponentResourceSelector.java?rev=1150818&r1=1150817&r2=1150818&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/ComponentResourceSelector.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/ComponentResourceSelector.java
 Mon Jul 25 18:03:51 2011
@@ -14,19 +14,19 @@
 
 package org.apache.tapestry5.services.pageload;
 
+import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
+
 import java.util.Collections;
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-
 /**
  * Encapsulates the information that is used when locating a template or 
message catalog associated with a component.
  * The selector is combined with the component class name to locate the other 
resources. The selector defines one or
  * more <em>axes</em> that are combined with a {@link 
ComponentResourceLocator} implementation to enforce a naming
  * convention for locating resources. The primary axis is {@link Locale} 
(Tapestry 5.2 and earlier used a Locale
  * instance as the selector), but Tapestry 5.3 adds support for additional 
axes.
- * 
+ *
  * @since 5.3
  */
 public final class ComponentResourceSelector
@@ -37,7 +37,7 @@ public final class ComponentResourceSele
 
     public ComponentResourceSelector(Locale locale)
     {
-        this(locale, Collections.<Class, Object> emptyMap());
+        this(locale, Collections.<Class, Object>emptyMap());
     }
 
     private ComponentResourceSelector(Locale locale, Map<Class, Object> axis)
@@ -52,11 +52,9 @@ public final class ComponentResourceSele
      * Returns a <em>new</em> selector with the given axis data. It is not 
allowed to redefine an existing axis type.
      * Typically, the axis type is an enum type. Axis values are expected to 
be immutable, and to implement
      * {@code equals()} and {@code hashCode()}.
-     * 
-     * @param axisType
-     *            non-blank axis key
-     * @param axisValue
-     *            non-null axis value
+     *
+     * @param axisType  non-blank axis key
+     * @param axisValue non-null axis value
      * @return
      */
     public <T> ComponentResourceSelector withAxis(Class<T> axisType, T 
axisValue)
@@ -76,7 +74,7 @@ public final class ComponentResourceSele
 
     /**
      * Returns a previously stored axis value, or null if no axis value of the 
specified type has been stored.
-     * 
+     *
      * @param <T>
      * @param axisType
      * @return value or null
@@ -86,7 +84,9 @@ public final class ComponentResourceSele
         return axisType.cast(axis.get(axisType));
     }
 
-    /** Returns true if the object is another selector with the same locale 
and set of axis. */
+    /**
+     * Returns true if the object is another selector with the same locale and 
set of axis.
+     */
     @Override
     public boolean equals(Object obj)
     {
@@ -110,7 +110,18 @@ public final class ComponentResourceSele
     @Override
     public String toString()
     {
-        StringBuilder builder = new 
StringBuilder("ComponentResourcesSelector[");
+        return String.format("ComponentResourceSelector[%s]", toShortString());
+    }
+
+    /**
+     * Returns a string identifying the locale, and any additional axis types 
and values.  Example,
+     * "en" or "fr com.example.Skin=RED".
+     *
+     * @return
+     */
+    public String toShortString()
+    {
+        StringBuilder builder = new StringBuilder();
 
         builder.append(locale.toString());
 
@@ -125,6 +136,6 @@ public final class ComponentResourceSele
             sep = ", ";
         }
 
-        return builder.append("]").toString();
+        return builder.toString();
     }
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app5/SkinningTests.groovy
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app5/SkinningTests.groovy?rev=1150818&r1=1150817&r2=1150818&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app5/SkinningTests.groovy
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app5/SkinningTests.groovy
 Mon Jul 25 18:03:51 2011
@@ -66,10 +66,10 @@ class SkinningTests extends TapestryCore
     {
         openLinks "reset session", "English"
         
-        assertText "selector", "ComponentResourcesSelector[en]"
+        assertText "selector", "ComponentResourceSelector[en]"
         
         clickAndWait "link=French"
         
-        assertText "selector", "ComponentResourcesSelector[fr]"        
+        assertText "selector", "ComponentResourceSelector[fr]"
     }
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/pageload/ComponentResourceSelectorTests.groovy
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/pageload/ComponentResourceSelectorTests.groovy?rev=1150818&r1=1150817&r2=1150818&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/pageload/ComponentResourceSelectorTests.groovy
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/pageload/ComponentResourceSelectorTests.groovy
 Mon Jul 25 18:03:51 2011
@@ -41,9 +41,9 @@ class ComponentResourceSelectorTests ext
 
     @Test
     void to_string() {
-        assert english.toString() == "ComponentResourcesSelector[en]";
+        assert english.toString() == "ComponentResourceSelector[en]";
 
-        assert english.withAxis(AnnotationUseContext.class, 
AnnotationUseContext.COMPONENT).toString() == "ComponentResourcesSelector[en 
org.apache.tapestry5.ioc.annotations.AnnotationUseContext=COMPONENT]"
+        assert english.withAxis(AnnotationUseContext.class, 
AnnotationUseContext.COMPONENT).toString() == "ComponentResourceSelector[en 
org.apache.tapestry5.ioc.annotations.AnnotationUseContext=COMPONENT]"
     }
 
     @Test


Reply via email to