Agreed. We need to improve the ability to pause/disable/start/stop
consumption too

2008/12/18 Claus Ibsen <[email protected]>:
> Hi
>
> I was wondering if we should add test using isRunAllowed() if the
> service is not stopped/stopping before invoking poll()
> I don't see this being tested by the scheduler? The reason is that
> during some file consumer polling and unit tests stopped, it would
> start a poll during shutdown and you will get exceptions later in the
> consumer
>
> I thought I have seen this kind of test elsewhere, but raising it here
> for the other riders.
>
>
>
>
> BEFORE:
>  public void run() {
>        if (LOG.isDebugEnabled()) {
>            LOG.debug("Starting to poll: " + this.getEndpoint());
>        }
>        try {
>            poll();
>        } catch (Exception e) {
>            LOG.warn("An exception occured while polling: " +
> this.getEndpoint() + ": " + e.getMessage(), e);
>            if (firstExceptionThrown == null) {
>                firstExceptionThrown = e;
>            }
>        }
>    }
>
>
> AFTER:
>       if (LOG.isDebugEnabled()) {
>            LOG.debug("Starting to poll: " + this.getEndpoint());
>        }
>        try {
>            if (isRunAllowed()) {
>                poll();
>            }
>        } catch (Exception e) {
>            LOG.warn("An exception occured while polling: " +
> this.getEndpoint() + ": " + e.getMessage(), e);
>            if (firstExceptionThrown == null) {
>                firstExceptionThrown = e;
>            }
>        }
>    }
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>



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

Open Source Integration
http://fusesource.com/

Reply via email to