public class TimerListenerManager extends ServiceSupport implements Runnable, CamelContextAware, StaticService
TimerListener manager which triggers the
TimerListener listeners once every second.
Also ensure when adding and remove listeners, that they are correctly removed to avoid
leaking memory.TimerListener,
ManagedLoadTimershutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
TimerListenerManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTimerListener(TimerListener listener)
Adds the listener.
|
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
CamelContext |
getCamelContext()
Get the
CamelContext |
long |
getInterval()
Gets the interval in millis.
|
void |
removeTimerListener(TimerListener listener)
Removes the listener.
|
void |
run() |
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setInterval(long interval)
Sets the interval in millis.
|
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic TimerListenerManager()
public void setCamelContext(CamelContext camelContext)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecamelContext - the Camel contextpublic CamelContext getCamelContext()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic long getInterval()
public void setInterval(long interval)
interval - interval in millis.public void addTimerListener(TimerListener listener)
Object.equals(Object) and Object.hashCode() for the listener
to ensure that we can remove the same listener again, when invoking remove.listener - listenerpublic void removeTimerListener(TimerListener listener)
Object.equals(Object) and Object.hashCode() for the listener
to ensure that we can remove the same listener again, when invoking remove.listener - listener.protected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()protected void doShutdown() throws Exception
ServiceSupportdoShutdown in class ServiceSupportExceptionApache Camel