You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2007/06/16 00:10:09 UTC
svn commit: r547813 - in /tapestry/tapestry4/trunk/tapestry-framework/src:
descriptor/META-INF/ java/org/apache/tapestry/enhance/
java/org/apache/tapestry/services/impl/ java/org/apache/tapestry/web/
Author: jkuhnert
Date: Fri Jun 15 15:10:08 2007
New Revision: 547813
URL: http://svn.apache.org/viewvc?view=rev&rev=547813
Log:
Slightly friendlier development mode class factory that dumps the javassist class pool on each reset. Results in fix of majority of major memory leaks in dev mode + reduction of many megs of those leaks. Only major culprit left is OgnlRuntime and I don't think that's going to be a problem to fix. ;)
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.ognl.xml
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/ClassFactoryImpl.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionCacheImpl.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionEvaluatorImpl.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/hivemodule.xml Fri Jun 15 15:10:08 2007
@@ -17,273 +17,285 @@
<module id="tapestry" version="4.0.0" package="org.apache.tapestry.services">
- The master module for the Apache Tapestry web application framework.
+ The master module for the Apache Tapestry web application framework.
- <dependency module-id="hivemind" version="1.1.0"/>
- <dependency module-id="hivemind.lib" version="1.1.0"/>
-
- <implementation service-id="hivemind.ClassFactory" >
-
- Wrapper around Javassist used to dynamically create classes such as service interceptors.
-
- <create-instance class="org.apache.tapestry.enhance.ClassFactoryImpl" model="primitive"/>
-
- </implementation>
-
- <sub-module descriptor="tapestry.init.xml"/>
- <sub-module descriptor="tapestry.globals.xml"/>
- <sub-module descriptor="tapestry.props.xml"/>
- <sub-module descriptor="tapestry.request.xml"/>
- <sub-module descriptor="tapestry.parse.xml"/>
- <sub-module descriptor="tapestry.enhance.xml"/>
- <sub-module descriptor="tapestry.page.xml"/>
- <sub-module descriptor="tapestry.data.xml"/>
- <sub-module descriptor="tapestry.script.xml"/>
- <sub-module descriptor="tapestry.bindings.xml"/>
- <sub-module descriptor="tapestry.services.xml"/>
- <sub-module descriptor="tapestry.ognl.xml"/>
- <sub-module descriptor="tapestry.coerce.xml"/>
- <sub-module descriptor="tapestry.url.xml"/>
- <sub-module descriptor="tapestry.asset.xml"/>
- <sub-module descriptor="tapestry.persist.xml"/>
- <sub-module descriptor="tapestry.state.xml"/>
- <sub-module descriptor="tapestry.multipart.xml"/>
- <sub-module descriptor="tapestry.describe.xml"/>
- <sub-module descriptor="tapestry.markup.xml"/>
- <sub-module descriptor="tapestry.error.xml"/>
- <sub-module descriptor="tapestry.valid.xml"/>
- <sub-module descriptor="tapestry.listener.xml"/>
- <sub-module descriptor="tapestry.form.xml"/>
- <sub-module descriptor="tapestry.l10n.xml"/>
- <sub-module descriptor="tapestry.event.xml"/>
- <sub-module descriptor="tapestry.render.xml"/>
-
-
- <service-point id="ClasspathResourceFactory">
-
- Constructs new instances of ClasspathResource.
-
- <invoke-factory>
- <construct class="impl.ClasspathResourceFactoryImpl"/>
- </invoke-factory>
- </service-point>
-
- <schema id="Infrastructure">
-
- Defines contributions to the Infrastructure and
- InfrastructureOverride configuration points.
-
- <element name="property">
-
- Defines an object to plug into a property of Infrastructure.
-
- <attribute name="name" required="true">
- The name of the Infrastructure property.
- </attribute>
-
- <attribute name="mode">
- The mode this contribution applies to. The Infrastructure
- is initalized to a particular mode. Contributions
- that specify a mode override contribution that don't specify a mode,
- but are ignored if the contribution mode doesn't match the
- Infrastructure mode.
- </attribute>
-
- <attribute name="object" translator="deferred-object">
- The object to be contributed into the Infrastructure property.
- </attribute>
-
- <attribute name="value">
- A literal value for the property. Either value or object should be provided.
- </attribute>
-
- <conversion class="impl.InfrastructureContribution">
- <map attribute="name" property="property"/>
- <map attribute="object" property="deferredObject"/>
- </conversion>
-
- </element>
-
- </schema>
-
- <configuration-point id="Infrastructure" schema-id="Infrastructure">
-
- The "factory" set of contributions into the configuration. These
- contributions are overridden by
- the InfrastructureOverrides configuration point.
-
- </configuration-point>
-
- <configuration-point id="InfrastructureOverrides" schema-id="Infrastructure">
-
- Provides a way for applications to easily override Infrastructure properties.
-
- </configuration-point>
-
- <service-point id="Infrastructure">
-
- A kind of "clearing house" of other services. The Infrastructure is provided to the
- IEngine instance via the InvokeEngineTerminator service (using an HttpServletRequest
- attribute). The engine can then get the other services it depends upon.
- The infrastructure: object provider allows access to the properties
- of this service. The Infrastructure and InfrastructureOverrides
- configuration points define which services are mapped to which
- Infrastructure properties.
-
- <invoke-factory>
- <construct class="impl.InfrastructureImpl">
- <set-service property="threadLocale" service-id="hivemind.ThreadLocale"/>
- <set-configuration property="normalContributions" configuration-id="Infrastructure"/>
- <set-configuration property="overrideContributions" configuration-id="InfrastructureOverrides"/>
- </construct>
- </invoke-factory>
-
- </service-point>
-
- <contribution configuration-id="Infrastructure">
- <property name="componentMessagesSource" object="service:ComponentMessagesSource"/>
- <property name="resetEventHub" object="service:ResetEventHub"/>
- <property name="objectPool" object="service:GlobalObjectPool"/>
- <property name="classFinder" object="service:ClassFinder"/>
- </contribution>
-
- <service-point id="ExtensionLookupFactory" interface="org.apache.hivemind.ServiceImplementationFactory">
-
- A service factory that, in fact, attempts to obtain service implementations
- as application extensions. Failing that, a default implementation is
- constructed.
-
- <parameters-schema>
-
- <element name="lookup">
-
- <attribute name="extension-name" required="true"/>
- <attribute name="default" translator="object"/>
-
- <conversion class="impl.ExtensionLookupParameter"/>
-
- </element>
-
- </parameters-schema>
-
- <invoke-factory>
- <construct class="impl.ExtensionLookupFactory">
- <set-object property="specification" value="infrastructure:applicationSpecification"/>
- <set-service property="defaultBuilder" service-id="hivemind.lib.DefaultImplementationBuilder"/>
- </construct>
- </invoke-factory>
- </service-point>
-
-
- <service-point id="ResetEventHub">
-
- Coordinator for services that have cached information that should be cleared out (this happens
- constantly in development, much more rarely in production).
-
- <create-instance class="impl.ResetEventHubImpl"/>
- </service-point>
-
- <service-point id="GlobalObjectPool" interface="ObjectPool">
-
- A general purpose object pool used throughout the application. Care should be
- taken to ensure that keys are sufficiently unique. This service will likely
- be removed soon; replaced with a number of more individual object pools
- (as necessary).
-
- <invoke-factory>
- <construct class="impl.ObjectPoolImpl">
- <event-listener service-id="ResetEventHub"/>
- <event-listener service-id="tapestry.describe.ReportStatusHub"/>
- </construct>
- </invoke-factory>
- </service-point>
-
-
- <service-point id="ComponentMessagesSource">
-
- Used to provide components (including pages) with access to their own localized messages.
-
- <invoke-factory>
- <construct class="impl.ComponentMessagesSourceImpl">
- <event-listener service-id="ResetEventHub"/>
- <set-object property="componentPropertySource" value="infrastructure:componentPropertySource"/>
- <set-service property="componentResourceResolver" service-id="tapestry.page.ComponentResourceResolver" />
- </construct>
- </invoke-factory>
-
- </service-point>
-
- <service-point id="InfrastructureObjectProvider" interface="org.apache.hivemind.service.ObjectProvider">
-
- ObjectProvider mapped to prefix "infrastructure:", the locator is the name of a property of the
- Infratructure service.
-
- <invoke-factory>
- <construct class="impl.InfrastructureObjectProvider">
- <set-service property="infrastructure" service-id="Infrastructure"/>
- </construct>
- </invoke-factory>
-
- </service-point>
-
-
- <contribution configuration-id="hivemind.ObjectProviders">
- <provider prefix="infrastructure" service-id="InfrastructureObjectProvider"/>
- </contribution>
-
- <service-point id="DeferredObjectTranslator" interface="org.apache.hivemind.schema.Translator" visibility="private">
-
- Translator that encapsulates the ObjectTranslator, returning DeferredObjects. This is to prevent
- premature or unnecessary object creation by the ObjectTranslator.
-
- <invoke-factory>
- <construct class="impl.DeferredObjectTranslator">
- <set-service property="objectTranslator" service-id="ObjectTranslator"/>
- </construct>
- </invoke-factory>
- </service-point>
-
- <contribution configuration-id="hivemind.Translators">
- <translator name="deferred-object" service-id="DeferredObjectTranslator"/>
- </contribution>
-
- <service-point id="ObjectTranslator" interface="org.apache.hivemind.schema.Translator" visibility="private">
-
- Translator that works with ObjectProviders to find or create objects. This is a duplicate
- of the HiveMind service (which is also private).
-
- <invoke-factory>
- <construct
- class="org.apache.hivemind.service.impl.ObjectTranslator">
- <set-configuration configuration-id="hivemind.ObjectProviders" property="contributions"/>
- </construct>
- </invoke-factory>
- </service-point>
-
- <service-point id="InjectedValueProviderFactory" interface="org.apache.hivemind.ServiceImplementationFactory"
- visibility="private" parameters-occurs="none">
-
- Special service factory for the InjectedValueProvider service.
-
- <invoke-factory>
- <construct class="impl.InjectedValueProviderFactory">
- <set-service property="objectTranslator" service-id="ObjectTranslator"/>
- </construct>
- </invoke-factory>
- </service-point>
-
- <service-point id="InjectedValueProvider" interface="InjectedValueProvider">
- <invoke-factory service-id="InjectedValueProviderFactory"/>
- </service-point>
-
- <service-point id="ClassFinder">
-
- Searches for classes within a list of packages.
-
- <invoke-factory>
- <construct class="impl.ClassFinderImpl"/>
- </invoke-factory>
-
- </service-point>
+ <dependency module-id="hivemind" version="1.1.0"/>
+ <dependency module-id="hivemind.lib" version="1.1.0"/>
+
+ <implementation service-id="hivemind.ClassFactory" >
+
+ Wrapper around Javassist used to dynamically create classes such as service interceptors.
+
+ <create-instance class="org.apache.tapestry.enhance.ClassFactoryImpl" model="primitive" />
+
+ </implementation>
+
+ <service-point id="ClassFactory" interface="org.apache.hivemind.service.ClassFactory" parameters-occurs="none">
+
+ Wrapper around Javassist used to dynamically create classes such as service interceptors.
+
+ <invoke-factory>
+ <construct class="org.apache.tapestry.enhance.ClassFactoryImpl">
+ <event-listener service-id="tapestry.ResetEventHub" />
+ </construct>
+ </invoke-factory>
+
+ </service-point>
+
+ <sub-module descriptor="tapestry.init.xml"/>
+ <sub-module descriptor="tapestry.globals.xml"/>
+ <sub-module descriptor="tapestry.props.xml"/>
+ <sub-module descriptor="tapestry.request.xml"/>
+ <sub-module descriptor="tapestry.parse.xml"/>
+ <sub-module descriptor="tapestry.enhance.xml"/>
+ <sub-module descriptor="tapestry.page.xml"/>
+ <sub-module descriptor="tapestry.data.xml"/>
+ <sub-module descriptor="tapestry.script.xml"/>
+ <sub-module descriptor="tapestry.bindings.xml"/>
+ <sub-module descriptor="tapestry.services.xml"/>
+ <sub-module descriptor="tapestry.ognl.xml"/>
+ <sub-module descriptor="tapestry.coerce.xml"/>
+ <sub-module descriptor="tapestry.url.xml"/>
+ <sub-module descriptor="tapestry.asset.xml"/>
+ <sub-module descriptor="tapestry.persist.xml"/>
+ <sub-module descriptor="tapestry.state.xml"/>
+ <sub-module descriptor="tapestry.multipart.xml"/>
+ <sub-module descriptor="tapestry.describe.xml"/>
+ <sub-module descriptor="tapestry.markup.xml"/>
+ <sub-module descriptor="tapestry.error.xml"/>
+ <sub-module descriptor="tapestry.valid.xml"/>
+ <sub-module descriptor="tapestry.listener.xml"/>
+ <sub-module descriptor="tapestry.form.xml"/>
+ <sub-module descriptor="tapestry.l10n.xml"/>
+ <sub-module descriptor="tapestry.event.xml"/>
+ <sub-module descriptor="tapestry.render.xml"/>
+
+
+ <service-point id="ClasspathResourceFactory">
+
+ Constructs new instances of ClasspathResource.
+
+ <invoke-factory>
+ <construct class="impl.ClasspathResourceFactoryImpl"/>
+ </invoke-factory>
+ </service-point>
+
+ <schema id="Infrastructure">
+
+ Defines contributions to the Infrastructure and
+ InfrastructureOverride configuration points.
+
+ <element name="property">
+
+ Defines an object to plug into a property of Infrastructure.
+
+ <attribute name="name" required="true">
+ The name of the Infrastructure property.
+ </attribute>
+
+ <attribute name="mode">
+ The mode this contribution applies to. The Infrastructure
+ is initalized to a particular mode. Contributions
+ that specify a mode override contribution that don't specify a mode,
+ but are ignored if the contribution mode doesn't match the
+ Infrastructure mode.
+ </attribute>
+
+ <attribute name="object" translator="deferred-object">
+ The object to be contributed into the Infrastructure property.
+ </attribute>
+
+ <attribute name="value">
+ A literal value for the property. Either value or object should be provided.
+ </attribute>
+
+ <conversion class="impl.InfrastructureContribution">
+ <map attribute="name" property="property"/>
+ <map attribute="object" property="deferredObject"/>
+ </conversion>
+
+ </element>
+
+ </schema>
+
+ <configuration-point id="Infrastructure" schema-id="Infrastructure">
+
+ The "factory" set of contributions into the configuration. These
+ contributions are overridden by
+ the InfrastructureOverrides configuration point.
+
+ </configuration-point>
+
+ <configuration-point id="InfrastructureOverrides" schema-id="Infrastructure">
+
+ Provides a way for applications to easily override Infrastructure properties.
+
+ </configuration-point>
+
+ <service-point id="Infrastructure">
+
+ A kind of "clearing house" of other services. The Infrastructure is provided to the
+ IEngine instance via the InvokeEngineTerminator service (using an HttpServletRequest
+ attribute). The engine can then get the other services it depends upon.
+ The infrastructure: object provider allows access to the properties
+ of this service. The Infrastructure and InfrastructureOverrides
+ configuration points define which services are mapped to which
+ Infrastructure properties.
+
+ <invoke-factory>
+ <construct class="impl.InfrastructureImpl">
+ <set-service property="threadLocale" service-id="hivemind.ThreadLocale"/>
+ <set-configuration property="normalContributions" configuration-id="Infrastructure"/>
+ <set-configuration property="overrideContributions" configuration-id="InfrastructureOverrides"/>
+ </construct>
+ </invoke-factory>
+
+ </service-point>
+
+ <contribution configuration-id="Infrastructure">
+ <property name="componentMessagesSource" object="service:ComponentMessagesSource"/>
+ <property name="resetEventHub" object="service:ResetEventHub"/>
+ <property name="objectPool" object="service:GlobalObjectPool"/>
+ <property name="classFinder" object="service:ClassFinder"/>
+ </contribution>
+
+ <service-point id="ExtensionLookupFactory" interface="org.apache.hivemind.ServiceImplementationFactory">
+
+ A service factory that, in fact, attempts to obtain service implementations
+ as application extensions. Failing that, a default implementation is
+ constructed.
+
+ <parameters-schema>
+
+ <element name="lookup">
+
+ <attribute name="extension-name" required="true"/>
+ <attribute name="default" translator="object"/>
+
+ <conversion class="impl.ExtensionLookupParameter"/>
+
+ </element>
+
+ </parameters-schema>
+
+ <invoke-factory>
+ <construct class="impl.ExtensionLookupFactory">
+ <set-object property="specification" value="infrastructure:applicationSpecification"/>
+ <set-service property="defaultBuilder" service-id="hivemind.lib.DefaultImplementationBuilder"/>
+ </construct>
+ </invoke-factory>
+ </service-point>
+
+
+ <service-point id="ResetEventHub">
+
+ Coordinator for services that have cached information that should be cleared out (this happens
+ constantly in development, much more rarely in production).
+
+ <create-instance class="impl.ResetEventHubImpl"/>
+ </service-point>
+
+ <service-point id="GlobalObjectPool" interface="ObjectPool">
+
+ A general purpose object pool used throughout the application. Care should be
+ taken to ensure that keys are sufficiently unique. This service will likely
+ be removed soon; replaced with a number of more individual object pools
+ (as necessary).
+
+ <invoke-factory>
+ <construct class="impl.ObjectPoolImpl">
+ <event-listener service-id="ResetEventHub"/>
+ <event-listener service-id="tapestry.describe.ReportStatusHub"/>
+ </construct>
+ </invoke-factory>
+ </service-point>
+
+
+ <service-point id="ComponentMessagesSource">
+
+ Used to provide components (including pages) with access to their own localized messages.
+
+ <invoke-factory>
+ <construct class="impl.ComponentMessagesSourceImpl">
+ <event-listener service-id="ResetEventHub"/>
+ <set-object property="componentPropertySource" value="infrastructure:componentPropertySource"/>
+ <set-service property="componentResourceResolver" service-id="tapestry.page.ComponentResourceResolver" />
+ </construct>
+ </invoke-factory>
+
+ </service-point>
+
+ <service-point id="InfrastructureObjectProvider" interface="org.apache.hivemind.service.ObjectProvider">
+
+ ObjectProvider mapped to prefix "infrastructure:", the locator is the name of a property of the
+ Infratructure service.
+
+ <invoke-factory>
+ <construct class="impl.InfrastructureObjectProvider">
+ <set-service property="infrastructure" service-id="Infrastructure"/>
+ </construct>
+ </invoke-factory>
+
+ </service-point>
+
+
+ <contribution configuration-id="hivemind.ObjectProviders">
+ <provider prefix="infrastructure" service-id="InfrastructureObjectProvider"/>
+ </contribution>
+
+ <service-point id="DeferredObjectTranslator" interface="org.apache.hivemind.schema.Translator" visibility="private">
+
+ Translator that encapsulates the ObjectTranslator, returning DeferredObjects. This is to prevent
+ premature or unnecessary object creation by the ObjectTranslator.
+
+ <invoke-factory>
+ <construct class="impl.DeferredObjectTranslator">
+ <set-service property="objectTranslator" service-id="ObjectTranslator"/>
+ </construct>
+ </invoke-factory>
+ </service-point>
+
+ <contribution configuration-id="hivemind.Translators">
+ <translator name="deferred-object" service-id="DeferredObjectTranslator"/>
+ </contribution>
+
+ <service-point id="ObjectTranslator" interface="org.apache.hivemind.schema.Translator" visibility="private">
+
+ Translator that works with ObjectProviders to find or create objects. This is a duplicate
+ of the HiveMind service (which is also private).
+
+ <invoke-factory>
+ <construct
+ class="org.apache.hivemind.service.impl.ObjectTranslator">
+ <set-configuration configuration-id="hivemind.ObjectProviders" property="contributions"/>
+ </construct>
+ </invoke-factory>
+ </service-point>
+
+ <service-point id="InjectedValueProviderFactory" interface="org.apache.hivemind.ServiceImplementationFactory"
+ visibility="private" parameters-occurs="none">
+
+ Special service factory for the InjectedValueProvider service.
+
+ <invoke-factory>
+ <construct class="impl.InjectedValueProviderFactory">
+ <set-service property="objectTranslator" service-id="ObjectTranslator"/>
+ </construct>
+ </invoke-factory>
+ </service-point>
+
+ <service-point id="InjectedValueProvider" interface="InjectedValueProvider">
+ <invoke-factory service-id="InjectedValueProviderFactory"/>
+ </service-point>
+
+ <service-point id="ClassFinder">
+
+ Searches for classes within a list of packages.
+
+ <invoke-factory>
+ <construct class="impl.ClassFinderImpl"/>
+ </invoke-factory>
+
+ </service-point>
</module>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml Fri Jun 15 15:10:08 2007
@@ -27,7 +27,7 @@
<invoke-factory>
<construct class="org.apache.tapestry.services.impl.ComponentConstructorFactoryImpl">
- <set-service property="classFactory" service-id="hivemind.ClassFactory" />
+ <set-service property="classFactory" service-id="tapestry.ClassFactory" />
<event-listener service-id="tapestry.ResetEventHub" />
<event-listener service-id="tapestry.describe.ReportStatusHub" />
<set-service property="validator" service-id="EnhancedClassValidator" />
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.ognl.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.ognl.xml?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.ognl.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.ognl.xml Fri Jun 15 15:10:08 2007
@@ -25,6 +25,7 @@
<service-point id="ExpressionEvaluator" interface="ExpressionEvaluator">
<invoke-factory>
<construct class="impl.ExpressionEvaluatorImpl">
+ <set-service property="classFactory" service-id="tapestry.ClassFactory" />
<set-object property="applicationSpecification" value="infrastructure:applicationSpecification"/>
<set-configuration property="contributions" configuration-id="PropertyAccessors"/>
<set-configuration property="nullHandlerContributions" configuration-id="NullHandlers"/>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/ClassFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/ClassFactoryImpl.java?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/ClassFactoryImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/ClassFactoryImpl.java Fri Jun 15 15:10:08 2007
@@ -18,15 +18,14 @@
import org.apache.hivemind.service.ClassFab;
import org.apache.hivemind.service.ClassFactory;
import org.apache.hivemind.service.InterfaceFab;
+import org.apache.tapestry.event.ResetEventListener;
/**
* Implementation of the hivemind core {@link ClassFactory} service to get around some incompatibilities
- * the current 1.1.1 implementation of hivemind has with the latest (3.4) version of javassist.
- *
- * @author jkuhnert
+ * the current 1.1.1 implementation of hivemind has with the latest (3.4) version of javassist.
*/
-public class ClassFactoryImpl implements ClassFactory
-{
+public class ClassFactoryImpl implements ClassFactory, ResetEventListener {
+
static final int EXPIRED_CLASS_COUNT = 100;
/**
@@ -37,7 +36,7 @@
private CtClassSource _classSource = new CtClassSource(_pool);
private int _classCounter = 0;
-
+
public ClassFab newClass(String name, Class superClass)
{
try
@@ -45,7 +44,7 @@
checkPoolExpiration();
CtClass ctNewClass = _classSource.newClass(name, superClass);
-
+
return new ClassFabImpl(_classSource, ctNewClass);
}
catch (Exception ex)
@@ -76,7 +75,15 @@
}
}
-
+
+ public void resetEventDidOccur()
+ {
+ _classCounter = 0;
+
+ _pool = new HiveMindClassPool();
+ _classSource.setPool(_pool);
+ }
+
void checkPoolExpiration()
{
_classCounter++;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionCacheImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionCacheImpl.java?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionCacheImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionCacheImpl.java Fri Jun 15 15:10:08 2007
@@ -15,14 +15,8 @@
package org.apache.tapestry.services.impl;
import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.WeakHashMap;
-
import ognl.Node;
import ognl.Ognl;
-
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.tapestry.event.ReportStatusEvent;
import org.apache.tapestry.event.ReportStatusListener;
@@ -30,12 +24,16 @@
import org.apache.tapestry.services.ExpressionCache;
import org.apache.tapestry.services.ExpressionEvaluator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
/**
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class ExpressionCacheImpl implements ExpressionCache, ResetEventListener, ReportStatusListener
-{
+public class ExpressionCacheImpl implements ExpressionCache, ResetEventListener, ReportStatusListener {
+
private final ReentrantLock _lock = new ReentrantLock();
private String _serviceId;
@@ -78,8 +76,8 @@
Map cached = (Map)_objectCache.get(target.getClass());
- if (cached == null) {
-
+ if (cached == null)
+ {
cached = new HashMap();
_objectCache.put(target.getClass(), cached);
}
@@ -89,7 +87,6 @@
if (result == null || result.getAccessor() == null)
{
result = parse(target, expression);
-
cached.put(expression, result);
}
@@ -130,9 +127,7 @@
}
catch (Exception ex)
{
- throw new ApplicationRuntimeException(ImplMessages.unableToParseExpression(
- expression,
- ex), ex);
+ throw new ApplicationRuntimeException(ImplMessages.unableToParseExpression(expression,ex), ex);
}
}
@@ -144,9 +139,7 @@
}
catch (Exception ex)
{
- throw new ApplicationRuntimeException(ImplMessages.unableToParseExpression(
- expression,
- ex), ex);
+ throw new ApplicationRuntimeException(ImplMessages.unableToParseExpression(expression, ex), ex);
}
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionEvaluatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionEvaluatorImpl.java?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionEvaluatorImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ExpressionEvaluatorImpl.java Fri Jun 15 15:10:08 2007
@@ -32,8 +32,8 @@
/**
* @since 4.0
*/
-public class ExpressionEvaluatorImpl implements ExpressionEvaluator
-{
+public class ExpressionEvaluatorImpl implements ExpressionEvaluator {
+
private static final int POOL_MAX_ACTIVE = 200;
private static final long POOL_MIN_IDLE_TIME = 1000 * 60 * 2;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java?view=diff&rev=547813&r1=547812&r2=547813
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/web/WebRequest.java Fri Jun 15 15:10:08 2007
@@ -14,14 +14,13 @@
package org.apache.tapestry.web;
+import org.apache.tapestry.describe.Describable;
+
+import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.List;
import java.util.Locale;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.tapestry.describe.Describable;
-
/**
* Contains information about the current request, including URLs, schemes, parameters, properties
* and attributes. This is essentially a generic version of
@@ -39,7 +38,7 @@
* multipart/form-data). Accessing query parameters in such an event requires parsing of the
* request input stream.
*
- * @returns List of Strings, in ascending alphabetical order
+ * @return List of Strings, in ascending alphabetical order
*/
List getParameterNames();
@@ -76,6 +75,8 @@
* Returns the portion of the request URI that indicates the context of the request. The context
* path always comes first in a request URI. The path starts with a "/" character but does not
* end with a "/" character.
+ *
+ * @return The servlet context path.
*/
String getContextPath();
@@ -88,13 +89,15 @@
*
* @param create
* if true, the session will be created and returned if it does not already exist
- * @returns The session, or null if it does not exist (and create is false)
+ * @return The session, or null if it does not exist (and create is false)
*/
WebSession getSession(boolean create);
/**
* Returns the name of the scheme used to make this request. For example, http, https, or ftp.
* Different schemes have different rules for constructing URLs, as noted in RFC 1738.
+ *
+ * @return The scheme.
*/
String getScheme();
@@ -102,7 +105,8 @@
* Returns the host name of the server that received the request. Note that behind a firewall,
* this may be obscured (i.e., it may be the name of the firewall server, which is not
* necessarily visible to clients outside the firewall).
- *
+ *
+ * @return The name of the server.
* @see org.apache.tapestry.request.IRequestDecoder
*/
@@ -110,6 +114,8 @@
/**
* Returns the port number on which this request was received.
+ *
+ * @return The port number this request is acting on.
*/
int getServerPort();
@@ -119,6 +125,9 @@
* scheme, server and port are omitted.
* <p>
* Note: portlets do not know their request URI.
+ * </p>
+ *
+ * @return The requested URI.
*/
String getRequestURI();
@@ -126,6 +135,9 @@
/**
* Redirects to the indicated URL. If the URL is local, then a forward occurs. Otherwise, a
* client side redirect is returned to the client browser.
+ *
+ * @param URL
+ * The url to forward the request to.
*/
void forward(String URL);
@@ -134,8 +146,7 @@
* Returns the path of the resource which activated this request (this is the equivalent of the
* servlet path for a servlet request). The activation path will not end with a slash.
*
- * @returns the full servlet path (for servlet requests), or a blank string (for portlet
- * requests).
+ * @return The full servlet path (for servlet requests), or a blank string (for portlet requests).
*/
String getActivationPath();
@@ -151,6 +162,8 @@
/**
* Returns the preferred locale to which content should be localized, as specified by the client
* or by the container. May return null.
+ *
+ * @return The locale associated with the request, may be null.
*/
Locale getLocale();
Re: svn commit: r547813 - in /tapestry/tapestry4/trunk/tapestry-framework/src:
descriptor/META-INF/ java/org/apache/tapestry/enhance/ java/org/apache/tapestry/services/impl/
java/org/apache/tapestry/web/
Posted by andyhot <an...@di.uoa.gr>.
jkuhnert@apache.org wrote:
> Log:
> Slightly friendlier development mode class factory that dumps the javassist class pool on each reset. Results in fix of majority of major memory leaks in dev mode + reduction of many megs of those leaks. Only major culprit left is OgnlRuntime and I don't think that's going to be a problem to fix. ;)
>
^:)^
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org