Subversion Repositories SmartDukaan

Rev

Rev 30374 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30374 Rev 30403
Line 1... Line 1...
1
package com.smartdukaan.cron.config;
1
package com.smartdukaan.cron.config;
2
 
2
 
-
 
3
import org.apache.logging.log4j.LogManager;
-
 
4
import org.apache.logging.log4j.Logger;
3
import org.springframework.context.annotation.Configuration;
5
import org.springframework.context.annotation.Configuration;
4
import org.springframework.scheduling.annotation.SchedulingConfigurer;
6
import org.springframework.scheduling.annotation.SchedulingConfigurer;
5
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
7
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
6
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
8
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
7
 
9
 
Line 15... Line 17...
15
	/**
17
	/**
16
	 * Configures the scheduler to allow multiple pools.
18
	 * Configures the scheduler to allow multiple pools.
17
	 *
19
	 *
18
	 * @param taskRegistrar The task registrar.
20
	 * @param taskRegistrar The task registrar.
19
	 */
21
	 */
-
 
22
	private static final Logger LOGGER = LogManager.getLogger(SchedulerConfig.class);
-
 
23
 
20
	@Override
24
	@Override
21
	public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
25
	public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
22
		ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
26
		ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
23
 
27
 
-
 
28
		threadPoolTaskScheduler.setErrorHandler(t -> {
-
 
29
			LOGGER.info("Exception Thrown - {}", t);
-
 
30
		});
-
 
31
 
24
		threadPoolTaskScheduler.setPoolSize(POOL_SIZE);
32
		threadPoolTaskScheduler.setPoolSize(POOL_SIZE);
25
		threadPoolTaskScheduler.setThreadNamePrefix("scheduled-task-pool-");
33
		threadPoolTaskScheduler.setThreadNamePrefix("scheduled-task-pool-");
26
		threadPoolTaskScheduler.initialize();
34
		threadPoolTaskScheduler.initialize();
27
 
35
 
28
		taskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
36
		taskRegistrar.setTaskScheduler(threadPoolTaskScheduler);