get rid of unnecessary locking given cache use
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/proxy/branches/version-2.0-work@1520911 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java b/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
index e4a8d0c..5e2fb2a 100644
--- a/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
+++ b/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
@@ -41,7 +41,6 @@
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantLock;
public class ASM4ProxyFactory extends AbstractSubclassingProxyFactory
{
@@ -76,7 +75,6 @@
private static final AtomicInteger CLASS_NUMBER = new AtomicInteger(0);
private static final String CLASSNAME_PREFIX = "CommonsProxyASM4_";
private static final String HANDLER_NAME = "__handler";
- private static final ReentrantLock LOCK = new ReentrantLock();
@Override
public Class<?> generateProxyClass(final ClassLoader classLoader, final Class<?>... proxyClasses)
@@ -89,25 +87,6 @@
try
{
- return classLoader.loadClass(proxyName);
- }
- catch (Exception e)
- {
- // no-op
- }
-
- LOCK.lock();
- try
- {
- try
- { // Try it again, another thread may have beaten this one...
- return classLoader.loadClass(proxyName);
- }
- catch (Exception e)
- {
- // no-op
- }
-
final byte[] proxyBytes = generateProxy(superclass, classFileName, implementationMethods, interfaces);
return Unsafe.defineClass(classLoader, superclass, proxyName, proxyBytes);
}
@@ -115,9 +94,6 @@
{
throw new ProxyFactoryException(e);
}
- finally {
- LOCK.unlock();
- }
}
public static <T> T constructProxy(final Class<?> clazz, final java.lang.reflect.InvocationHandler handler) throws IllegalStateException