activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1517084 - /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Fri, 23 Aug 2013 22:47:09 GMT
Author: tabish
Date: Fri Aug 23 22:47:09 2013
New Revision: 1517084

URL: http://svn.apache.org/r1517084
Log:
https://issues.apache.org/jira/browse/AMQ-4689

Allows for the persistence adapter to implement JobSchedulerStore and also allows for user
set JobSchedulerStore to be used even when persitence is off on the broker.  

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1517084&r1=1517083&r2=1517084&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
Fri Aug 23 22:47:09 2013
@@ -1814,7 +1814,31 @@ public class BrokerService implements Se
     }
 
     public synchronized JobSchedulerStore getJobSchedulerStore() {
-        if (jobSchedulerStore == null && isSchedulerSupport()) {
+
+        // If support is off don't allow any scheduler even is user configured their own.
+        if (!isSchedulerSupport()) {
+            return null;
+        }
+
+        // If the user configured their own we use it even if persistence is disabled since
+        // we don't know anything about their implementation.
+        if (jobSchedulerStore == null) {
+
+            if (!isPersistent()) {
+                return null;
+            }
+
+            try {
+                PersistenceAdapter pa = getPersistenceAdapter();
+                if (pa != null && pa instanceof JobSchedulerStore) {
+                    this.jobSchedulerStore = (JobSchedulerStore) pa;
+                    configureService(jobSchedulerStore);
+                    return this.jobSchedulerStore;
+                }
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+
             try {
                 String clazz = "org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl";
                 jobSchedulerStore = (JobSchedulerStore) getClass().getClassLoader().loadClass(clazz).newInstance();
@@ -1825,7 +1849,6 @@ public class BrokerService implements Se
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
-
         }
         return jobSchedulerStore;
     }



Mime
View raw message