camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: ClassCastException using cxf:bean
Date Thu, 10 May 2012 13:48:51 GMT
The bean method should be thread safe, as the method will be called 
from different thread.
BTW the bean DSL support to pass the object, can you use the Object 
instead of the Class?

On Thu May 10 17:12:22 2012, cgiera wrote:
> I think I have found the problem:
> The RegistryBean.getBean() method is not thread safe:
>
>
> When I was debugging this method i notized that the bean member variable
> changes every now and then. I think this happens because another thread
> changes the member.
>
> In the last if block of the me method I think the following could happen:
>
> The bean member could also be a class, in this case the method tries to get
> an instance of this class.
> There is one problem in the line value=bean:
> What if another thread changes the bean to a class in just this moment?
> A class will be returned instead of an object, and so I get my
> ClassCastException later when camel tries to execute methods on the class
> instead of the object.
>
> Could someone check if the assumptions i made are correct?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ClassCastException-using-cxf-bean-tp5599810p5699619.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Mime
View raw message