You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/06/28 16:22:31 UTC

git commit: https://issues.apache.org/jira/browse/AMQ-5251

Repository: activemq
Updated Branches:
  refs/heads/trunk 1c97a65b4 -> 106f75957


https://issues.apache.org/jira/browse/AMQ-5251

Synchronize method and remove old deprecated schedule method.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/106f7595
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/106f7595
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/106f7595

Branch: refs/heads/trunk
Commit: 106f759571a242ab4cc0b35d1098eb4f52149394
Parents: 1c97a65
Author: Timothy Bish <ta...@gmail.com>
Authored: Sat Jun 28 10:21:34 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Sat Jun 28 10:21:34 2014 -0400

----------------------------------------------------------------------
 .../apache/activemq/broker/region/Topic.java    |  2 +-
 .../org/apache/activemq/thread/Scheduler.java   | 24 +++++---------------
 2 files changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/106f7595/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
index 0186b42..cd144c3 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
@@ -560,7 +560,7 @@ public class Topic extends BaseDestination implements Task {
         }
 
         if (getExpireMessagesPeriod() > 0) {
-            scheduler.schedualPeriodically(expireMessagesTask, getExpireMessagesPeriod());
+            scheduler.executePeriodically(expireMessagesTask, getExpireMessagesPeriod());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/106f7595/activemq-client/src/main/java/org/apache/activemq/thread/Scheduler.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/thread/Scheduler.java b/activemq-client/src/main/java/org/apache/activemq/thread/Scheduler.java
index d6dc372..2fdb11a 100755
--- a/activemq-client/src/main/java/org/apache/activemq/thread/Scheduler.java
+++ b/activemq-client/src/main/java/org/apache/activemq/thread/Scheduler.java
@@ -27,28 +27,16 @@ 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>();
 
-    public Scheduler (String name) {
+    public Scheduler(String name) {
         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);
@@ -78,9 +66,9 @@ public final class Scheduler extends ServiceSupport {
 
     @Override
     protected synchronized void doStop(ServiceStopper stopper) throws Exception {
-       if (this.timer != null) {
-           this.timer.cancel();
-       }
+        if (this.timer != null) {
+            this.timer.cancel();
+        }
     }
 
     public String getName() {