Class ETimer
- java.lang.Object
-
- net.sf.eBusx.util.ETimer
-
@Deprecated public final class ETimer extends java.lang.Object implements EReplier
Deprecated.Please move tonet.sf.eBus.client.EScheduledTimerfor scheduled task timing.This class provides an eBus request/reply interface on top of the JavaTimerclass. This eBus interface provides applications a uniform event interface: objects receive events as messages from the eBus API. If the Java timer interface is used directly, then timer events must be manually integrated into the event-processing logic.This interface is not to be preferred if timer tasks are used autonomously rather than as events delivered to an eBus client. In that case, the Java
TimerTaskshould be used directly.ETimerservice must be started by an application by calling one of thestartETimermethods before application objects can successfully subscribe to the timer server.ETimerservice is local to the JVM only. Requestors cannot access a remote eBus timer service.See
net.sf.eBusx.utilpackage documentation for sample code.- Author:
- Charles W. Rapp
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_TIMER_NAMEDeprecated.The default timer name is "ETimer".static EMessageKeyTIMER_KEYDeprecated.The advertised request message key is TimerRequest:/eBusTimer.static java.lang.StringTIMER_SUBJECTDeprecated.The advertised request message subject is "/eBusTimer".-
Fields inherited from interface net.sf.eBus.client.EObject
NAME_NOT_SET
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcancelRequest(EReplyFeed.ERequest request, boolean mayRespond)Deprecated.Cancels the timer task associated with this request and sends a cancel complete reply.static booleanisETimerRunning()Deprecated.Returnstrueif theETimerinstance is running andfalseotherwise.booleanisRunning()Deprecated.Returnstrueif thisETimeris running andfalseif not.java.lang.Stringname()Deprecated.ReturnsETimer name.voidrequest(EReplyFeed.ERequest request)Deprecated.Starts a timer task based on the given request.voidshutdown()Deprecated.Cancels all running timers, stops the timer thread and retracts the timer service advertisement.static voidstartETimer()Deprecated.Starts the eBus timer service using the defaulttimer nameand the timer thread is not run as a daemon.static voidstartETimer(boolean isDaemon)Deprecated.Starts the eBus timer service using the defaulttimer nameand the given daemon flag.static voidstartETimer(java.lang.String name)Deprecated.Starts the eBus timer service for the given timer thread name.static voidstartETimer(java.lang.String name, boolean isDaemon)Deprecated.Starts the eBus timer service for the given timer thread name and daemon flag.voidstartup()Deprecated.Puts the timer service request advertisement in place.static voidstopETimer()Deprecated.Stops the eBus timer service, if running.
-
-
-
Field Detail
-
DEFAULT_TIMER_NAME
public static final java.lang.String DEFAULT_TIMER_NAME
Deprecated.The default timer name is "ETimer".- See Also:
- Constant Field Values
-
TIMER_SUBJECT
public static final java.lang.String TIMER_SUBJECT
Deprecated.The advertised request message subject is "/eBusTimer".- See Also:
- Constant Field Values
-
TIMER_KEY
public static final EMessageKey TIMER_KEY
Deprecated.The advertised request message key is TimerRequest:/eBusTimer.
-
-
Method Detail
-
name
public java.lang.String name()
Deprecated.ReturnsETimer name.
-
startup
public void startup()
Deprecated.Puts the timer service request advertisement in place.- Specified by:
startupin interfaceEObject- See Also:
EObject.shutdown()
-
shutdown
public void shutdown()
Deprecated.Cancels all running timers, stops the timer thread and retracts the timer service advertisement.- Specified by:
shutdownin interfaceEObject- See Also:
EObject.startup()
-
request
public void request(EReplyFeed.ERequest request)
Deprecated.Starts a timer task based on the given request. If the timer request is not valid, then sends a generic reply with a failed status and an explanation for the failure.Do not call this method. This method is part of the
EReplierinterface and is accessed by the eBus API only.- Specified by:
requestin interfaceEReplier- Parameters:
request- the eBus request instance.- See Also:
EReplier.cancelRequest(EReplyFeed.ERequest, boolean)
-
cancelRequest
public void cancelRequest(EReplyFeed.ERequest request, boolean mayRespond)
Deprecated.Cancels the timer task associated with this request and sends a cancel complete reply.Do not call this method. This method is part of the
EReplierinterface and is accessed by the eBus API only.- Specified by:
cancelRequestin interfaceEReplier- Parameters:
request- timer request being canceled.mayRespond- iftruethen send back a response.- See Also:
EReplier.request(EReplyFeed.ERequest)
-
isRunning
public boolean isRunning()
Deprecated.Returnstrueif thisETimeris running andfalseif not.- Returns:
trueif eBus timer is running.
-
isETimerRunning
public static boolean isETimerRunning()
Deprecated.Returnstrueif theETimerinstance is running andfalseotherwise.- Returns:
trueif theETimerinstance is running.
-
startETimer
public static void startETimer()
Deprecated.Starts the eBus timer service using the defaulttimer nameand the timer thread is not run as a daemon.- Throws:
java.lang.IllegalStateException- if the eBus timer service is already running.
-
startETimer
public static void startETimer(boolean isDaemon)
Deprecated.Starts the eBus timer service using the defaulttimer nameand the given daemon flag.- Parameters:
isDaemon-truemeans that the timer thread is run as a daemon.- Throws:
java.lang.IllegalStateException- if the eBus timer service is already running.
-
startETimer
public static void startETimer(java.lang.String name)
Deprecated.Starts the eBus timer service for the given timer thread name. The timer thread is not run as a daemon.- Parameters:
name- the timer thread name.- Throws:
java.lang.IllegalArgumentException- ifnameis eithernullor empty.java.lang.IllegalStateException- if the eBus timer service is already running.
-
startETimer
public static void startETimer(java.lang.String name, boolean isDaemon)Deprecated.Starts the eBus timer service for the given timer thread name and daemon flag.- Parameters:
name- timer thread name.isDaemon- iftrue, then the timer is a daemon thread.- Throws:
java.lang.IllegalArgumentException- ifnameis eithernullor empty.java.lang.IllegalStateException- if the eBus timer service is already running.
-
stopETimer
public static void stopETimer()
Deprecated.Stops the eBus timer service, if running. All running timer requests are canceled and requestors are informed.Does nothing if the timer service is not running.
-
-