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.EScheduledTimer
for scheduled task timing.This class provides an eBus request/reply interface on top of the JavaTimer
class. 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
TimerTask
should be used directly.ETimer
service must be started by an application by calling one of thestartETimer
methods before application objects can successfully subscribe to the timer server.ETimer
service is local to the JVM only. Requestors cannot access a remote eBus timer service.See
net.sf.eBusx.util
package documentation for sample code.- Author:
- Charles W. Rapp
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_TIMER_NAME
Deprecated.The default timer name is "ETimer".static EMessageKey
TIMER_KEY
Deprecated.The advertised request message key is TimerRequest:/eBusTimer.static java.lang.String
TIMER_SUBJECT
Deprecated.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 void
cancelRequest(EReplyFeed.ERequest request, boolean mayRespond)
Deprecated.Cancels the timer task associated with this request and sends a cancel complete reply.static boolean
isETimerRunning()
Deprecated.Returnstrue
if theETimer
instance is running andfalse
otherwise.boolean
isRunning()
Deprecated.Returnstrue
if thisETimer
is running andfalse
if not.java.lang.String
name()
Deprecated.ReturnsETimer name
.void
request(EReplyFeed.ERequest request)
Deprecated.Starts a timer task based on the given request.void
shutdown()
Deprecated.Cancels all running timers, stops the timer thread and retracts the timer service advertisement.static void
startETimer()
Deprecated.Starts the eBus timer service using the defaulttimer name
and the timer thread is not run as a daemon.static void
startETimer(boolean isDaemon)
Deprecated.Starts the eBus timer service using the defaulttimer name
and the given daemon flag.static void
startETimer(java.lang.String name)
Deprecated.Starts the eBus timer service for the given timer thread name.static void
startETimer(java.lang.String name, boolean isDaemon)
Deprecated.Starts the eBus timer service for the given timer thread name and daemon flag.void
startup()
Deprecated.Puts the timer service request advertisement in place.static void
stopETimer()
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:
startup
in 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:
shutdown
in 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
EReplier
interface and is accessed by the eBus API only.- Specified by:
request
in 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
EReplier
interface and is accessed by the eBus API only.- Specified by:
cancelRequest
in interfaceEReplier
- Parameters:
request
- timer request being canceled.mayRespond
- iftrue
then send back a response.- See Also:
EReplier.request(EReplyFeed.ERequest)
-
isRunning
public boolean isRunning()
Deprecated.Returnstrue
if thisETimer
is running andfalse
if not.- Returns:
true
if eBus timer is running.
-
isETimerRunning
public static boolean isETimerRunning()
Deprecated.Returnstrue
if theETimer
instance is running andfalse
otherwise.- Returns:
true
if theETimer
instance is running.
-
startETimer
public static void startETimer()
Deprecated.Starts the eBus timer service using the defaulttimer name
and 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 name
and the given daemon flag.- Parameters:
isDaemon
-true
means 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
- ifname
is eithernull
or 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
- ifname
is eithernull
or 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.
-
-