etl 增加同步锁

This commit is contained in:
mcy
2018-10-25 17:43:11 +08:00
parent c3402a97f3
commit ddfc2464f3
2 changed files with 7 additions and 7 deletions

View File

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

View File

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