CanalConnector接口去掉stopRunning接口

This commit is contained in:
mcy
2018-10-29 01:40:34 +08:00
parent 2e1d0e36c5
commit b131e8cfa4
10 changed files with 38 additions and 46 deletions

View File

@@ -149,11 +149,4 @@ public interface CanalConnector {
* @throws CanalClientException
*/
void rollback() throws CanalClientException;
/**
* 中断的阻塞,用于优雅停止client
*
* @throws CanalClientException
*/
void stopRunning() throws CanalClientException;
}

View File

@@ -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");

View File

@@ -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;
}
}

View File

@@ -88,7 +88,6 @@ public class CanalKafkaClientExample {
if (!running) {
return;
}
connector.stopRunning();
running = false;
if (thread != null) {
try {

View File

@@ -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();
}
}