-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
RunnableScheduledFuture provides an isPeriodic() method, but does not provide a way to obtain the period for implementations that return true. This information would be helpful for tasks whose period may change.
For example, a management thread may coordinate the execution of a set of periodic tasks. If a new period value is different than the return value of getPeriod(), the existing task can be canceled and a new one scheduled. Otherwise, the existing task could continue to run as is.
The only way to achieve this behavior currently is to maintain the period in a separate object, which is redundant since it already exists in ScheduledThreadPoolExecutor.ScheduledFutureTask.
Alternatively, providing both getPeriod() and setPeriod() might be preferable, since this would not require cancelation of the original task at all.
RunnableScheduledFuture provides an isPeriodic() method, but does not provide a way to obtain the period for implementations that return true. This information would be helpful for tasks whose period may change.
For example, a management thread may coordinate the execution of a set of periodic tasks. If a new period value is different than the return value of getPeriod(), the existing task can be canceled and a new one scheduled. Otherwise, the existing task could continue to run as is.
The only way to achieve this behavior currently is to maintain the period in a separate object, which is redundant since it already exists in ScheduledThreadPoolExecutor.ScheduledFutureTask.
Alternatively, providing both getPeriod() and setPeriod() might be preferable, since this would not require cancelation of the original task at all.