![]() |
![]() |
![]() |
![]() |
To insert a timer control, right click on the code editor and choose Insert > Control.
To insert a timer control using the TimerControlBean:
To display the properties of the timer control (or timer control bean) in the Properties view,
The IDE does not validate time strings that are entered in the Properties view. Times are validated only at run-time.
Timer controls can only be used within a web service that is conversational and implements Serializable. See Designing Conversational Web Services for more information.
See the TimerControl.TimerSettings annotation for a description of the annotations to set timer control parameters
The following properties and methods are provided on the TimerControl interface.
![]() |
![]() |
![]() |
||||||||||||||||||||
![]() |
|
![]() |
||||||||||||||||||||
![]() |
![]() |
![]() |
There are three methods for TimerControl.
![]() |
![]() |
![]() |
||||||||
![]() |
|
![]() |
||||||||
![]() |
![]() |
![]() |
There is one event generated by the timer control
![]() |
![]() |
![]() |
||||||
![]() |
|
![]() |
||||||
![]() |
![]() |
![]() |
TimerControlBean implements the TimerControl interface and provides the following additional methods and properties.
![]() |
![]() |
![]() |
|||||||||||||||
![]() |
|
![]() |
|||||||||||||||
![]() |
![]() |
![]() |
The following additional methods are provided to get/set the property values displayed in the Properties view:
![]() |
![]() |
![]() |
||||||||||||||||||||||||||
![]() |
|
![]() |
||||||||||||||||||||||||||
![]() |
![]() |
![]() |
Note that the setTimerSettingxxx methods have no effect if the timer is already started. To set time values, you must stop the timer, call the method to set the value, and start the timer. This will not create a new timer object, but will simply restart the existing control.
If both repeatEverySecond and repeatEvery are set, the timer does not generate an error, it uses the repeatEverySecond value.
If both timeout and timeoutSeconds are set, the timer does not generate an error, it uses the timeoutSeconds value.
Setting an absolute date in the past or a negative time value in either the setTimeout or setTimeoutSeconds methods causes an immediate callback.
The getTimerSettingxxx methods work whether the timer is running or stopped.
The following methods are for internal use only and should NOT be used:
![]() |
![]() |
![]() |
|||||||
![]() |
|
![]() |
|||||||
![]() |
![]() |
![]() |
There are no additional events generated by TimerControlBean.
Relative time values are used for relative timeouts and for recurring times. Relative time values are set either through the Properties view or by calling a method on TimerControlBean.
Relative time is expressed as a text string, it is formatted as integers followed by case-insensitive time units. These time units can be separated by spaces. For example, the following code sample is a valid duration specification that exercises all the time units, spelled out fully:
@TimerControl.TimerSettings(timeout="99 years 11 months 13 days 23 hours 43 minutes 51 seconds") @Control() Timer almostCentury;
This example creates a timer control whose default initial firing will occur in almost 100 years.
Units may also be truncated. For example, valid truncations of "months" are "month", "mont", "mon", "mo", and "m". If both months and minutes are specified, use long enough abbreviations to be unambiguous.
Text strings may also be in ISO 8601 extended format with the string "p" (case insensitive) at the beginning of a text string. If it is present, then single-letter abbreviations and no spaces must be used and parts must appear in the order y m d h m s. (http://www.w3.org/TR/xmlschema-2/#duration)
The following timer control declaration is equivalent to the previous example, but uses the fully truncated form:
@TimerControl.TimerSettings(timeout="P99Y11Mo13D23H43M51S") @Control() Timer almostCentury;
Durations are computed according to Gregorian calendar rules, so if today is the 17th of the month, 3 months from now is also the 17th of the month. If the target month is shorter and doesn't have a corresponding day (for example, no February 31), then the closest day in the same month is used (for example, February 29 on a leap year).
To specify that the timer fires at a specific (absolute time), you must use the setTimeoutAt method.
Absolute time is useful when you know the exact moment you want operations to begin and end. For example, your application can have your web service send a reminder email to remind you that someone's birthday is coming up. Specific times are set as for with a java.util.Date object (Java 1.5). Since the TimerSetting annotation does not allow you to specify a timeout in java.util.Date format, you must use the setTimeoutAt method. For more information, see Using Methods of the TimerControlBean Interface to Set Parameters.
An additional group of methods are provided on the TimerControl interface to provide backward compatibility with WebLogic Workshop 8.1 applications. These methods are no longer recommended. The backward compatibility methods are:
![]() |
![]() |
![]() |
||||||||||||||||||
![]() |
|
![]() |
||||||||||||||||||
![]() |
![]() |
![]() |
In WebLogic Workshop 8.1, a call to the start() method on a timer that was already started could potentially generate new timer events. In Workshop 9.2, 10.0 and 10.1, calling start() on a timer control that has already been started has no effect.
The file weblogic_timer_control.jar contains the implementation of the timer control. This file defines the control interface and implementation and a stateless session bean. This JAR is deployed automatically when a web services project is created.
The timer control implementation is provided by com.bea.wlw.control.timer.EjbTimerControlImpl which uses the EJB 2.1 Timer Service. A control bean delegates the creation and canceling of timers through the stateless session bean, using an EJB Local interface. When a timer is expired, the ejbTimeout method on the session bean will be invoked by the EJB container. The ejbTimeout method in turn retrieves the ControlHandle that was stored with the timer when the timer was created, and uses the ControlHandle to dispatch the callback event to the target TimerControl. This implementation is agnostic of what container the TimerControl is running in.
Since timer controls are based on the EJB 2.1 timer service, they are a best-effort to do a callback to the client as requested, not a true real-time time service.
![]() ![]() |