独行的浪子
2022-04-25 3271cea1b986ee24c5bfaf2b15326554fb56090c
提交 | 用户 | age
de8c2b 1 package com.duxinglangzi.canal.starter.listener;
D 2
3 import org.springframework.boot.context.event.ApplicationReadyEvent;
4 import org.springframework.context.ApplicationListener;
5
6 import java.util.concurrent.atomic.AtomicBoolean;
7
8 /**
9  * @author wuqiong 2022/4/16
10  */
11 public class ApplicationReadyListener implements ApplicationListener<ApplicationReadyEvent>{
12
13     public static final AtomicBoolean START_LISTENER_CONTAINER = new AtomicBoolean(false);
14
15     @Override
16     public void onApplicationEvent(ApplicationReadyEvent event) {
627420 17         // 确保程序启动之后,再放行所有的 canal transponder
de8c2b 18         if (!START_LISTENER_CONTAINER.get()) START_LISTENER_CONTAINER.set(true);
D 19     }
20 }