Previous Next vertical dots separating previous/next from contents/index/pdf

Changing Timer Settings Dynamically

If you want to reconfigure timer settings dynamically, you must use TimerControlBean instead of the basic TimerControl interface.

TimerControlBean provides additional methods to programmatically get/set all of the parameter values displayed on the Annotations view.

Using the TimerControlBean

When you use the Insert > Control command to create a timer control, the default annotation that is inserted uses the TimerControl interface.

private TimerControl timerControl;

To use TimerControlBean instead, simply change TimerControl to TimerControlBean in the timer control declaration line. This will cause an error marker to appear in the marker bar on the class declaration line because TimerControlBean requires an additional import. Right click on the error marker and choose Quick Fix. The Quick Fix pull-down will appear:

click on Import 'TimerControlBean' and press Enter. A new import line

import com.bea.control.TimerControlBean;
will be inserted at the top of your code and the problem marker will disappear.

Calling Methods on the TimerControlBean

TimerControlBean implements the TimerControl interface and also defines the following additional methods to get/set timer properties to get/set the property values:

Method Description
String getTimerSettingJNDIContextFactory() Returns the JNDI Context Factory.
String getTimerSettingJNDIProviderURL() Returns the JNDI Provider URL.
String getTimerSettingRepeatsEvery() Returns the relative time string for the recurring timer setting.
Long getTimerSettingRepeatsEverySeconds() Returns the number of seconds for the recurring timer.
String getTimerSettingTimeout() Returns the relative time string for the timeout.
Long getTimerSettingTimeoutSeconds() Returns the number of seconds for the timeout.
void setTimerSettingJNDIContextFactory(String arg0) Sets the JNDI Context Factory.
void setTimerSettingJNDIProviderURL(String arg0) Sets the JNDI Provider URL.
void setTimerSettingRepeatsEvery(String arg0) Sets the recurring timer by specifying a relative time string.
void setTimerSettingRepeatsEverySeconds(Long arg0) Sets the recurring timer to the specified number of seconds.
void setTimerSettingTimeout(String arg0) Sets the relative timeout to the relative time string.
void setTimerSettingTimeoutSeconds(Long arg0) Sets the relative time to the specified number of seconds.

Note that the setTimerSettingxxx methods have no effect if the timer is already started. To set 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.

The getTimerSettingxxx methods work whether the timer is running or stopped.

Related Topics

Using WebLogic System Controls

Timer Control

TimerControl Interface

Timer Control Reference

Tutorial: Creating a Web Service with Timer Control



Skip navigation bar   Back to Top