tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1180145 - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ tapestry-core/src/main/java/org/apache/tapestry5/services/ tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/
Date Fri, 07 Oct 2011 18:41:01 GMT
Author: hlship
Date: Fri Oct  7 18:41:01 2011
New Revision: 1180145

URL: http://svn.apache.org/viewvc?rev=1180145&view=rev
Log:
TAP-1650: Reduce number of classloaders (and, hopefully, class loading deadlocks)

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl.java?rev=1180145&r1=1180144&r2=1180145&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl.java
Fri Oct  7 18:41:01 2011
@@ -201,7 +201,7 @@ public final class ComponentInstantiator
 
         classFactory = new ClassFactoryImpl(manager.getClassLoader(), logger);
 
-        proxyFactory = new PlasticProxyFactoryImpl(manager.getClassLoader(), logger);
+        proxyFactory = new PlasticProxyFactoryImpl(manager, logger);
 
         classToInstantiator.clear();
         classToModel.clear();
@@ -230,6 +230,8 @@ public final class ComponentInstantiator
                     {
                         ClassLoader proxyClassLoader = proxyFactory.getClassLoader();
 
+                        // Not 100% sure this is needed, now that the proxyFactory and the
PlasticManager share the same class loader.
+
                         synchronized (proxyClassLoader)
                         {
                             // Force the creation of the class (and the transformation of
the class). This will first

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java?rev=1180145&r1=1180144&r2=1180145&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
Fri Oct  7 18:41:01 2011
@@ -24,6 +24,7 @@ import org.apache.tapestry5.internal.ant
 import org.apache.tapestry5.internal.util.IntegerRange;
 import org.apache.tapestry5.internal.util.MultiKey;
 import org.apache.tapestry5.ioc.AnnotationProvider;
+import org.apache.tapestry5.ioc.annotations.PostInjection;
 import org.apache.tapestry5.ioc.internal.NullAnnotationProvider;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.GenericsUtils;
@@ -32,9 +33,7 @@ import org.apache.tapestry5.ioc.services
 import org.apache.tapestry5.ioc.util.AvailableValues;
 import org.apache.tapestry5.ioc.util.UnknownValueException;
 import org.apache.tapestry5.plastic.*;
-import org.apache.tapestry5.services.ComponentLayer;
-import org.apache.tapestry5.services.InvalidationListener;
-import org.apache.tapestry5.services.PropertyConduitSource;
+import org.apache.tapestry5.services.*;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -1283,6 +1282,13 @@ public class PropertyConduitSourceImpl i
         sharedDelegate = new PropertyConduitDelegate(typeCoercer);
     }
 
+    @PostInjection
+    public void listenForInvalidations(@ComponentClasses InvalidationEventHub hub)
+    {
+        hub.addInvalidationListener(this);
+    }
+
+
     public PropertyConduit create(Class rootClass, String expression)
     {
         assert rootClass != null;

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=1180145&r1=1180144&r2=1180145&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
Fri Oct  7 18:41:01 2011
@@ -365,6 +365,7 @@ public final class TapestryModule
         binder.bind(AjaxResponseRenderer.class, AjaxResponseRendererImpl.class);
         binder.bind(AlertManager.class, AlertManagerImpl.class);
         binder.bind(ValidationDecoratorFactory.class, ValidationDecoratorFactoryImpl.class);
+        binder.bind(PropertyConduitSource.class, PropertyConduitSourceImpl.class);
     }
 
     // ========================================================================
@@ -1512,15 +1513,6 @@ public final class TapestryModule
         return chainBuilder.build(Dispatcher.class, configuration);
     }
 
-    public PropertyConduitSource buildPropertyConduitSource(@Autobuild
-                                                            PropertyConduitSourceImpl service,
@ComponentClasses
-    InvalidationEventHub hub)
-    {
-        hub.addInvalidationListener(service);
-
-        return service;
-    }
-
     /**
      * Builds a shadow of the RequestGlobals.request property. Note again that
      * the shadow can be an ordinary singleton,
@@ -2369,7 +2361,7 @@ public final class TapestryModule
         configuration.add(ComponentsParametersConstants.GRID_ROWS_PER_PAGE, GridConstants.ROWS_PER_PAGE);
         configuration.add(ComponentsParametersConstants.GRID_PAGER_POSITION, GridConstants.PAGER_POSITION);
         configuration.add(ComponentsParametersConstants.GRID_EMPTY_BLOCK, GridConstants.EMPTY_BLOCK);
-        configuration.add(ComponentsParametersConstants.GRID_TABLE_CSS_CLASS,  GridConstants.TABLE_CLASS);
+        configuration.add(ComponentsParametersConstants.GRID_TABLE_CSS_CLASS, GridConstants.TABLE_CLASS);
         configuration.add(ComponentsParametersConstants.GRIDPAGER_PAGE_RANGE, GridConstants.PAGER_PAGE_RANGE);
         configuration.add(ComponentsParametersConstants.GRIDCOLUMNS_SORTABLE_ASSET, GridConstants.COLUMNS_SORTABLE);
         configuration.add(ComponentsParametersConstants.GRIDCOLUMNS_ASCENDING_ASSET, GridConstants.COLUMNS_ASCENDING);

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java?rev=1180145&r1=1180144&r2=1180145&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java
Fri Oct  7 18:41:01 2011
@@ -33,13 +33,16 @@ public class PlasticProxyFactoryImpl imp
 {
     private final PlasticManager manager;
 
-    private final ClassLoader loader;
-
     public PlasticProxyFactoryImpl(ClassLoader parentClassLoader, Logger logger)
     {
-        this.loader = parentClassLoader;
+        this(PlasticManager.withClassLoader(parentClassLoader).create(), logger);
+    }
+
+    public PlasticProxyFactoryImpl(PlasticManager manager, Logger logger)
+    {
+        assert manager != null;
 
-        manager = PlasticManager.withClassLoader(parentClassLoader).create();
+        this.manager = manager;
 
         if (logger != null)
         {
@@ -101,7 +104,7 @@ public class PlasticProxyFactoryImpl imp
 
     private ClassNode readClassNode(Class clazz)
     {
-        byte[] bytecode = PlasticInternalUtils.readBytecodeForClass(loader, clazz.getName(),
false);
+        byte[] bytecode = PlasticInternalUtils.readBytecodeForClass(manager.getClassLoader(),
clazz.getName(), false);
 
         return bytecode == null ? null : PlasticInternalUtils.convertBytecodeToClassNode(bytecode);
     }



Mime
View raw message