mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
@@ -76,16 +76,19 @@ public abstract class AbstractCanalAdapterWorker {
|
|||||||
|
|
||||||
// 等待所有适配器写入完成
|
// 等待所有适配器写入完成
|
||||||
// 由于是组间并发操作,所以将阻塞直到耗时最久的工作组操作完成
|
// 由于是组间并发操作,所以将阻塞直到耗时最久的工作组操作完成
|
||||||
futures.forEach(future -> {
|
RuntimeException exception = null;
|
||||||
|
for (Future<Boolean> future : futures) {
|
||||||
try {
|
try {
|
||||||
if (!future.get()) {
|
if (!future.get()) {
|
||||||
throw new RuntimeException("Outer adapter sync failed! ");
|
exception = new RuntimeException("Outer adapter sync failed! ");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
future.cancel(true);
|
exception = new RuntimeException(e);
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
if (exception != null) {
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,16 +119,19 @@ public abstract class AbstractCanalAdapterWorker {
|
|||||||
|
|
||||||
// 等待所有适配器写入完成
|
// 等待所有适配器写入完成
|
||||||
// 由于是组间并发操作,所以将阻塞直到耗时最久的工作组操作完成
|
// 由于是组间并发操作,所以将阻塞直到耗时最久的工作组操作完成
|
||||||
futures.forEach(future -> {
|
RuntimeException exception = null;
|
||||||
|
for (Future<Boolean> future : futures) {
|
||||||
try {
|
try {
|
||||||
if (!future.get()) {
|
if (!future.get()) {
|
||||||
throw new RuntimeException("Outer adapter sync failed! ");
|
exception = new RuntimeException("Outer adapter sync failed! ");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
future.cancel(true);
|
exception = new RuntimeException(e);
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
if (exception != null) {
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user