You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Ryan Bohn (JIRA)" <ji...@apache.org> on 2007/12/14 03:05:26 UTC

[jira] Commented: (SM-1171) BeanEndpoint can receive messages before it has fully started, causing exceptions

    [ https://issues.apache.org/activemq/browse/SM-1171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40840 ] 

Ryan Bohn commented on SM-1171:
-------------------------------

Sorry, bad grammar.  The first paragraph should say,

I have a Sender endpoint and a Receiver endpoint, both BeanEndpoint objects. The Sender endpoint immediately starts sending messages. Every so often, the receiver endpoint tries to process a message before the start() method has completed, causing the following exception:



> BeanEndpoint can receive messages before it has fully started, causing exceptions 
> ----------------------------------------------------------------------------------
>
>                 Key: SM-1171
>                 URL: https://issues.apache.org/activemq/browse/SM-1171
>             Project: ServiceMix
>          Issue Type: Bug
>    Affects Versions: 3.2, 3.2.1
>            Reporter: Ryan Bohn
>
> I have a Sender endpoint and a Receiver endpoint, both BeanEndpoint objects.  The Sender endpoint immediately starts sending messages.  Every so often, the receiver endpoint accepts tries to process a message the start() method has completed, causing the following exception:
> java.lang.NullPointerException
>         at org.apache.servicemix.bean.BeanEndpoint.getCorrelationExpression(BeanEndpoint.java:421)
>         at org.apache.servicemix.bean.BeanEndpoint.getCorrelation(BeanEndpoint.java:298)
>         at org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:218)
>         at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
>         at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>         at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
>         at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>         at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>         at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>         at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>         at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:613)
> For now, I've put a sleep in the sender endpoint, which fixes the problem.  Obviously, this a hack.
> I originally thought that the original solution would be to move the super.start() call to the end of the start() method.  However, this turned out to cause problems for the sender endpoint.
> I have two options to propose:
> - use synchronization to ensure the bean has started, so that the process() method blocks until the start() method has finished.  This has the disadvantage of incurring a synchronization hit on each message exchange.
> - separate the activation of an endpoint from the registration.  This way an endpoint would be ready to go by being activated, but wouldn't be visible to other endpoints until the start() method has finished.  I'm not sure what code changes would need be necessary to make this happen.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.