|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.support.ServiceSupport org.apache.camel.support.TimerListenerManager
public class TimerListenerManager
A TimerListener
manager which triggers the
TimerListener
listeners once every second.
setExecutorService(java.util.concurrent.ScheduledExecutorService)
method
must be invoked prior to starting this manager using the ServiceSupport.start()
method.
Also ensure when adding and remove listeners, that they are correctly removed to avoid
leaking memory.
TimerListener
Field Summary |
---|
Fields inherited from class org.apache.camel.support.ServiceSupport |
---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Constructor Summary | |
---|---|
TimerListenerManager()
|
Method Summary | |
---|---|
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. |
long |
getInterval()
Gets the interval in millis. |
void |
removeTimerListener(TimerListener listener)
Removes the listener. |
void |
run()
|
void |
setExecutorService(ScheduledExecutorService executorService)
|
void |
setInterval(long interval)
Sets the interval in millis. |
Methods inherited from class org.apache.camel.support.ServiceSupport |
---|
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimerListenerManager()
Method Detail |
---|
public void setExecutorService(ScheduledExecutorService executorService)
public long getInterval()
public void setInterval(long interval)
interval
- interval in millis.public void run()
run
in interface Runnable
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
ServiceSupport
ServiceSupport.doStop()
for more details.
doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.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 ServiceSupport
Exception
ServiceSupport.doStart()
protected void doShutdown() throws Exception
ServiceSupport
doShutdown
in class ServiceSupport
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |