rev:redisson自动续期问题
This commit is contained in:
@@ -201,7 +201,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
String type = whereJson.getString("type");
|
String type = whereJson.getString("type");
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
RLock lock = redissonClient.getLock("acs_to_wms:" + type);
|
RLock lock = redissonClient.getLock("acs_to_wms:" + type);
|
||||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
boolean tryLock = lock.tryLock(5,20, TimeUnit.SECONDS);
|
||||||
try {
|
try {
|
||||||
if (tryLock) {
|
if (tryLock) {
|
||||||
String device_code = whereJson.getString("device_code");
|
String device_code = whereJson.getString("device_code");
|
||||||
@@ -625,8 +625,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (tryLock) {
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||||
|
try {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
}catch (Exception ex){}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
|||||||
Reference in New Issue
Block a user