瀏覽代碼

fixed locking issue

Eric Foster 6 年之前
父節點
當前提交
d4544b4492
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. 3
    1
      src/main/java/io/zipcoder/SafeCopier.java

+ 3
- 1
src/main/java/io/zipcoder/SafeCopier.java 查看文件

@@ -9,12 +9,14 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
9 9
  */
10 10
 public class SafeCopier extends Copier {
11 11
 
12
+    ReadWriteLock lock;
13
+
12 14
     public SafeCopier(String toCopy) {
13 15
         super(toCopy);
14 16
     }
15 17
 
16 18
     public void run() {
17
-        ReadWriteLock lock = new ReentrantReadWriteLock();
19
+        lock = new ReentrantReadWriteLock();
18 20
         lock.writeLock().lock();
19 21
         lock.readLock().lock();
20 22
         try {