All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fi.evolver.basics.spring.timer.TaskSchedulerConfig Maven / Gradle / Ivy

package fi.evolver.basics.spring.timer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.task.ThreadPoolTaskSchedulerCustomizer;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;


@Configuration
public class TaskSchedulerConfig implements ThreadPoolTaskSchedulerCustomizer {
	private static final Logger LOG = LoggerFactory.getLogger(TaskSchedulerConfig.class);


	@Override
	public void customize(ThreadPoolTaskScheduler taskScheduler) {
		taskScheduler.setErrorHandler(TaskSchedulerConfig::handleError);
	}


	private static void handleError(Throwable throwable) {
		LOG.error("Failed handling @Scheduled method", throwable);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy