diff --git a/pom.xml b/pom.xml
index 8c8fc7d48..034fce13e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.baidu.hugegraph
hugegraph-common
- 1.6.15
+ 1.6.16
hugegraph-common
https://github.com/hugegraph/hugegraph-common
@@ -218,7 +218,7 @@
- 1.6.15.0
+ 1.6.16.0
diff --git a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java
index 44d064dee..a3f26ef9f 100644
--- a/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java
+++ b/src/main/java/com/baidu/hugegraph/concurrent/LockGroup.java
@@ -64,6 +64,20 @@ public KeyLock keyLock(String lockName) {
return (KeyLock) this.locksMap.get(lockName);
}
+ public KeyLock keyLock(String lockName, int size) {
+ if (!this.locksMap.containsKey(lockName)) {
+ this.locksMap.putIfAbsent(lockName, new KeyLock(size));
+ }
+ return (KeyLock) this.locksMap.get(lockName);
+ }
+
+ public RowLock rowLock(String lockName) {
+ if (!this.locksMap.containsKey(lockName)) {
+ this.locksMap.putIfAbsent(lockName, new RowLock());
+ }
+ return (RowLock) this.locksMap.get(lockName);
+ }
+
public String name() {
return this.name;
}
diff --git a/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java b/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java
new file mode 100644
index 000000000..6fa5197d0
--- /dev/null
+++ b/src/main/java/com/baidu/hugegraph/concurrent/RowLock.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2017 HugeGraph Authors
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.baidu.hugegraph.concurrent;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import com.baidu.hugegraph.util.E;
+
+public class RowLock> {
+
+ private final Map locks = new ConcurrentHashMap<>();
+ private final ThreadLocal