The DeliveryChannel provided by the container is thread safe. However, this delivery channel is wrapped by the component when used for a particular endpoint, so there may be a threading problem there. However, this wrapper is used by all components and I doubts there is a threading problem there. But the servicemix-bean component does some very specific stuff when a request arrive to a bean endpoint to map this request to a known bean instance (in case the bean is created by the endpoint for each request), so the problem could be there. Could you paste the full exception stack trace please ?
On Mon, Jul 28, 2008 at 3:00 AM, Ryan Moquin <[EMAIL PROTECTED]> wrote: > Out of curiousity, we have a servicemix-bean component that instantiates 4 > total beans. 2 of which are used by external services (they are considered > a "live" and "test" version of the bean type), but both of those bean > instances provide the same functionality. So my question is that if both of > those bean classes, which live in the save service unit, both execute at the > same time and use an injected DeliveryChannel, should there be a threading > problem? I would assume not, provided that request invoking each bean are > separate threads and the thread pool isn't exhausted. For some reason > though, if I use a quartz timer to send an invocation to each of those two > deployed beans (which of course are on different endpoints), I get the NPE > in the deliverychannel bean pojo send method that I had a ton of problems > with before. This test is under low load and there aren't any resource > issues, such as a thread pool running out like I had before. If I disable > one of the beans, then I never see this error occur, it happens consistently > any time the two beans in the same SU execute at the same time and try to > use the deliverychannel. I thought the servicemix code was synchronized to > prevent this, but I wanted to pick brains to see if what I'm seeing is in > ANY WAY possible, or if it seems more like it would be be an error in my > application code? The NPE definitely happens down in servicemix in a spot > that should be synchronized on the current thread. The bean invocations > should be on different threads and therefore this shouldn't happen, but want > to make sure. > > I can post more details if necessary, but it's pretty straightforward (I > think). If not, I'll go ahead and post more details. Thanks!! I can go > back to synchronizing the code where the DeliveryChannel is used, I'm just > not sure the best way to be sure that I don't end up causing a race > condition of some kind, so I hate to do it unless I know it's safe. > > Ryan > -- Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/
