mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
etl 增加同步锁
This commit is contained in:
@@ -99,12 +99,16 @@ public class EtlLock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unlock(String key) throws Exception {
|
public void unlock(String key) {
|
||||||
if (mode == Mode.LOCAL) {
|
if (mode == Mode.LOCAL) {
|
||||||
getLock(key).unlock();
|
getLock(key).unlock();
|
||||||
} else {
|
} else {
|
||||||
InterProcessMutex lock = getRemoteLock(key);
|
InterProcessMutex lock = getRemoteLock(key);
|
||||||
|
try {
|
||||||
lock.release();
|
lock.release();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,11 +79,7 @@ public class CommonRest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
etlLock.unlock(ETL_LOCK_ZK_NODE + type + "-" + task);
|
etlLock.unlock(ETL_LOCK_ZK_NODE + type + "-" + task);
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user