You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2021/05/01 06:50:54 UTC
[shardingsphere] branch master updated: Refactor JDBCLockEngine
(#10227)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new ddcab50 Refactor JDBCLockEngine (#10227)
ddcab50 is described below
commit ddcab50140fb76c18075d350ef73e183e2cdbf24
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat May 1 14:50:28 2021 +0800
Refactor JDBCLockEngine (#10227)
---
.../shardingsphere/driver/executor/JDBCLockEngine.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/JDBCLockEngine.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/JDBCLockEngine.java
index 71c08b1..4adf330 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/JDBCLockEngine.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/JDBCLockEngine.java
@@ -91,19 +91,19 @@ public final class JDBCLockEngine {
}
private void tryTableLock(final ShardingSphereLock lock, final Collection<String> tableNames) throws SQLException {
- for (String tableName : tableNames) {
- String lockName = LockNameUtil.getTableLockName(DefaultSchema.LOGIC_NAME, tableName);
+ for (String each : tableNames) {
+ String lockName = LockNameUtil.getTableLockName(DefaultSchema.LOGIC_NAME, each);
if (!lock.tryLock(lockName)) {
- throw new SQLException(String.format("Table %s lock wait timeout of %s ms exceeded", tableName, lock.getDefaultTimeOut()));
+ throw new SQLException(String.format("Table %s lock wait timeout of %s ms exceeded", each, lock.getDefaultTimeOut()));
}
lockNames.add(lockName);
}
}
private void checkTableLock(final ShardingSphereLock lock, final Collection<String> tableNames) throws SQLException {
- for (String tableName : tableNames) {
- if (lock.isLocked(LockNameUtil.getTableLockName(DefaultSchema.LOGIC_NAME, tableName))) {
- throw new SQLException(String.format("Table %s is locked", tableName));
+ for (String each : tableNames) {
+ if (lock.isLocked(LockNameUtil.getTableLockName(DefaultSchema.LOGIC_NAME, each))) {
+ throw new SQLException(String.format("Table %s is locked", each));
}
}
}