org.apache.camel.impl
Class ScheduledPollConsumer
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultConsumer
org.apache.camel.impl.ScheduledPollConsumer
- All Implemented Interfaces:
- Runnable, Consumer, Service, ShutdownableService, SuspendableService
- Direct Known Subclasses:
- DefaultScheduledPollConsumer, GenericFileConsumer
public abstract class ScheduledPollConsumer
- extends DefaultConsumer
- implements Runnable, SuspendableService
A useful base class for any consumer which is polling based
- Version:
- $Revision: 924180 $
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, doShutdown, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, shutdown, start, stop |
ScheduledPollConsumer
public ScheduledPollConsumer(DefaultEndpoint endpoint,
Processor processor)
ScheduledPollConsumer
public ScheduledPollConsumer(Endpoint endpoint,
Processor processor,
ScheduledExecutorService executor)
run
public void run()
- Invoked whenever we should be polled
- Specified by:
run
in interface Runnable
isPollAllowed
protected boolean isPollAllowed()
getInitialDelay
public long getInitialDelay()
setInitialDelay
public void setInitialDelay(long initialDelay)
getDelay
public long getDelay()
setDelay
public void setDelay(long delay)
getTimeUnit
public TimeUnit getTimeUnit()
setTimeUnit
public void setTimeUnit(TimeUnit timeUnit)
isUseFixedDelay
public boolean isUseFixedDelay()
setUseFixedDelay
public void setUseFixedDelay(boolean useFixedDelay)
getPollStrategy
public PollingConsumerPollStrategy getPollStrategy()
setPollStrategy
public void setPollStrategy(PollingConsumerPollStrategy pollStrategy)
suspend
public void suspend()
- Description copied from interface:
SuspendableService
- Suspends the service.
- Specified by:
suspend
in interface SuspendableService
resume
public void resume()
- Description copied from interface:
SuspendableService
- Resumes the service.
- Specified by:
resume
in interface SuspendableService
isSuspended
public boolean isSuspended()
- Description copied from interface:
SuspendableService
- Tests whether the service is suspended or not.
- Specified by:
isSuspended
in interface SuspendableService
- Returns:
- true if suspended
poll
protected abstract void poll()
throws Exception
- The polling method which is invoked periodically to poll this consumer
- Throws:
Exception
- can be thrown if an exception occurred during polling
doStart
protected void doStart()
throws Exception
- Overrides:
doStart
in class DefaultConsumer
- Throws:
Exception
doStop
protected void doStop()
throws Exception
- Overrides:
doStop
in class DefaultConsumer
- Throws:
Exception
Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.