Former-commit-id: 3ae467fbfaf0d999adbeadba3c061f82187fc719
master
wangbing 5 years ago
parent 8e57ac8679
commit 44b1fe9f7e

@ -1,23 +1,23 @@
package ${basePackage}.config;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.type.filter.AssignableTypeFilter;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
import ${basePackage}.frame.schedule.RunTask;
import ${basePackage}.frame.utils.LogUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.type.filter.AssignableTypeFilter;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
import ${basePackage}.frame.schedule.RunTask;
import ${basePackage}.frame.utils.LogUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
/**
* ,
@ -40,7 +40,7 @@ public class ScheduleConfig extends ThreadPoolTaskScheduler implements BeanDefin
}
public boolean createOrRepeat(RunTask task) {
if (futureMap.containsKey(task.taskId())){
if (futureMap.containsKey(task.taskId())) {
ScheduledFuture<?> scheduledFuture = futureMap.get(task.taskId());
scheduledFuture.cancel(false);
}
@ -51,7 +51,13 @@ public class ScheduleConfig extends ThreadPoolTaskScheduler implements BeanDefin
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
registryTask("${basePackage}.task", beanDefinitionRegistry);
String aPackage = this.getClass().getPackage().getName();
Pattern compile = Pattern.compile("(.*)\\.config");
Matcher matcher = compile.matcher(aPackage);
if (matcher.find()) {
String basePackage = matcher.group(1);
registryTask(basePackage + ".task", beanDefinitionRegistry);
}
}
@Override

Loading…
Cancel
Save

Powered by TurnKey Linux.