first bunch of backports from 3.1 M2 to 3.0.6
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cache.ehcache;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import net.sf.ehcache.CacheException;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
@@ -97,23 +98,17 @@ public class EhCacheManagerFactoryBean implements FactoryBean<CacheManager>, Ini
|
||||
|
||||
public void afterPropertiesSet() throws IOException, CacheException {
|
||||
logger.info("Initializing EHCache CacheManager");
|
||||
if (this.shared) {
|
||||
// Shared CacheManager singleton at the VM level.
|
||||
if (this.configLocation != null) {
|
||||
this.cacheManager = CacheManager.create(this.configLocation.getInputStream());
|
||||
if (this.configLocation != null) {
|
||||
InputStream is = this.configLocation.getInputStream();
|
||||
try {
|
||||
this.cacheManager = (this.shared ? CacheManager.create(is) : new CacheManager(is));
|
||||
}
|
||||
else {
|
||||
this.cacheManager = CacheManager.create();
|
||||
finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Independent CacheManager instance (the default).
|
||||
if (this.configLocation != null) {
|
||||
this.cacheManager = new CacheManager(this.configLocation.getInputStream());
|
||||
}
|
||||
else {
|
||||
this.cacheManager = new CacheManager();
|
||||
}
|
||||
this.cacheManager = (this.shared ? CacheManager.create() : new CacheManager());
|
||||
}
|
||||
if (this.cacheManagerName != null) {
|
||||
this.cacheManager.setName(this.cacheManagerName);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,6 +40,13 @@ public class LocalTaskExecutorThreadPool implements ThreadPool {
|
||||
private Executor taskExecutor;
|
||||
|
||||
|
||||
public void setInstanceId(String schedInstId) {
|
||||
}
|
||||
|
||||
public void setInstanceName(String schedName) {
|
||||
}
|
||||
|
||||
|
||||
public void initialize() throws SchedulerConfigException {
|
||||
// Absolutely needs thread-bound TaskExecutor to initialize.
|
||||
this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.scheduling.quartz;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
@@ -34,7 +35,6 @@ import org.quartz.SchedulerListener;
|
||||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerListener;
|
||||
import org.quartz.spi.ClassLoadHelper;
|
||||
import org.quartz.xml.JobSchedulingDataProcessor;
|
||||
|
||||
import org.springframework.context.ResourceLoaderAware;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
@@ -240,9 +240,25 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware {
|
||||
if (this.jobSchedulingDataLocations != null) {
|
||||
ClassLoadHelper clh = new ResourceLoaderClassLoadHelper(this.resourceLoader);
|
||||
clh.initialize();
|
||||
JobSchedulingDataProcessor dataProcessor = new JobSchedulingDataProcessor(clh, true, true);
|
||||
for (String location : this.jobSchedulingDataLocations) {
|
||||
dataProcessor.processFileAndScheduleJobs(location, getScheduler(), this.overwriteExistingJobs);
|
||||
try {
|
||||
// Quartz 1.8 or higher?
|
||||
Class dataProcessorClass = getClass().getClassLoader().loadClass("org.quartz.xml.XMLSchedulingDataProcessor");
|
||||
logger.debug("Using Quartz 1.8 XMLSchedulingDataProcessor");
|
||||
Object dataProcessor = dataProcessorClass.getConstructor(ClassLoadHelper.class).newInstance(clh);
|
||||
Method processFileAndScheduleJobs = dataProcessorClass.getMethod("processFileAndScheduleJobs", String.class, Scheduler.class);
|
||||
for (String location : this.jobSchedulingDataLocations) {
|
||||
processFileAndScheduleJobs.invoke(dataProcessor, location, getScheduler());
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// Quartz 1.6
|
||||
Class dataProcessorClass = getClass().getClassLoader().loadClass("org.quartz.xml.JobSchedulingDataProcessor");
|
||||
logger.debug("Using Quartz 1.6 JobSchedulingDataProcessor");
|
||||
Object dataProcessor = dataProcessorClass.getConstructor(ClassLoadHelper.class, boolean.class, boolean.class).newInstance(clh, true, true);
|
||||
Method processFileAndScheduleJobs = dataProcessorClass.getMethod("processFileAndScheduleJobs", String.class, Scheduler.class, boolean.class);
|
||||
for (String location : this.jobSchedulingDataLocations) {
|
||||
processFileAndScheduleJobs.invoke(dataProcessor, location, getScheduler(), this.overwriteExistingJobs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -74,9 +74,9 @@ import org.springframework.util.CollectionUtils;
|
||||
* automatically apply to Scheduler operations performed within those scopes.
|
||||
* Alternatively, you may add transactional advice for the Scheduler itself.
|
||||
*
|
||||
* <p><b>Note:</b> This version of Spring's SchedulerFactoryBean requires
|
||||
* Quartz 1.5.x or 1.6.x. The "jobSchedulingDataLocation" feature requires
|
||||
* Quartz 1.6.1 or higher (as of Spring 2.5.5).
|
||||
* <p><b>Note:</b> This version of Spring's SchedulerFactoryBean supports Quartz 1.x,
|
||||
* more specifically Quartz 1.5 or higher. The "jobSchedulingDataLocation" feature
|
||||
* requires Quartz 1.6.1 or higher (as of Spring 2.5.5).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 18.02.2004
|
||||
|
||||
Reference in New Issue
Block a user