mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
CanalConnector接口去掉stopRunning接口
This commit is contained in:
@@ -149,11 +149,4 @@ public interface CanalConnector {
|
||||
* @throws CanalClientException
|
||||
*/
|
||||
void rollback() throws CanalClientException;
|
||||
|
||||
/**
|
||||
* 中断的阻塞,用于优雅停止client
|
||||
*
|
||||
* @throws CanalClientException
|
||||
*/
|
||||
void stopRunning() throws CanalClientException;
|
||||
}
|
||||
|
||||
@@ -238,15 +238,6 @@ public class KafkaCanalConnector implements CanalMQConnector {
|
||||
}
|
||||
}
|
||||
|
||||
public void stopRunning() {
|
||||
if (running) {
|
||||
running = false; // 设置为非running状态
|
||||
// if (!mutex.state()) {
|
||||
// mutex.set(true); // 中断阻塞
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscribe(String filter) throws CanalClientException {
|
||||
throw new CanalClientException("mq not support this method");
|
||||
|
||||
@@ -65,6 +65,7 @@ public class RocketMQCanalConnector implements CanalMQConnector {
|
||||
|
||||
public void disconnect() throws CanalClientException {
|
||||
rocketMQConsumer.shutdown();
|
||||
connected = false;
|
||||
}
|
||||
|
||||
public boolean checkValid() throws CanalClientException {
|
||||
@@ -259,10 +260,4 @@ public class RocketMQCanalConnector implements CanalMQConnector {
|
||||
throw new CanalClientException("mq not support this method");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopRunning() throws CanalClientException {
|
||||
this.rocketMQConsumer.shutdown();
|
||||
connected = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ public class CanalKafkaClientExample {
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
connector.stopRunning();
|
||||
running = false;
|
||||
if (thread != null) {
|
||||
try {
|
||||
|
||||
@@ -87,7 +87,6 @@ public class CanalRocketMQClientExample extends AbstractRocektMQTest {
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
connector.stopRunning();
|
||||
running = false;
|
||||
if (thread != null) {
|
||||
try {
|
||||
@@ -134,6 +133,6 @@ public class CanalRocketMQClientExample extends AbstractRocektMQTest {
|
||||
} catch (WakeupException e) {
|
||||
// No-op. Continue process
|
||||
}
|
||||
connector.stopRunning();
|
||||
// connector.stopRunning();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user