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.  

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1517084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-08-23 22:47:09 +00:00
parent b3c132780b
commit 01704eece0
1 changed files with 25 additions and 2 deletions

View File

@ -1814,7 +1814,31 @@ public class BrokerService implements Service {
}
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 Service {
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return jobSchedulerStore;
}