Browse Source

fixed locking issue

Eric Foster 6 years ago
parent
commit
d4544b4492
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      src/main/java/io/zipcoder/SafeCopier.java

+ 3
- 1
src/main/java/io/zipcoder/SafeCopier.java View File

@@ -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 {