You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "steven.marcus" <st...@gmail.com> on 2008/02/23 00:07:46 UTC

seda consumer thread robustness (was Re: seda broken in latest snapshot?)

I was concerned about a broken seda queue thread. Turns out the problem was a
deadlock unrelated to Camel, but the changes to SedaConsumer are probably
worthwhile:

	public void run() {

		while (isRunAllowed()) {

			final Exchange exchange;
			try {

				exchange = endpoint.getQueue()
						.poll(1000, TimeUnit.MILLISECONDS);

			} catch (InterruptedException e) {

				if (isRunAllowed())
					LOG.warn("spurious interrupt?!");
				continue;

			}

			if (exchange != null && isRunAllowed()) {

				try {

					processor.process(exchange, new AsyncCallback() {
						public void done(boolean sync) {
						}
					});

				} catch (RuntimeException rte) {

					LOG.error(rte);
				}
			}
		}
	}

Thanks to team Camel,
Steven Marcus
-- 
View this message in context: http://www.nabble.com/seda-broken-in-latest-snapshot-tp15510480s22882p15641995.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: seda consumer thread robustness (was Re: seda broken in latest snapshot?)

Posted by James Strachan <ja...@gmail.com>.
Patch applied Steven, many thanks!

On 22/02/2008, steven.marcus <st...@gmail.com> wrote:
>
>  I was concerned about a broken seda queue thread. Turns out the problem was a
>  deadlock unrelated to Camel, but the changes to SedaConsumer are probably
>  worthwhile:
>
>         public void run() {
>
>                 while (isRunAllowed()) {
>
>                         final Exchange exchange;
>                         try {
>
>                                 exchange = endpoint.getQueue()
>                                                 .poll(1000, TimeUnit.MILLISECONDS);
>
>                         } catch (InterruptedException e) {
>
>                                 if (isRunAllowed())
>                                         LOG.warn("spurious interrupt?!");
>                                 continue;
>
>                         }
>
>                         if (exchange != null && isRunAllowed()) {
>
>                                 try {
>
>                                         processor.process(exchange, new AsyncCallback() {
>                                                 public void done(boolean sync) {
>                                                 }
>                                         });
>
>                                 } catch (RuntimeException rte) {
>
>                                         LOG.error(rte);
>                                 }
>                         }
>                 }
>         }
>
>  Thanks to team Camel,
>  Steven Marcus
>
> --
>  View this message in context: http://www.nabble.com/seda-broken-in-latest-snapshot-tp15510480s22882p15641995.html
>  Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com