[picocontainer-scm] [5758] java/2.x/trunk/pico/container/src/java/org/picocontainer/behaviors/HiddenImplementation.java: make implementation hiding more thread safe
paul-yCVjj/[email protected] Sat, 26 Feb 2011 18:07:07 -0600 (CST)
| Newsgroups | gmane.comp.java.picocontainer.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision 5758
Author paul
Date 2011-02-26 18:07:07 -0600 (Sat, 26 Feb 2011)
Log Message
make implementation hiding more thread safe
Modified Paths
- java/2.x/trunk/pico/container/src/java/org/picocontainer/behaviors/HiddenImplementation.java
Diff
Modified: java/2.x/trunk/pico/container/src/java/org/picocontainer/behaviors/HiddenImplementation.java (5757 => 5758)
--- java/2.x/trunk/pico/container/src/java/org/picocontainer/behaviors/HiddenImplementation.java 2011-02-26 20:43:50 UTC (rev 5757)
+++ java/2.x/trunk/pico/container/src/java/org/picocontainer/behaviors/HiddenImplementation.java 2011-02-27 00:07:07 UTC (rev 5758)
@@ -69,9 +69,13 @@
return (T) Proxy.newProxyInstance(classLoader, interfaces, new InvocationHandler() {
private final PicoContainer container = container1;
private Object instance;
- public synchronized Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if (instance == null) {
- instance = getDelegate().getComponentInstance(container, NOTHING.class);
+ synchronized (this) {
+ if (instance == null) {
+ instance = getDelegate().getComponentInstance(container, NOTHING.class);
+ }
+ }
}
return invokeMethod(instance, method, args, container);
}
----------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email