Author: mbenson
Date: Sun Sep 8 20:08:55 2013
New Revision: 1520911
URL: http://svn.apache.org/r1520911
Log:
get rid of unnecessary locking given cache use
Modified:
commons/proper/proxy/branches/version-2.0-work/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
Modified:
commons/proper/proxy/branches/version-2.0-work/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
URL:
http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java?rev=1520911&r1=1520910&r2=1520911&view=diff
==============================================================================
---
commons/proper/proxy/branches/version-2.0-work/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
(original)
+++
commons/proper/proxy/branches/version-2.0-work/asm4/src/main/java/org/apache/commons/proxy2/asm4/ASM4ProxyFactory.java
Sun Sep 8 20:08:55 2013
@@ -41,7 +41,6 @@ import java.security.AccessController;
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 @@ public class ASM4ProxyFactory extends Ab
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 @@ public class ASM4ProxyFactory extends Ab
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 @@ public class ASM4ProxyFactory extends Ab
{
throw new ProxyFactoryException(e);
}
- finally {
- LOCK.unlock();
- }
}
public static <T> T constructProxy(final Class<?> clazz, final
java.lang.reflect.InvocationHandler handler) throws IllegalStateException