You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/03/03 00:01:31 UTC
svn commit: r1076448 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry5/
main/java/org/apache/tapestry5/internal/pageload/
main/java/org/apache/tapestry5/internal/services/
main/java/org/apache/tapestry5/internal/structure...
Author: hlship
Date: Wed Mar 2 23:01:30 2011
New Revision: 1076448
URL: http://svn.apache.org/viewvc?rev=1076448&view=rev
Log:
TAP5-1455: Remove remnants of PagePool
Removed:
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/PagePoolCache.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImplMBean.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestPageCacheImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PagePoolCacheTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PagePoolImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestPageCacheImplTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/PageImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java Wed Mar 2 23:01:30 2011
@@ -230,57 +230,6 @@ public class SymbolConstants
public static final String DEFAULT_STYLESHEET = "tapestry.default-stylesheet";
/**
- * The number of pages in the page pool (for a given page name / locale combination) before which Tapestry will
- * start to wait for existing pages to be made available.
- * Under this limit of pages, Tapestry will simply create a new page instance if no existing instance is readily
- * available.
- * Once the soft limit is reached, Tapestry will wait a short period of time (the soft wait interval) to see if an
- * existing page
- * instance is made available. It will then create a new page instance (unless the hard limit has been reached).
- * The default is 5 page instances. Remember that page pooling is done separately for each page (and localization of
- * the page).
- *
- * @since 5.2.0
- */
- public static final String PAGE_POOL_SOFT_LIMIT = "tapestry.page-pool.soft-limit";
-
- /**
- * The absolute maximum number of page instances (for a particular page name / locale combination) that Tapestry
- * will create at any time.
- * If this number is reached, then requests will fail because a page instance is not available ... this can happen
- * as part of a denial of service attack.
- * For this value to have any meaning, it should be lower than the number of threads that the servlet container is
- * configured to use when processing requests.
- * The default is 20 page instances.
- *
- * @deprecated The hard limit will be removed in a later release of Tapestry, as the maximum number of instance
- * is easily controlled by limiting the number of request handling threads in the servlet container.
- * @since 5.2.0
- */
- public static final String PAGE_POOL_HARD_LIMIT = "tapestry.page-pool.hard-limit";
-
- /**
- * The time interval that Tapestry will wait for a page instance to become available before deciding whether to
- * create an entirely new page instance.
- * The default is "10 ms".
- *
- * @since 5.2.0
- */
- public static final String PAGE_POOL_SOFT_WAIT = "tapestry.page-pool.soft-wait";
-
- /**
- * The time interval that an instantiated page instance may be cached before being removed. As pages are returned to
- * the pool, they are time stamped.
- * Periodically (as per the file check interval), the pool is scanned for page instances that have not been used
- * recently; those that are outside the
- * active window are discarded. This is used to free up unnecessary page instances after a request surge. The
- * default is "10 m" (10 minutes).
- *
- * @since 5.2.0
- */
- public static final String PAGE_POOL_ACTIVE_WINDOW = "tapestry.page-pool.active-window";
-
- /**
* The Asset path to the embedded copy of script.aculo.us packaged with Tapestry.
*
* @since 5.2.0
@@ -317,17 +266,6 @@ public class SymbolConstants
public static final String COMPACT_JSON = "tapestry.compact-json";
/**
- * If "true", then Tapestry 5.1 (and earlier) style page pooling will be used. The default is "false", to
- * allow full use of page singleton. Enabling page pooling is only necessary if an application (or library)
- * has created {@linkplain ComponentClassTransformWorker class transformations} that introduce new, mutable
- * fields into component classes. That's a very rare thing (most created fields contain immutable data).
- *
- * @deprecated To be removed, along with the remnants of page pooling, in Tapestry 5.3.
- * @since 5.2.0
- */
- public static final String PAGE_POOL_ENABLED = "tapestry.page-pool-enabled";
-
- /**
* If "true" and {@link #PRODUCTION_MODE} is off, comments will be rendered before and after the rendering of any
* component
* allowing more visibility into which components rendered which markup. Defaults to "false". Component render
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/pageload/PageLoaderImpl.java Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2009, 2010 The Apache Software Foundation
+// Copyright 2009, 2010, 2011 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.
@@ -14,21 +14,53 @@
package org.apache.tapestry5.internal.pageload;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
import org.apache.tapestry5.Binding;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.InternalComponentResources;
import org.apache.tapestry5.internal.InternalConstants;
import org.apache.tapestry5.internal.bindings.LiteralBinding;
-import org.apache.tapestry5.internal.parser.*;
-import org.apache.tapestry5.internal.services.*;
-import org.apache.tapestry5.internal.structure.*;
+import org.apache.tapestry5.internal.parser.AttributeToken;
+import org.apache.tapestry5.internal.parser.BlockToken;
+import org.apache.tapestry5.internal.parser.CDATAToken;
+import org.apache.tapestry5.internal.parser.CommentToken;
+import org.apache.tapestry5.internal.parser.ComponentTemplate;
+import org.apache.tapestry5.internal.parser.DTDToken;
+import org.apache.tapestry5.internal.parser.DefineNamespacePrefixToken;
+import org.apache.tapestry5.internal.parser.ExpansionToken;
+import org.apache.tapestry5.internal.parser.ExtensionPointToken;
+import org.apache.tapestry5.internal.parser.ParameterToken;
+import org.apache.tapestry5.internal.parser.StartComponentToken;
+import org.apache.tapestry5.internal.parser.StartElementToken;
+import org.apache.tapestry5.internal.parser.TemplateToken;
+import org.apache.tapestry5.internal.parser.TextToken;
+import org.apache.tapestry5.internal.parser.TokenType;
+import org.apache.tapestry5.internal.services.ComponentInstantiatorSource;
+import org.apache.tapestry5.internal.services.ComponentTemplateSource;
+import org.apache.tapestry5.internal.services.Instantiator;
+import org.apache.tapestry5.internal.services.PageElementFactory;
+import org.apache.tapestry5.internal.services.PageLoader;
+import org.apache.tapestry5.internal.services.PersistentFieldManager;
+import org.apache.tapestry5.internal.services.StringInterner;
+import org.apache.tapestry5.internal.structure.BlockImpl;
+import org.apache.tapestry5.internal.structure.CommentPageElement;
+import org.apache.tapestry5.internal.structure.ComponentPageElement;
+import org.apache.tapestry5.internal.structure.ComponentPageElementResources;
+import org.apache.tapestry5.internal.structure.ComponentPageElementResourcesSource;
+import org.apache.tapestry5.internal.structure.DTDPageElement;
+import org.apache.tapestry5.internal.structure.Page;
+import org.apache.tapestry5.internal.structure.PageImpl;
+import org.apache.tapestry5.internal.structure.StartElementPageElement;
+import org.apache.tapestry5.internal.structure.TextPageElement;
import org.apache.tapestry5.ioc.Invokable;
import org.apache.tapestry5.ioc.Location;
import org.apache.tapestry5.ioc.OperationTracker;
-import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.ioc.internal.util.TapestryException;
@@ -43,15 +75,10 @@ import org.apache.tapestry5.services.Com
import org.apache.tapestry5.services.InvalidationListener;
import org.apache.tapestry5.services.Request;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
/**
* There's still a lot of room to beef up {@link org.apache.tapestry5.internal.pageload.ComponentAssembler} and
* {@link org.apache.tapestry5.internal.pageload.EmbeddedComponentAssembler} to perform more static analysis, but
- * that may no longer be necessary, given Tapestry 5.2's default use of non-pooled pages.
+ * that may no longer be necessary, given the switch to shared (non-pooled) pages in 5.2.
* <p/>
* Loading a page involves a recursive process of creating
* {@link org.apache.tapestry5.internal.pageload.ComponentAssembler}s: for the root component, then down the tree for
@@ -141,19 +168,16 @@ public class PageLoaderImpl implements P
private final OperationTracker tracker;
private final PerthreadManager perThreadManager;
-
+
private final Request request;
-
- private final SymbolSource symbolSource;
- private final boolean poolingEnabled;
+ private final SymbolSource symbolSource;
public PageLoaderImpl(ComponentInstantiatorSource instantiatorSource, ComponentTemplateSource templateSource,
PageElementFactory elementFactory, ComponentPageElementResourcesSource resourcesSource,
ComponentClassResolver componentClassResolver, PersistentFieldManager persistentFieldManager,
- StringInterner interner, OperationTracker tracker, PerthreadManager perThreadManager, Request request, SymbolSource symbolSource,
- @Symbol(SymbolConstants.PAGE_POOL_ENABLED)
- boolean poolingEnabled)
+ StringInterner interner, OperationTracker tracker, PerthreadManager perThreadManager, Request request,
+ SymbolSource symbolSource)
{
this.instantiatorSource = instantiatorSource;
this.templateSource = templateSource;
@@ -164,7 +188,6 @@ public class PageLoaderImpl implements P
this.interner = interner;
this.tracker = tracker;
this.perThreadManager = perThreadManager;
- this.poolingEnabled = poolingEnabled;
this.request = request;
this.symbolSource = symbolSource;
}
@@ -182,8 +205,7 @@ public class PageLoaderImpl implements P
{
public Page invoke()
{
- Page page = new PageImpl(logicalPageName, locale, persistentFieldManager, perThreadManager,
- poolingEnabled);
+ Page page = new PageImpl(logicalPageName, locale, persistentFieldManager, perThreadManager);
ComponentAssembler assembler = getAssembler(pageClassName, locale);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2008, 2009, 2010, 2011 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.
@@ -24,19 +24,15 @@ import org.apache.tapestry5.internal.str
import org.apache.tapestry5.internal.structure.ComponentPageElementResourcesSourceImpl;
import org.apache.tapestry5.ioc.ObjectLocator;
import org.apache.tapestry5.ioc.OrderedConfiguration;
-import org.apache.tapestry5.ioc.ScopeConstants;
import org.apache.tapestry5.ioc.ServiceBinder;
-import org.apache.tapestry5.ioc.ServiceResources;
import org.apache.tapestry5.ioc.annotations.Autobuild;
import org.apache.tapestry5.ioc.annotations.Marker;
import org.apache.tapestry5.ioc.annotations.Primary;
-import org.apache.tapestry5.ioc.annotations.Scope;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.services.CtClassSource;
import org.apache.tapestry5.ioc.services.Builtin;
import org.apache.tapestry5.ioc.services.ClassFactory;
import org.apache.tapestry5.ioc.services.ClasspathURLConverter;
-import org.apache.tapestry5.ioc.services.PerthreadManager;
import org.apache.tapestry5.ioc.services.PropertyShadowBuilder;
import org.apache.tapestry5.services.ComponentClasses;
import org.apache.tapestry5.services.ComponentLayer;
@@ -102,6 +98,7 @@ public class InternalModule
binder.bind(JavaScriptStackPathConstructor.class);
binder.bind(AjaxFormUpdateController.class);
binder.bind(ResourceDigestManager.class, ResourceDigestManagerImpl.class);
+ binder.bind(RequestPageCache.class, NonPoolingRequestPageCacheImpl.class);
}
/**
@@ -120,30 +117,6 @@ public class InternalModule
return locator.autobuild(ActionRenderResponseGeneratorImpl.class);
}
- @Scope(ScopeConstants.PERTHREAD)
- public static RequestPageCache buildRequestPageCache(ServiceResources serviceResources,
- @Symbol(SymbolConstants.PAGE_POOL_ENABLED)
- boolean pagePoolEnabled, PerthreadManager perthreadManager)
- {
- if (pagePoolEnabled)
- {
-
- RequestPageCacheImpl service = serviceResources.autobuild(RequestPageCacheImpl.class);
-
- perthreadManager.addThreadCleanupListener(service);
-
- return service;
- }
-
- // Modern, non-pooling
-
- NonPoolingRequestPageCacheImpl service = serviceResources.autobuild(NonPoolingRequestPageCacheImpl.class);
-
- perthreadManager.addThreadCleanupListener(service);
-
- return service;
- }
-
public ComponentInstantiatorSource buildComponentInstantiatorSource(@Builtin
ClassFactory classFactory,
@@ -190,34 +163,6 @@ public class InternalModule
return service;
}
- public PagePool buildPagePool(@Autobuild
- PagePoolImpl service,
-
- @ComponentTemplates
- InvalidationEventHub templatesHub,
-
- @ComponentMessages
- InvalidationEventHub messagesHub)
- {
- // This covers invalidations due to changes to classes
-
- classesInvalidationEventHub.addInvalidationListener(service);
-
- // This covers invalidation due to changes to message catalogs (properties files)
-
- messagesHub.addInvalidationListener(service);
-
- // ... and this covers invalidations due to changes to templates
-
- templatesHub.addInvalidationListener(service);
-
- // Give the service a chance to clean up its own cache periodically as well
-
- updateListenerHub.addUpdateListener(service);
-
- return service;
- }
-
public PageSource buildPageSource(@Autobuild
PageSourceImpl service,
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2011 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.
@@ -18,13 +18,24 @@ import java.util.Locale;
import java.util.Map;
import org.apache.tapestry5.internal.structure.Page;
+import org.apache.tapestry5.ioc.ScopeConstants;
+import org.apache.tapestry5.ioc.annotations.PostInjection;
+import org.apache.tapestry5.ioc.annotations.Scope;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.ioc.services.PerthreadManager;
import org.apache.tapestry5.ioc.services.ThreadCleanupListener;
import org.apache.tapestry5.ioc.services.ThreadLocale;
import org.apache.tapestry5.services.ComponentClassResolver;
import org.slf4j.Logger;
+/**
+ * In Tapestry 5.1, there implementation of this worked with the page pool (a pool of page instances, reserved
+ * to individual requests/threads). Page pooling was deprecated in 5.2 and removed in 5.3.
+ *
+ * @since 5.2
+ */
+@Scope(ScopeConstants.PERTHREAD)
public class NonPoolingRequestPageCacheImpl implements RequestPageCache, ThreadCleanupListener
{
private final Logger logger;
@@ -46,6 +57,12 @@ public class NonPoolingRequestPageCacheI
this.threadLocale = threadLocale;
}
+ @PostInjection
+ public void listenForThreadCleanup(PerthreadManager perthreadManager)
+ {
+ perthreadManager.addThreadCleanupListener(this);
+ }
+
public void threadDidCleanup()
{
for (Page page : cache.values())
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/ComponentPageElementImpl.java Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -238,9 +238,10 @@ public class ComponentPageElementImpl ex
protected void invokeComponent(Component component, MarkupWriter writer, Event event)
{
- if (isRenderTracingEnabled())
- writer.comment("BEGIN " + component.getComponentResources().getCompleteId() + " (" + getLocation() + ")");
-
+ if (isRenderTracingEnabled())
+ writer.comment("BEGIN " + component.getComponentResources().getCompleteId() + " (" + getLocation()
+ + ")");
+
component.beginRender(writer, event);
}
@@ -415,9 +416,9 @@ public class ComponentPageElementImpl ex
protected void invokeComponent(Component component, MarkupWriter writer, Event event)
{
component.afterRender(writer, event);
-
- if (isRenderTracingEnabled())
- writer.comment("END " + component.getComponentResources().getCompleteId());
+
+ if (isRenderTracingEnabled())
+ writer.comment("END " + component.getComponentResources().getCompleteId());
}
public void render(final MarkupWriter writer, RenderQueue queue)
@@ -485,12 +486,6 @@ public class ComponentPageElementImpl ex
invoke(false, POST_RENDER_CLEANUP);
queue.endComponent();
-
- // Now and only now the component is done rendering and fully cleaned up. Decrement
- // the page's dirty count. If the entire render goes well, then the page will be
- // clean and can be stored into the pool for later reuse.
-
- page.decrementDirtyCount();
}
@Override
@@ -551,12 +546,12 @@ public class ComponentPageElementImpl ex
private final PerThreadValue<RenderPhaseEvent> renderEvent;
private final PerThreadValue<Boolean> rendering;
-
+
// should be okay since it's a shadow service object
private final Request request;
private final SymbolSource symbolSource;
- private final boolean productionMode;
- private final boolean componentTracingEnabled;
+ private final boolean productionMode;
+ private final boolean componentTracingEnabled;
// We know that, at the very least, there will be an element to force the component to render
// its body, so there's no reason to wait to initialize the list.
@@ -603,11 +598,12 @@ public class ComponentPageElementImpl ex
this.elementResources = elementResources;
this.request = request;
this.symbolSource = symbolSource;
-
+
// evaluate this once because it gets referenced a lot during rendering
this.productionMode = "true".equals(symbolSource.valueForSymbol(SymbolConstants.PRODUCTION_MODE));
- this.componentTracingEnabled = "true".equals(symbolSource.valueForSymbol(SymbolConstants.COMPONENT_RENDER_TRACING_ENABLED));
-
+ this.componentTracingEnabled = "true".equals(symbolSource
+ .valueForSymbol(SymbolConstants.COMPONENT_RENDER_TRACING_ENABLED));
+
ComponentResources containerResources = container == null ? null : container.getComponentResources();
coreResources = new InternalComponentResourcesImpl(this.page, this, containerResources, this.elementResources,
@@ -624,7 +620,8 @@ public class ComponentPageElementImpl ex
/**
* Constructor for the root component of a page.
*/
- public ComponentPageElementImpl(Page page, Instantiator instantiator, ComponentPageElementResources elementResources, Request request, SymbolSource symbolSource)
+ public ComponentPageElementImpl(Page page, Instantiator instantiator,
+ ComponentPageElementResources elementResources, Request request, SymbolSource symbolSource)
{
this(page, null, null, null, page.getName(), null, instantiator, null, elementResources, request, symbolSource);
}
@@ -1040,10 +1037,6 @@ public class ComponentPageElementImpl ex
// TODO: An error if the render flag is already set (recursive rendering not
// allowed or advisable).
- // Once we start rendering, the page is considered dirty, until we cleanup post render.
-
- page.incrementDirtyCount();
-
// TODO: Check for recursive rendering.
rendering.set(true);
@@ -1319,8 +1312,9 @@ public class ComponentPageElementImpl ex
return result;
}
-
- boolean isRenderTracingEnabled() {
- return !productionMode && (componentTracingEnabled || "true".equals(request.getParameter("t:component-trace")));
- }
+
+ boolean isRenderTracingEnabled()
+ {
+ return !productionMode && (componentTracingEnabled || "true".equals(request.getParameter("t:component-trace")));
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/Page.java Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -164,23 +164,6 @@ public interface Page
Object getFieldChange(String nestedId, String fieldName);
/**
- * Called as a component initially starts to render itself. This is used to check for the cases
- * where a component
- * causes a runtime exception that aborts the render early, leaving the page in an invalid
- * state.
- *
- * @deprecated No longer useful with non-pooled pages, to be removed for efficiency
- */
- void incrementDirtyCount();
-
- /**
- * Called as a component finishes rendering itself.
- *
- * @deprecated No longer useful with non-pooled pages, to be removed for efficiency
- */
- void decrementDirtyCount();
-
- /**
* Discards all persistent field changes for the page containing the component. Changes are
* eliminated from
* persistent storage (such as the {@link org.apache.tapestry5.services.Session}) which will
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/PageImpl.java Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -43,8 +43,6 @@ public class PageImpl implements Page
private final List<PageResetListener> resetListeners = CollectionFactory.newList();
- private final PerThreadValue<Integer> dirtyCount;
-
private boolean loadComplete;
private final OneShotLock lock = new OneShotLock();
@@ -65,25 +63,14 @@ public class PageImpl implements Page
* for access to cross-request persistent values
* @param perThreadManager
* for managing per-request mutable state
- * @param pooled
- * if pooling enabled, or is this page a singleton
*/
public PageImpl(String name, Locale locale, PersistentFieldManager persistentFieldManager,
- PerthreadManager perThreadManager, boolean pooled)
+ PerthreadManager perThreadManager)
{
this.name = name;
this.locale = locale;
this.persistentFieldManager = persistentFieldManager;
- if (pooled)
- {
- dirtyCount = perThreadManager.createValue();
- }
- else
- {
- dirtyCount = null;
- }
-
fieldBundle = perThreadManager.createValue();
}
@@ -145,7 +132,7 @@ public class PageImpl implements Page
public boolean detached()
{
- boolean result = dirtyCount != null && dirtyCount.exists() && dirtyCount.get() > 0;
+ boolean result = false;
for (PageLifecycleListener listener : lifecycleListeners)
{
@@ -177,9 +164,6 @@ public class PageImpl implements Page
public void attached()
{
- if (dirtyCount != null && dirtyCount.exists() && !dirtyCount.get().equals(0))
- throw new IllegalStateException(StructureMessages.pageIsDirty(this));
-
for (PageLifecycleListener listener : lifecycleListeners)
listener.restoreStateBeforePageAttach();
@@ -208,31 +192,11 @@ public class PageImpl implements Page
return fieldBundle.get().getValue(nestedId, fieldName);
}
- public void decrementDirtyCount()
- {
- if (dirtyCount != null)
- {
- int newCount = dirtyCount.get() - 1;
-
- dirtyCount.set(newCount);
- }
- }
-
public void discardPersistentFieldChanges()
{
persistentFieldManager.discardChanges(name);
}
- public void incrementDirtyCount()
- {
- if (dirtyCount != null)
- {
- int newCount = dirtyCount.get(0) + 1;
-
- dirtyCount.set(newCount);
- }
- }
-
public String getName()
{
return name;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/StructureMessages.java Wed Mar 2 23:01:30 2011
@@ -64,11 +64,6 @@ final class StructureMessages
return MESSAGES.format("unbalanced-elements", componentId);
}
- static String pageIsDirty(Page page)
- {
- return MESSAGES.format("page-is-dirty", page);
- }
-
static String duplicateChildComponent(ComponentPageElement container, String childId)
{
return MESSAGES.format("duplicate-child-component", container.getCompleteId(), childId);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Wed Mar 2 23:01:30 2011
@@ -2416,12 +2416,6 @@ public final class TapestryModule
configuration.add(SymbolConstants.DEFAULT_STYLESHEET, "classpath:/org/apache/tapestry5/default.css");
configuration.add("tapestry.spacer-image", "classpath:/org/apache/tapestry5/spacer.gif");
- configuration.add(SymbolConstants.PAGE_POOL_SOFT_LIMIT, "5");
- configuration.add(SymbolConstants.PAGE_POOL_SOFT_WAIT, "10 ms");
- configuration.add(SymbolConstants.PAGE_POOL_HARD_LIMIT, "20");
- configuration.add(SymbolConstants.PAGE_POOL_ACTIVE_WINDOW, "10 m");
- configuration.add(SymbolConstants.PAGE_POOL_ENABLED, "false");
-
configuration.add(SymbolConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS, "false");
configuration.add(SymbolConstants.FORCE_ABSOLUTE_URIS, "false");
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/structure/StructureStrings.properties Wed Mar 2 23:01:30 2011
@@ -1,4 +1,4 @@
-# Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+# Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -21,8 +21,6 @@ block-not-found=Template for component %
unbalanced-elements=Component %s has rendered unbalanced elements; \
either it has started an element with MarkupWriter.element() and not followed up with MarkupWriter.end(), or \
it has invoked MarkupWriter.end() without first invoking MarkupWriter.element().
-page-is-dirty=Page %s was stored into the page pool in a dirty state. This should never happen, \
- and may indicate that a reference to the page (or component within the page) was retained past the end of a request.
duplicate-child-component=Component %s already contains a child component with id '%s'. \
Embedded component ids must be unique (excluding case, which is ignored).
original-child-component=Component %s declared original child component with id '%s' in %s on line %s.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/PageImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/PageImplTest.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/PageImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/structure/PageImplTest.java Wed Mar 2 23:01:30 2011
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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,
@@ -33,19 +33,19 @@ public class PageImplTest extends Intern
private static final String LOGICAL_PAGE_NAME = "MyPage";
private PerthreadManager perThreadManager;
-
+
@BeforeClass
public void setup()
{
perThreadManager = getService(PerthreadManager.class);
}
-
+
@AfterMethod
public void cleanup()
{
perThreadManager.cleanup();
}
-
+
@Test
public void accessor_methods()
{
@@ -53,7 +53,7 @@ public class PageImplTest extends Intern
replay();
- Page page = new PageImpl(LOGICAL_PAGE_NAME, locale, null, perThreadManager, true);
+ Page page = new PageImpl(LOGICAL_PAGE_NAME, locale, null, perThreadManager);
assertNull(page.getRootElement());
@@ -77,7 +77,7 @@ public class PageImplTest extends Intern
replay();
- Page page = new PageImpl(null, locale, null, perThreadManager, true);
+ Page page = new PageImpl(null, locale, null, perThreadManager);
page.addLifecycleListener(listener1);
page.addLifecycleListener(listener2);
@@ -88,29 +88,6 @@ public class PageImplTest extends Intern
}
/**
- * Also checks that listeners are invoked, even if the page is dirty.
- */
- @Test
- public void detach_dirty_if_dirty_count_non_zero()
- {
- PageLifecycleListener listener = newPageLifecycle();
-
- listener.containingPageDidDetach();
-
- replay();
-
- Page page = new PageImpl(null, locale, null, perThreadManager, true);
-
- page.addLifecycleListener(listener);
-
- page.incrementDirtyCount();
-
- assertTrue(page.detached());
-
- verify();
- }
-
- /**
* Also checks that all listeners are invoked, even if one of them throws an exception.
*/
@Test
@@ -133,7 +110,7 @@ public class PageImplTest extends Intern
replay();
- Page page = new PageImpl(null, locale, null, perThreadManager, true);
+ Page page = new PageImpl(null, locale, null, perThreadManager);
page.setRootElement(element);
page.addLifecycleListener(listener1);
@@ -163,7 +140,7 @@ public class PageImplTest extends Intern
replay();
- Page page = new PageImpl(null, locale, null, perThreadManager, true);
+ Page page = new PageImpl(null, locale, null, perThreadManager);
page.addLifecycleListener(listener1);
page.addLifecycleListener(listener2);
@@ -189,7 +166,7 @@ public class PageImplTest extends Intern
replay();
- Page page = new PageImpl(LOGICAL_PAGE_NAME, locale, null, perThreadManager, true);
+ Page page = new PageImpl(LOGICAL_PAGE_NAME, locale, null, perThreadManager);
page.addLifecycleListener(listener1);
page.addLifecycleListener(listener2);
@@ -206,7 +183,7 @@ public class PageImplTest extends Intern
replay();
- Page page = new PageImpl(LOGICAL_PAGE_NAME, locale, null, perThreadManager, true);
+ Page page = new PageImpl(LOGICAL_PAGE_NAME, locale, null, perThreadManager);
page.setRootElement(root);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java?rev=1076448&r1=1076447&r2=1076448&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java Wed Mar 2 23:01:30 2011
@@ -179,11 +179,6 @@ public class InternalBaseTestCase extend
expect(loader.loadPage(pageName, locale)).andReturn(page);
}
- protected final PagePool mockPagePool()
- {
- return newMock(PagePool.class);
- }
-
protected RenderQueue mockRenderQueue()
{
return newMock(RenderQueue.class);