cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r888570 - in /cxf/trunk/rt/frontend: jaxws/src/main/java/org/apache/cxf/jaxws/spring/ jaxws/src/test/java/org/apache/cxf/jaxws/spring/ simple/src/main/java/org/apache/cxf/frontend/spring/
Date Tue, 08 Dec 2009 21:01:01 GMT
Author: dkulp
Date: Tue Dec  8 21:01:00 2009
New Revision: 888570

URL: http://svn.apache.org/viewvc?rev=888570&view=rev
Log:
[CXF-2558] Fix jaxws:client objects not propertly being considered
singletons

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java?rev=888570&r1=888569&r2=888570&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
Tue Dec  8 21:01:00 2009
@@ -56,6 +56,8 @@
     public static class JAXWSSpringClientProxyFactoryBean extends JaxWsProxyFactoryBean
         implements ApplicationContextAware, FactoryBean {
 
+        private Object obj;
+
         public JAXWSSpringClientProxyFactoryBean() {
             super();
         }
@@ -70,14 +72,17 @@
                 setBus(bus);
             }
         }
-        public Object getObject() throws Exception {
-            return create();
+        public synchronized Object getObject() throws Exception {
+            if (obj == null) {
+                obj = create();
+            }
+            return obj;
         }
         public Class getObjectType() {
             return this.getServiceClass();
         }
         public boolean isSingleton() {
-            return false;
+            return true;
         }
     }
 }

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?rev=888570&r1=888569&r2=888570&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
Tue Dec  8 21:01:00 2009
@@ -310,7 +310,10 @@
         assertNotNull(bean);
 
         Greeter greeter = (Greeter) ctx.getBean("client1");
+        Greeter greeter2 = (Greeter) ctx.getBean("client1");
         assertNotNull(greeter);
+        assertNotNull(greeter2);
+        assertSame(greeter, greeter2);
 
         Client client = ClientProxy.getClient(greeter);
         assertNotNull("expected ConduitSelector", client.getConduitSelector());

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java?rev=888570&r1=888569&r2=888570&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
Tue Dec  8 21:01:00 2009
@@ -93,6 +93,8 @@
     public static class SpringClientProxyFactoryBean extends ClientProxyFactoryBean
         implements ApplicationContextAware, FactoryBean {
 
+        private Object obj;
+        
         public SpringClientProxyFactoryBean() {
             super();
         }
@@ -107,14 +109,17 @@
                 setBus(bus);
             }
         }
-        public Object getObject() throws Exception {
-            return create();
+        public synchronized Object getObject() throws Exception {
+            if (obj == null) {
+                obj = create();
+            }
+            return obj;
         }
         public Class getObjectType() {
             return this.getServiceClass();
         }
         public boolean isSingleton() {
-            return false;
+            return true;
         }
     }
 }



Mime
View raw message