You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Terry Cox <te...@meta-concepts.com> on 2007/10/21 23:04:00 UTC

Unexpected behaviour from PollingEndpoint

As has been reported previously by others, if you implement a component
based upon PollingEndpoint then the poll method will be called more than
once when the component starts.

I have been investigating an example here and I can see that two
different pool-components are running simultaneously in different threads.
There also appear to be two Daemons, Timer-0 and Timer-1.

I wondered if this were due to ServiceMix simply instantiating more than
one instance of the component in a pool so I attempted to configure the
executorFactory as shown in
http://incubator.apache.org/servicemix/thread-pools.html to set the
default pool size to 1.

If I add the <sm:executorFactory> element to my config however, I get a
java.lang.NoClassDefFoundError: org/apache/woden/WSDLReader early in the
jbi config and the container fails to load. Any ideas?

Terry

Re: Unexpected behaviour from PollingEndpoint

Posted by Terry Cox <te...@meta-concepts.com>.
D'oh!

The superclass of the test case is also calling createBeanFactory(), so I
was instantiating stuff twice.

Terry

Re: Unexpected behaviour from PollingEndpoint

Posted by Guillaume Nodet <gn...@gmail.com>.
I recall such problems but they were fixed a long time ago.   Can you
check if the start method is actually called twice and post the stack
traces from the calls ?

On Mon, 22 Oct 2007 00:56 +0100 (BST), Terry Cox
<te...@meta-concepts.com> wrote:
> > Wanna try with the following code in PollingEndpoint ?
>
> Hmmm, seems like I still get two of them, both polling in sequence, with
> one thread slightly after the other.
>
> There is an odd difference between the two, however:
>
> In the config for the component, I have a property in the marshaller that
> references a singleton bean.
>
> In the setup() method of my test code, I load the servicemix config using
> ..xbean.spring.context.ClassPathXmlApplicationContent and then get a
> reference to the above bean using getBean() and tweak its properties.
>
> The Timer-0 thread has no view of these altered properties but the
> Timer-1 thread does.
>
> Terry
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Unexpected behaviour from PollingEndpoint

Posted by Terry Cox <te...@meta-concepts.com>.
> Wanna try with the following code in PollingEndpoint ?

Hmmm, seems like I still get two of them, both polling in sequence, with
one thread slightly after the other. 

There is an odd difference between the two, however:

In the config for the component, I have a property in the marshaller that
references a singleton bean.

In the setup() method of my test code, I load the servicemix config using
..xbean.spring.context.ClassPathXmlApplicationContent and then get a
reference to the above bean using getBean() and tweak its properties.

The Timer-0 thread has no view of these altered properties but the
Timer-1 thread does.

Terry

Re: Unexpected behaviour from PollingEndpoint

Posted by Guillaume Nodet <gn...@gmail.com>.
Hi Terry!

Woden is considered an optional package.  There may be an exception
logged at debug level, but it should not prevent the container from
booting.  Woden is used in case some endpoints expose a  WSDL 2.0
description.

The problem may just come from the fact that the PollingEndpoint puts
a runnable in the thread pool when the timer is firedintead of just
calling the poll method (I don't really see the reason why).  Wanna
try with the following code in PollingEndpoint ?

    private class PollSchedulerTask extends SchedulerTask {
        public void run() {
                        try {
                            poll();
                        }
                        catch (Exception e) {
                            handlePollException(e);
                        }
        }
    }


On Sun, 21 Oct 2007 22:04 +0100 (BST), Terry Cox
<te...@meta-concepts.com> wrote:
> As has been reported previously by others, if you implement a component
> based upon PollingEndpoint then the poll method will be called more than
> once when the component starts.
>
> I have been investigating an example here and I can see that two
> different pool-components are running simultaneously in different threads.
> There also appear to be two Daemons, Timer-0 and Timer-1.
>
> I wondered if this were due to ServiceMix simply instantiating more than
> one instance of the component in a pool so I attempted to configure the
> executorFactory as shown in
> http://incubator.apache.org/servicemix/thread-pools.html to set the
> default pool size to 1.
>
> If I add the <sm:executorFactory> element to my config however, I get a
> java.lang.NoClassDefFoundError: org/apache/woden/WSDLReader early in the
> jbi config and the container fails to load. Any ideas?
>
> Terry
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/