How to reclaim/pool returned object instances?
Hi list! I seek advice from those wiser than I... I am writing a service that exposes a method looking a little like the following: List doManyThings(int howMany) { List l = new ArrayList(howMany); for (int i = 0; i < howMany; i ++) l.add(new Stuff(i)); return l; } Since the value for 'howMany' may work out to be very large, I am worried about performance. (I am leaving aside the overheads implicit with XML at the moment...may bite me later, of course) I can create a pool of Stuff instances (using commons pool for example) and retrieve from the pool, rather than creating myriad new Stuff instances all the time...this should be beneficial. The question is: since the list of Stuff instances is returned to the 'container' and never seen by my code again, how/when do I release instances back into the pool? Can I write an interceptor for this? How? My gut feel is that this is/should be a faq but I can't find anything! Is there a more effective approach than what I am taking? Perhaps I should create the XML directly, rather than rely on CXF's marshalling...but I'd rather not be forced to do this in a way that changes the existing method signature (by having to return an org.w3c.dom.Document, say) Cheers, BOB
Classpath or Spring heck, I'm not sure what question I'm even asking here
I'm trying to add a plain old (jaxb?) service to the same app context where I have a working Aegis service. I'm trying to exercise the wiring in a Junit test before I try to lauch an app server. I don't know if the xfire packages here indicate some classpath mishap that I've so far failed to explain, or whether there are still some xfire packages in the snapshot. Obviously, I have a pile of debugging to do here, so feel free to ignore me while I do some of my own flailing. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxws-service-factory' defined in class path resource [META-INF/btsws.xml]: Cannot resolve reference to bean 'aegisBean' while setting bean property 'dataBinding'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aegisBean' defined in class path resource [META-INF/btsws.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.codehaus.xfire.aegis.type.java5.DurationType Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aegisBean' defined in class path resource [META-INF/btsws.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.codehaus.xfire.aegis.type.java5.DurationType Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.codehaus.xfire.aegis.type.java5.DurationType Caused by: java.lang.ClassCastException: org.codehaus.xfire.aegis.type.java5.DurationType at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.registerIfAvailable (DefaultTypeMappingRegistry.java:417) at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.createDefaultMappin gs(DefaultTypeMappingRegistry.java:390) at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.createDefaultMappin gs(DefaultTypeMappingRegistry.java:289) at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.(DefaultTypeM appingRegistry.java:153) at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.(DefaultTypeM appingRegistry.java:143) at org.apache.cxf.aegis.databinding.AegisDatabinding.(AegisDatabindin g.java:91) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA ccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons tructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.in stantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac tory.instantiateBean(AbstractAutowireCapableBeanFactory.java:732) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac tory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:720) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac tory.createBean(AbstractAutowireCapableBeanFactory.java:386) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec t(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g etSingleton(DefaultSingletonBeanRegistry.java:144) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab stractBeanFactory.java:248) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab stractBeanFactory.java:160) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.re solveReference(BeanDefinitionValueResolver.java:261) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.re solveValueIfNecessary(BeanDefinitionValueResolver.java:109) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac tory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1073) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac tory.populateBean(AbstractAutowireCapableBeanFactory.java:835) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac tory.createBean(AbstractAutowireCapableBeanFactory.java:423) at org.springf
Re: JRAStrategry work incorrectly?
willem, i can export the web service successful when i wrote the anotations in implement class. but i am confused that why those factories have different ways to proccess the service class. i think the factory must get all anntations from the interface class. Jiang, Ning (Willem) wrote: > > Hi Kevin, > > I think you just make sure the service class which you passed to the > JaxWsserviceFactoryBean get the right jra annotation. > That can address your concern :) > > Willem. > kevin.shen wrote: >> if i write the jra annotations in interface , and JaxWsserviceFactoryBean >> use >> implementor to get annotations' meta data, it can not recognize the >> method >> correctly. >> if i write the the jra annotation in implementor, and >> JaxWsServerFactorybean >> use interface to get annotations' meta data, it can not recognize the >> method correctly too. >> >> so i need to write jra annotations in both interface and implementor, >> but >> it is so ugly. >> who can tell me the correct way to write the jra annotations? Thanks >> very >> much. >> >> > > -- View this message in context: http://www.nabble.com/JRAStrategry-work-incorrectly--tf4224578.html#a12115813 Sent from the cxf-user mailing list archive at Nabble.com.
RE: Classpath or Spring heck, I'm not sure what question I'm even asking here
Please ignore this. Indeed, I was suffering from a creeping classpath problem. > -Original Message- > From: Benson Margulies [mailto:[EMAIL PROTECTED] > Sent: Sunday, August 12, 2007 12:45 PM > To: cxf-user@incubator.apache.org > Subject: Classpath or Spring heck, I'm not sure what question I'm even > asking here > > I'm trying to add a plain old (jaxb?) service to the same app context > where I have a working Aegis service. > > I'm trying to exercise the wiring in a Junit test before I try to lauch > an app server. > > I don't know if the xfire packages here indicate some classpath mishap > that I've so far failed to explain, or whether there are still some > xfire packages in the snapshot. Obviously, I have a pile of debugging to > do here, so feel free to ignore me while I do some of my own flailing. > > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'jaxws-service-factory' defined in class path resource > [META-INF/btsws.xml]: Cannot resolve reference to bean 'aegisBean' while > setting bean property 'dataBinding'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'aegisBean' defined in class path resource > [META-INF/btsws.xml]: Instantiation of bean failed; nested exception is > org.springframework.beans.BeanInstantiationException: Could not > instantiate bean class > [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw > exception; nested exception is java.lang.ClassCastException: > org.codehaus.xfire.aegis.type.java5.DurationType > Caused by: org.springframework.beans.factory.BeanCreationException: > Error creating bean with name 'aegisBean' defined in class path resource > [META-INF/btsws.xml]: Instantiation of bean failed; nested exception is > org.springframework.beans.BeanInstantiationException: Could not > instantiate bean class > [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw > exception; nested exception is java.lang.ClassCastException: > org.codehaus.xfire.aegis.type.java5.DurationType > Caused by: org.springframework.beans.BeanInstantiationException: Could > not instantiate bean class > [org.apache.cxf.aegis.databinding.AegisDatabinding]: Constructor threw > exception; nested exception is java.lang.ClassCastException: > org.codehaus.xfire.aegis.type.java5.DurationType > Caused by: java.lang.ClassCastException: > org.codehaus.xfire.aegis.type.java5.DurationType > at > org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.registerIfAvailable > (DefaultTypeMappingRegistry.java:417) > at > org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.createDefaultMappin > gs(DefaultTypeMappingRegistry.java:390) > at > org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.createDefaultMappin > gs(DefaultTypeMappingRegistry.java:289) > at > org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.(DefaultTypeM > appingRegistry.java:153) > at > org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.(DefaultTypeM > appingRegistry.java:143) > at > org.apache.cxf.aegis.databinding.AegisDatabinding.(AegisDatabindin > g.java:91) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA > ccessorImpl.java:39) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons > tructorAccessorImpl.java:27) > at > java.lang.reflect.Constructor.newInstance(Constructor.java:494) > at > org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85) > at > org.springframework.beans.factory.support.SimpleInstantiationStrategy.in > stantiate(SimpleInstantiationStrategy.java:61) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac > tory.instantiateBean(AbstractAutowireCapableBeanFactory.java:732) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac > tory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:720) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac > tory.createBean(AbstractAutowireCapableBeanFactory.java:386) > at > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec > t(AbstractBeanFactory.java:251) > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g > etSingleton(DefaultSingletonBeanRegistry.java:144) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab > stractBeanFactory.java:248) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab > stractBeanFactory.java:160) > at > org.springframework.beans.factory.support.BeanDefinitionValueResolver.re > solveReference(BeanDefinitionValueResolver.java:261) > at > org.springframework.beans.factory.support.BeanDefinitionValueResolver.re > solveValueIfNecessary(BeanDefinitionValueResolve
RE: JRAStrategry work incorrectly?
Kevin, internally CXF follows JAX-WS spec to process annotations. JAX-WS section 3.3, "if the WebService annotation on the class under consideration has a endpointInterface element, then the interface referred by this element is for all purposes the SEI associated with the class.". I.e., if you have @WebService(endpointInterface = "xyz") specified correctly in your impl class, the annotation defined in interface will be used, otherwise it is the impl class being used. Cheers, Jervis > -Original Message- > From: kevin.shen [mailto:[EMAIL PROTECTED] > Sent: 2007?8?13? 0:49 > To: cxf-user@incubator.apache.org > Subject: Re: JRAStrategry work incorrectly? > > > > willem, i can export the web service successful when i wrote > the anotations > in implement class. > but i am confused that why those factories have different > ways to proccess > the service class. > i think the factory must get all anntations from the interface class. > > Jiang, Ning (Willem) wrote: > > > > Hi Kevin, > > > > I think you just make sure the service class which you > passed to the > > JaxWsserviceFactoryBean get the right jra annotation. > > That can address your concern :) > > > > Willem. > > kevin.shen wrote: > >> if i write the jra annotations in interface , and > JaxWsserviceFactoryBean > >> use > >> implementor to get annotations' meta data, it can not recognize the > >> method > >> correctly. > >> if i write the the jra annotation in implementor, and > >> JaxWsServerFactorybean > >> use interface to get annotations' meta data, it can not > recognize the > >> method correctly too. > >> > >> so i need to write jra annotations in both interface and > implementor, > >> but > >> it is so ugly. > >> who can tell me the correct way to write the jra > annotations? Thanks > >> very > >> much. > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/JRAStrategry-work-incorrectly--tf4224578 .html#a12115813 Sent from the cxf-user mailing list archive at Nabble.com. IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
RE: JRAStrategry work incorrectly?
BTW, this is similar to a discussion we had before [1]. I.e., which method annotation is supposed to take effect, the annotation in impl class or the annotation in SEI. [1]. http://mail-archives.apache.org/mod_mbox/incubator-cxf-user/200707.mbox/[EMAIL PROTECTED] Jervis > -Original Message- > From: Liu, Jervis [mailto:[EMAIL PROTECTED] > Sent: 2007?8?13? 11:04 > To: cxf-user@incubator.apache.org > Subject: RE: JRAStrategry work incorrectly? > > > Kevin, internally CXF follows JAX-WS spec to process > annotations. JAX-WS section 3.3, "if the WebService > annotation on the class under consideration has a > endpointInterface element, then the interface referred by > this element is for all purposes the SEI associated with the > class.". I.e., if you have @WebService(endpointInterface = > "xyz") specified correctly in your impl class, the annotation > defined in interface will be used, otherwise it is the impl > class being used. > > > Cheers, > Jervis > > > > -Original Message- > > From: kevin.shen [mailto:[EMAIL PROTECTED] > > Sent: 2007?8?13? 0:49 > > To: cxf-user@incubator.apache.org > > Subject: Re: JRAStrategry work incorrectly? > > > > > > > > willem, i can export the web service successful when i wrote > > the anotations > > in implement class. > > but i am confused that why those factories have different > > ways to proccess > > the service class. > > i think the factory must get all anntations from the > interface class. > > > > Jiang, Ning (Willem) wrote: > > > > > > Hi Kevin, > > > > > > I think you just make sure the service class which you > > passed to the > > > JaxWsserviceFactoryBean get the right jra annotation. > > > That can address your concern :) > > > > > > Willem. > > > kevin.shen wrote: > > >> if i write the jra annotations in interface , and > > JaxWsserviceFactoryBean > > >> use > > >> implementor to get annotations' meta data, it can not > recognize the > > >> method > > >> correctly. > > >> if i write the the jra annotation in implementor, and > > >> JaxWsServerFactorybean > > >> use interface to get annotations' meta data, it can not > > recognize the > > >> method correctly too. > > >> > > >> so i need to write jra annotations in both interface and > > implementor, > > >> but > > >> it is so ugly. > > >> who can tell me the correct way to write the jra > > annotations? Thanks > > >> very > > >> much. > > >> > > >> > > > > > > > > > > -- > > View this message in context: > > http://www.nabble.com/JRAStrategry-work-incorrectly--tf4224578 > .html#a12115813 > Sent from the cxf-user mailing list archive at Nabble.com. > > > IONA Technologies PLC (registered in Ireland) > Registered Number: 171387 > Registered Address: The IONA Building, Shelbourne Road, > Dublin 4, Ireland > IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: setting client temporary directory for MTOM attachments in CXF
Hi, I've just provided another patch for this issue, (the original patch broke the test, now I pass it against all tests), I've also added a unit test method for it. can someone help me review it. Thanks Jeff Willem Jiang wrote: Hi Jeff, I just have a quick look of your patch . Here is no unit test in the patch. Can you also add a unit test for it ? Willem. Jeff.Yu wrote: Hi, I've provided a patch, with a very little change. Can someone please help me review and apply it if it is okay. Thanks Jeff Daniel Kulp wrote: On Monday 06 August 2007 01:12, petrica wrote: Hi all, Is there in CXF on the client side something like in XFire for MOTM attachments ( see below ) ? service.setProperty(StreamedAttachments.ATTACHMENT_DIRECTORY, new File( "c:\\temp\\" )); I just checked the code and I don't see anything right now. I've logged a Jira to track it as it's a very good idea: https://issues.apache.org/jira/browse/CXF-888
Re: setting client temporary directory for MTOM attachments in CXF
Hi Jeff, I will take care of this patch Thanks Freeman Jeff.Yu wrote: Hi, I've just provided another patch for this issue, (the original patch broke the test, now I pass it against all tests), I've also added a unit test method for it. can someone help me review it. Thanks Jeff Willem Jiang wrote: Hi Jeff, I just have a quick look of your patch . Here is no unit test in the patch. Can you also add a unit test for it ? Willem. Jeff.Yu wrote: Hi, I've provided a patch, with a very little change. Can someone please help me review and apply it if it is okay. Thanks Jeff Daniel Kulp wrote: On Monday 06 August 2007 01:12, petrica wrote: Hi all, Is there in CXF on the client side something like in XFire for MOTM attachments ( see below ) ? service.setProperty(StreamedAttachments.ATTACHMENT_DIRECTORY, new File( "c:\\temp\\" )); I just checked the code and I don't see anything right now. I've logged a Jira to track it as it's a very good idea: https://issues.apache.org/jira/browse/CXF-888