springboot 定时器执行时间超过定时器定时时间会发生什么

 定时器执行时间超过定时器定时时间会发生什么,突然发现这个问题,写个方法看看

	/**
	 * 每隔一小时循环退款
	 */
	@Scheduled(cron = "0 0 0/1 * * ?")
	@Scheduled(cron="0/1 * *  * * ? ")
	public void test(){
		try {
			
			Thread.currentThread().sleep(10000);
			System.out.println("------------睡10秒");
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}

结果是会等上一个程序执行完毕之后再,再开始下一个循环,会做到阻塞,后续我还会继续测试的。

猜你喜欢

转载自blog.csdn.net/atmknight/article/details/81810985