...
|
...
|
@@ -90,15 +90,17 @@ public class CanalClientHandler implements InitializingBean, ApplicationEventPub |
|
|
for (CanalConfig.CanalInstance instance : canalInstancesList) {
|
|
|
threadPool.execute(() -> {
|
|
|
Thread.currentThread().setName(Thread.currentThread().getName() + "-" + instance.getDestination());
|
|
|
try {
|
|
|
initConnector(instance);
|
|
|
while (!threadPool.isShutdown() && !threadPool.isTerminated()) {
|
|
|
try {
|
|
|
|
|
|
handleCanalMessage(canalInstConnectors.get(instance.getDestination()), instance);
|
|
|
} catch (CanalClientException e) {
|
|
|
}
|
|
|
}catch (CanalClientException e) {
|
|
|
//TODO 事件上报
|
|
|
logger.error("CanalClientHandler invoke thread error!", e);
|
|
|
reConnectCanal(instance);
|
|
|
} catch (Throwable e) {
|
|
|
}catch (Throwable e) {
|
|
|
// 避免未捕获的异常导致连接丢失
|
|
|
// TODO 事件上报
|
|
|
logger.error("CanalClientHandler invoke thread error!", e);
|
...
|
...
|
@@ -108,7 +110,6 @@ public class CanalClientHandler implements InitializingBean, ApplicationEventPub |
|
|
Thread.currentThread().interrupt();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
...
|
...
|
|