com.ibm.websphere.scheduler
Interface TaskInfo
- public interface TaskInfo
- extends TaskStatus
Contains the data to be used when scheduling a task using the Scheduler.create(TaskInfo)
method.
Field Summary
Modifier and Type | Field and Description |
---|---|
|
EXECUTION_DELAYEDUPDATE
Delayed-update execution option.
|
|
QOS_ATLEASTONCE
At-least-once quality of service.
|
|
QOS_ONLYONCE
Only-once quality of service.
|
Fields inherited from interface com.ibm.websphere.scheduler.TaskStatus |
---|
CANCELLED, COMPLETE, INVALID, RUNNING, SCHEDULED, serialVersionUID, SUSPENDED |
Method Summary
Modifier and Type | Method and Description |
---|---|
|
getAuthenticationAlias()
Retrieves the Authentication Alias set for this
task.
|
|
getAutoPurge()
Get the AutoPurge value for this task.
|
|
getExpectedDuration()
Retrieves the expected duration of this task.
|
|
getName()
Get the name of the task.
|
getNotificationSink()
Gets the NotificationSinkHome associated with this TaskInfo.
|
|
|
getNotificationSinkJNDIName()
Gets the JNDI name of the NotificationSink associated with this TaskInfo.
|
|
getNumberOfRepeats()
Get the number of repeats that were set with
setNumberOfRepeats .
|
|
getQOS()
Retreives the quality of service for this task set with the setQOS method.
|
|
getRepeatInterval()
Get the
UserCalendar repeat interval.
|
|
getStartByInterval()
Get the start-by interval that was set with
setStartByInterval
|
|
getStartTime()
Get the start date and time for this task that was set with
setStartTime .
|
|
getStartTimeInterval()
Get the
UserCalendar start time interval that was set with setStartTime
|
|
getTaskExecutionOptions()
Get the task's execution options.
|
|
getUserCalendarJNDIName()
Get the
UserCalendar JNDI name
|
|
getUserCalendarSpecifier()
Get the
UserCalendar specifier.
|
|
setAuthenticationAlias(java.lang.String alias)
Set the Authentication Alias used for this task.
|
|
setAutoPurge(boolean purge)
Specifies that upon completion, the task will be deleted
from the persistent store.
|
|
setExpectedDuration(int seconds)
Sets the expected duration of the task.
|
|
setInitialState(int initialState)
Set the state that this task should default to when initially created.
|
|
setName(java.lang.String name)
Set the name of the task.
|
|
setNotificationSink(NotificationSinkHome home)
Specifies a callback which will be invoked for all events.
|
|
setNotificationSink(NotificationSinkHome home,int eventMask)
Specifies a callback which will be invoked based upon the requested filter.
|
|
setNotificationSink(java.lang.String jndiName)
Specifies a callback which will be invoked for all events.
|
|
setNotificationSink(java.lang.String jndiName,int eventMask)
Specifies a callback which will be invoked based upon the requested filter.
|
|
setNumberOfRepeats(int repeatCount)
Sets the number of times this task will be repeated.
|
|
setQOS(int QOS)
Sets the quality of service for this task.
|
|
setRepeatInterval(java.lang.String userCalendarDelta)
Specifies a
UserCalendar interval which represents the time between firings.
|
|
setStartByInterval(java.lang.String userCalendarDelta)
Specifies that if the task has not executed within the specified
UserCalendar interval, the
associated work should not be fired.
|
|
setStartTime(java.util.Date start)
Sets the start date and time for this task.
|
|
setStartTimeInterval(java.lang.String userCalendarDelta)
Sets the start time for the task given a
UserCalendar interval.
|
|
setTaskExecutionOptions(int executionOptions)
Set the task's execution options.
|
|
setUserCalendar(java.lang.String homeJNDIName,java.lang.String specifier)
Set the
UserCalendar for this task.
|
|
validate()
Validates various attributes of a TaskInfo.
|
Methods inherited from interface com.ibm.websphere.scheduler.TaskStatus |
---|
getNextFireTime, getRepeatsLeft, getStatus, getTaskId, getTimeCreated |
Field Detail
QOS_ONLYONCE
- static final int QOS_ONLYONCE
QOS_ATLEASTONCE
- static final int QOS_ATLEASTONCE
setQOS(int)
method, the task
may run more than one time if a failure occurs
after the task has executed and prior to the
persistent store update.
EXECUTION_DELAYEDUPDATE
- static final int EXECUTION_DELAYEDUPDATE
TaskStatus.RUNNING
state when the task is running.
If this option is set using the setTaskExecutionOptions(int)
method,
the persistent store is updated twice when the task fires.
The first update occurs immediately when the task fires
and sets the status of the task to TaskStatus.RUNNING
.
The second update stores the result of the task.
This execution option is always used when the quality of service is
set to QOS_ATLEASTONCE
.
If this option is not set and the quality of service is QOS_ONLYONCE
, the
persistent store will be updated one time when the task
runs. This means that when a task is running, the
Scheduler.getTask(String)
, Scheduler.getStatus(String)
and
find methods will show the next effective state of the task and will not show a state
of TaskStatus.RUNNING
.
Method Detail
setStartByInterval
- void setStartByInterval(java.lang.String userCalendarDelta)
UserCalendar
interval, the
associated work should not be fired. The next fire time will still be calculated
and if applicable, the repeat count decremented.
userCalendarDelta
- the UserCalendar
interval used to apply to each calculated fire time. getStartByInterval
- java.lang.String getStartByInterval( )
setStartByInterval
setStartTime
- void setStartTime(java.util.Date start)
start
- the Date
to use for the start date and time. getStartTime
- java.util.Date getStartTime()
setStartTime
.
setStartTimeInterval
- void setStartTimeInterval(java.lang.String userCalendarDelta)
UserCalendar
interval. The actual time
will be calculated during task creation using the UserCalendar
associated with
this task info, or if unspecified, the default calendar.
userCalendarDelta
- the UserCalendar
interval used to apply to the current time. getStartTimeInterval
- java.lang.String getStartTimeInterval( )
UserCalendar
start time interval that was set with setStartTime
UserCalendar
start time interval. setNumberOfRepeats
- void setNumberOfRepeats(int repeatCount)
- if n > 0, the task will be run n times
- if n = 0, the task will not run.
- if n < 0, the task will be run until canceled
The default number of repeats is 1.
repeatCount
- the total number of times to execute the task. getNumberOfRepeats
- int getNumberOfRepeats()
setNumberOfRepeats
.
setNumberOfRepeats
. setRepeatInterval
- void setRepeatInterval(java.lang.String userCalendarDelta)
UserCalendar
interval which represents the time between firings. The
UserCalendar
used for calculations can be specified with the setUserCalendar
and
setUserCalendarSpecifier
methods. If no calendar is specified, the DefaultUserCalendar
calendar will be used. If this repeat interval is less than the scheduler's poll interval,
then the repeat interval will be ignored and the poll interval will be used.
userCalendarDelta
- the UserCalendar
interval used to apply to each calculated fire time. getRepeatInterval
- java.lang.String getRepeatInterval( )
UserCalendar
repeat interval.
UserCalendar
repeat interval. setUserCalendar
- void setUserCalendar(java.lang.String homeJNDIName,
- java.lang.String specifier)
- throws UserCalendarInvalid
UserCalendar
for this task. If not set, then the default UserCalendar
bean is used without a specifier.
homeJNDIName
- the JNDI name used to retrieve the Home interface of a UserCalendar implementation object. If null or
an empty string, the DefaultUserCalendar is used. specifier
- optional name of an individual calendar within the UserCalendar bean. UserCalendarInvalid
- The specified JNDI name for the UserCalendarHome could not be looked-up or is of the wrong type. getUserCalendarJNDIName
- java.lang.String getUserCalendarJNDIName( )
UserCalendar
JNDI name
UserCalendar
JNDI name. getUserCalendarSpecifier
- java.lang.String getUserCalendarSpecifier( )
UserCalendar
specifier.
UserCalendar
specifier. setNotificationSink
- void setNotificationSink(NotificationSinkHome home)
- throws NotificationSinkInvalid
home
- A stateless session bean which uses NotificationSink remote
interface. NotificationSinkInvalid
- The HomeHandle for the session bean cannot be retrieved or the home is null; setNotificationSink
- void setNotificationSink(NotificationSinkHome home,
- int eventMask)
- throws NotificationSinkInvalid
TaskNotificationInfo
constants.
home
- A stateless session bean which uses NotificationSink remote
interface. eventMask
- the events to monitor for. To monitor multiple events, you can OR the event types
together. The default is to be notified on all events. NotificationSinkInvalid
- The HomeHandle for the session bean cannot be retrieved or the home is null; getNotificationSink
- NotificationSinkHome getNotificationSink( )
- throws NotificationSinkInvalid
NotificationSinkInvalid
- The HomeHandle for the session bean cannot be retrieved or the home is null; validate
- void validate()
- throws UserCalendarSpecifierInvalid
- UserCalendarPeriodInvalid
- UserCalendarInvalid
- TaskInvalid
- NotificationSinkInvalid
UserCalendarSpecifierInvalid
- The specified UserCalendar calendar name for the specified UserCalendar is not valid. UserCalendarPeriodInvalid
- The specified UserCalendar period for the specified UserCalendar is not valid. UserCalendarInvalid
- The specified JNDI name for the UserCalendarHome could not be looked-up or is of the wrong type. TaskInvalid
- The TaskInfo is missing or has incorrect data. NotificationSinkInvalid
- The HomeHandle for the session bean cannot be retrieved or the home is null; setName
- void setName(java.lang.String name)
name
- the label of this task getName
- java.lang.String getName()
getName
in interface TaskStatus
setName
. setAutoPurge
- void setAutoPurge(boolean purge)
Default is true.
purge
- if true, automatically remove completed tasks. getAutoPurge
- boolean getAutoPurge()
setInitialState
- void setInitialState(int initialState)
By default each scheduled instance is immediately scheduled (TaskStatus.SCHEDULED
).
The only valid parameters for this method are TaskStatus.SUSPENDED
and
TaskStatus.SCHEDULED
This value does not persist with the task, therefore there is no "get" method for this setting.
initialState
- the state to set the newly-created task to. setNotificationSink
- void setNotificationSink(java.lang.String jndiName)
jndiName
- Fully qualified JNDI name of a stateless session bean which uses NotificationSink remote
interface. setNotificationSink
- void setNotificationSink(java.lang.String jndiName,
- int eventMask)
TaskNotificationInfo
constants.
jndiName
- Fully qualified JNDI name of a stateless session bean which uses NotificationSink remote
interface. eventMask
- the events to monitor for. To monitor multiple events, you can OR the event types
together. The default is to be notified on all events. getNotificationSinkJNDIName
- java.lang.String getNotificationSinkJNDIName( )
NotificationSinkInvalid
- The HomeHandle for the session bean cannot be retrieved or the home is null; setAuthenticationAlias
- void setAuthenticationAlias(java.lang.String alias)
alias
- name of the authentication alias. getAuthenticationAlias
- java.lang.String getAuthenticationAlias( )
setQOS
- void setQOS(int QOS)
QOS_ATLEASTONCE
and QOS_ONLYONCE
.
QOS
- a quality of service constant defined in this interface. getQOS
- int getQOS()
setTaskExecutionOptions
- void setTaskExecutionOptions(int executionOptions)
Therefore, to set multiple options, they must be OR'd together:
setTaskExecutionOptions(OPTION1 | OPTION2)
executionOptions
- one of the EXECUTION contants.
These values can be added together to provide multiple
options. getTaskExecutionOptions
- int getTaskExecutionOptions()
EXECUTION_DELAYEDUPDATE
option is set:
boolean isDelayUpdateSet = getTaskExecutionOptions() & EXECUTION_DELAYEDUPDATE != 0;
setExpectedDuration
- void setExpectedDuration(int seconds)
If set to 0 (the default), the task is considered a short running task. Short-running tasks will be managed by the application server and will use appropriate transaction timeouts and thread management.
Larger values may override applicable system timeout values and may run the task on a non-pooled thread instead of a pooled thread.
If set to Integer.MAX_VALUE, the task is expected to run for an undetermined amount of time. The runtime will attempt to disable applicable system timeout values.
Note: Running tasks for a long period of time in a single transaction
may cause time-out and locking issues. For long running tasks such as batch jobs,
it is best to also use a lower quality of service QOS_ATLEASTONCE
with
checkpoints or compensating techniques.
seconds
- the number of seconds that the task is expected to
run. If 0, the task is a short running task. If Integer.MAX_VALUE, the task
will run an undetermined amount of time. getExpectedDuration
- int getExpectedDuration()
setQOS(int)
method, the task is guaranteed to only execute one time in a single transactional context.