提交 | 用户 | 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 |
}
|