tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkemn...@apache.org
Subject [1/2] tapestry-5 git commit: TAP5-2546: use class loading lock for synchronization This does not change the previous behavior since PlasticClassLoader is not (yet) registered as parallel capable
Date Fri, 31 Mar 2017 06:45:46 GMT
Repository: tapestry-5
Updated Branches:
  refs/heads/master c0fffb902 -> 627df8511


TAP5-2546: use class loading lock for synchronization
This does not change the previous behavior since PlasticClassLoader is not (yet) registered
as parallel capable


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/77a2cc37
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/77a2cc37
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/77a2cc37

Branch: refs/heads/master
Commit: 77a2cc3769450d4a90004b1d72ce75c156c6a711
Parents: c0fffb9
Author: Jochen Kemnade <jochen.kemnade@eddyson.de>
Authored: Fri Mar 31 08:40:44 2017 +0200
Committer: Jochen Kemnade <jochen.kemnade@eddyson.de>
Committed: Fri Mar 31 08:40:44 2017 +0200

----------------------------------------------------------------------
 .../internal/plastic/PlasticClassLoader.java    | 34 ++++++++++++--------
 1 file changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/77a2cc37/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassLoader.java
----------------------------------------------------------------------
diff --git a/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassLoader.java
b/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassLoader.java
index e940113..715ddd4 100644
--- a/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassLoader.java
+++ b/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassLoader.java
@@ -26,29 +26,35 @@ public class PlasticClassLoader extends ClassLoader
     }
 
     @Override
-    protected synchronized Class<?> loadClass(String name, boolean resolve) throws
ClassNotFoundException
+    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
     {
-        Class<?> loadedClass = findLoadedClass(name);
+        synchronized(getClassLoadingLock(name))
+        {
+            Class<?> loadedClass = findLoadedClass(name);
 
-        if (loadedClass != null)
-            return loadedClass;
+            if (loadedClass != null)
+                return loadedClass;
 
-        if (delegate.shouldInterceptClassLoading(name))
-        {
-            Class<?> c = delegate.loadAndTransformClass(name);
+            if (delegate.shouldInterceptClassLoading(name))
+            {
+                Class<?> c = delegate.loadAndTransformClass(name);
 
-            if (resolve)
-                resolveClass(c);
+                if (resolve)
+                    resolveClass(c);
 
-            return c;
-        } else
-        {
-            return super.loadClass(name, resolve);
+                return c;
+            } else
+            {
+                return super.loadClass(name, resolve);
+            }
         }
     }
 
     public synchronized Class<?> defineClassWithBytecode(String className, byte[] bytecode)
     {
-        return defineClass(className, bytecode, 0, bytecode.length);
+        synchronized(getClassLoadingLock(className))
+        {
+            return defineClass(className, bytecode, 0, bytecode.length);
+        }
     }
 }


Mime
View raw message