update - 暂时移除实例 ID 分布式锁
This commit is contained in:
parent
959361af55
commit
c81ff4e58d
@ -52,9 +52,11 @@ public class CustomLockProcessInstanceInterceptor extends AbstractCommandInterce
|
|||||||
try {
|
try {
|
||||||
do {
|
do {
|
||||||
token = getLock(KEY_PREFIX + abstractCommand.getProcessInstanceId(), 10 * 1000, 11 * 1000);
|
token = getLock(KEY_PREFIX + abstractCommand.getProcessInstanceId(), 10 * 1000, 11 * 1000);
|
||||||
|
log.info(" threadName: {}, token: {}", Thread.currentThread().getName(), token);
|
||||||
} while (Objects.isNull(token));
|
} while (Objects.isNull(token));
|
||||||
return next.execute(config, command, commandExecutor);
|
return next.execute(config, command, commandExecutor);
|
||||||
} finally {
|
} finally {
|
||||||
|
log.info("finally unlock threadName: {}, token: {}", Thread.currentThread().getName(), token);
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
unlock(abstractCommand.getProcessInstanceId(), token);
|
unlock(abstractCommand.getProcessInstanceId(), token);
|
||||||
}
|
}
|
||||||
@ -111,6 +113,10 @@ public class CustomLockProcessInstanceInterceptor extends AbstractCommandInterce
|
|||||||
RedisStringCommands.SetOption.SET_IF_ABSENT); //如果name不存在创建
|
RedisStringCommands.SetOption.SET_IF_ABSENT); //如果name不存在创建
|
||||||
if (result != null && result)
|
if (result != null && result)
|
||||||
return token;
|
return token;
|
||||||
|
} catch (Exception e) {
|
||||||
|
unlock(name, token);
|
||||||
|
log.warn("tryGetLock error: {}", e.getMessage(), e);
|
||||||
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
RedisConnectionUtils.releaseConnection(conn, factory);
|
RedisConnectionUtils.releaseConnection(conn, factory);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user