mirror of https://github.com/apache/activemq.git
Synchronize method and remove old deprecated schedule method.
This commit is contained in:
parent
1c97a65b45
commit
106f759571
|
@ -560,7 +560,7 @@ public class Topic extends BaseDestination implements Task {
|
|||
}
|
||||
|
||||
if (getExpireMessagesPeriod() > 0) {
|
||||
scheduler.schedualPeriodically(expireMessagesTask, getExpireMessagesPeriod());
|
||||
scheduler.executePeriodically(expireMessagesTask, getExpireMessagesPeriod());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.activemq.util.ServiceSupport;
|
|||
*
|
||||
*/
|
||||
public final class Scheduler extends ServiceSupport {
|
||||
|
||||
private final String name;
|
||||
private Timer timer;
|
||||
private final HashMap<Runnable, TimerTask> timerTasks = new HashMap<Runnable, TimerTask>();
|
||||
|
@ -35,20 +36,7 @@ public final class Scheduler extends ServiceSupport {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public void executePeriodically(final Runnable task, long period) {
|
||||
TimerTask timerTask = new SchedulerTimerTask(task);
|
||||
timer.schedule(timerTask, period, period);
|
||||
timerTasks.put(task, timerTask);
|
||||
}
|
||||
|
||||
/*
|
||||
* execute on rough schedule based on termination of last execution. There is no
|
||||
* compensation (two runs in quick succession) for delays
|
||||
*
|
||||
* @deprecated use {@link #executePeriodically}
|
||||
*/
|
||||
@Deprecated
|
||||
public synchronized void schedualPeriodically(final Runnable task, long period) {
|
||||
public synchronized void executePeriodically(final Runnable task, long period) {
|
||||
TimerTask timerTask = new SchedulerTimerTask(task);
|
||||
timer.schedule(timerTask, period, period);
|
||||
timerTasks.put(task, timerTask);
|
||||
|
|
Loading…
Reference in New Issue