[HUDI-1979] Optimize logic to improve code readability (#3037)
Co-authored-by: wei.zhang2 <wei.zhang2@dmall.com>
This commit is contained in:
@@ -184,18 +184,13 @@ public class HiveMetastoreBasedLockProvider implements LockProvider<LockResponse
|
|||||||
this.lock = executor.submit(() -> hiveClient.lock(lockRequestFinal))
|
this.lock = executor.submit(() -> hiveClient.lock(lockRequestFinal))
|
||||||
.get(time, unit);
|
.get(time, unit);
|
||||||
} catch (InterruptedException | TimeoutException e) {
|
} catch (InterruptedException | TimeoutException e) {
|
||||||
if (this.lock != null && this.lock.getState() == LockState.ACQUIRED) {
|
if (this.lock == null || this.lock.getState() != LockState.ACQUIRED) {
|
||||||
return;
|
|
||||||
} else if (lockRequest != null) {
|
|
||||||
LockResponse lockResponse = this.hiveClient.checkLock(lockRequest.getTxnid());
|
LockResponse lockResponse = this.hiveClient.checkLock(lockRequest.getTxnid());
|
||||||
if (lockResponse.getState() == LockState.ACQUIRED) {
|
if (lockResponse.getState() == LockState.ACQUIRED) {
|
||||||
this.lock = lockResponse;
|
this.lock = lockResponse;
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user