NutzCN Logo
问答 改造quartz为集群模式并使用nutDao遇到的问题
发布于 35天前 作者 Wizzercn 73 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

写了ConnectionProvider 类,改了quartz配置文件,添加数据源配置,然并卵。。

@IocBean
public class NutConnectionProvider implements ConnectionProvider {
    @Inject
    private Dao dao;

    @Override
    public Connection getConnection() throws SQLException {
        return ((NutDao) dao).getDataSource().getConnection();
    }

    @Override
    public void initialize() throws SQLException {

    }

    @Override
    public void shutdown() throws SQLException {

    }

}

日志:::

2017-03-18 21:26:58,198 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'quartzManager'<interface org.nutz.integration.quartz.QuartzManager>
2017-03-18 21:26:58,198 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=quartzManager
2017-03-18 21:26:58,199 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=quartzManager
2017-03-18 21:26:58,200 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(quartzManager) in QuartzIocLoader@271407569
2017-03-18 21:26:58,200 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'quartzManager'<interface org.nutz.integration.quartz.QuartzManager>
2017-03-18 21:26:58,200 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) DEBUG - skip -- org.nutz.integration.quartz.QuartzManagerImpl
2017-03-18 21:26:58,203 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.nutz.integration.quartz.QuartzManagerImpl without AOP
2017-03-18 21:26:58,204 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'quartzManager' to [app] 
2017-03-18 21:26:58,204 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'scheduler'<>
2017-03-18 21:26:58,204 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=scheduler
2017-03-18 21:26:58,204 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=scheduler
2017-03-18 21:26:58,205 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(scheduler) in QuartzIocLoader@271407569
2017-03-18 21:26:58,205 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'scheduler'<>
2017-03-18 21:26:58,205 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'scheduler' to [app] 
2017-03-18 21:26:58,245 org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1172) INFO  - Using default implementation for ThreadExecutor
2017-03-18 21:26:58,248 org.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:268) INFO  - Job execution threads will use class loader of thread: Scanner-1
2017-03-18 21:26:58,261 org.quartz.core.SchedulerSignalerImpl.<init>(SchedulerSignalerImpl.java:61) INFO  - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2017-03-18 21:26:58,261 org.quartz.core.QuartzScheduler.<init>(QuartzScheduler.java:240) INFO  - Quartz Scheduler v.2.2.3 created.
2017-03-18 21:26:58,262 org.quartz.simpl.RAMJobStore.initialize(RAMJobStore.java:155) INFO  - RAMJobStore initialized.
2017-03-18 21:26:58,263 org.quartz.core.QuartzScheduler.initialize(QuartzScheduler.java:305) INFO  - Scheduler meta-data: Quartz Scheduler (v2.2.3) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2017-03-18 21:26:58,263 org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1327) INFO  - Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2017-03-18 21:26:58,263 org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1331) INFO  - Quartz scheduler version: 2.2.3
2017-03-18 21:26:58,263 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'jobFactory'<>
2017-03-18 21:26:58,263 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=jobFactory
2017-03-18 21:26:58,263 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jobFactory
2017-03-18 21:26:58,264 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(jobFactory) in QuartzIocLoader@271407569
2017-03-18 21:26:58,264 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'jobFactory'<>
2017-03-18 21:26:58,264 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) DEBUG - skip -- org.nutz.integration.quartz.NutQuartzJobFactory
2017-03-18 21:26:58,264 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.nutz.integration.quartz.NutQuartzJobFactory without AOP
2017-03-18 21:26:58,264 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'jobFactory' to [app] 
2017-03-18 21:26:58,265 org.quartz.core.QuartzScheduler.setJobFactory(QuartzScheduler.java:2311) INFO  - JobFactory set to: org.nutz.integration.quartz.NutQuartzJobFactory@5506c724
2017-03-18 21:26:58,265 org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:575) INFO  - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.

配置文件::::

#==============================================================    
#Configure Main Scheduler Properties    
#==============================================================     
org.quartz.scheduler.instanceName = defaultScheduler  
org.quartz.scheduler.instanceId = AUTO  

#==============================================================    
#Configure JobStore     isClustered=启用集群模式
#==============================================================   
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX  
orgorg.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate \
org.quartz.jobStore.dataSource=myDS 
org.quartz.jobStore.tablePrefix = SYS_QRTZ_  
org.quartz.jobStore.isClustered = true  
org.quartz.jobStore.clusterCheckinInterval = 20000    
org.quartz.jobStore.maxMisfiresToHandleAtATime = 120  
org.quartz.jobStore.misfireThreshold = 120000  
org.quartz.jobStore.txIsolationLevelSerializable = true  

#==============================================================    
#Configure ThreadPool    
#==============================================================   
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool  
org.quartz.threadPool.threadCount = 2  
org.quartz.threadPool.threadPriority = 5  
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true  

#==============================================================  
#Skip Check Update  
#update:true  
#not update:false  
#==============================================================  
org.quartz.scheduler.skipUpdateCheck = true   

#============================================================================     
# Configure Plugins      
#============================================================================        
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin     
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin  
org.quartz.plugin.shutdownhook.cleanShutdown = true  

org.quartz.dataSource.myDS.connectionProvider.class = cn.wizzer.app.web.commons.quartz.NutConnectionProvider
1 回复

结贴 放错地方了。。。

添加回复
请先登陆
回到顶部