author | alanb |
Fri, 14 Sep 2018 16:56:09 +0100 | |
changeset 51745 | 90c1dcdebc64 |
parent 48738 | cdd3239a2a61 |
permissions | -rw-r--r-- |
48738
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
1 |
/* |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
4 |
* |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
8 |
* |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
13 |
* accompanied this code). |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
14 |
* |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
18 |
* |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
21 |
* questions. |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
22 |
*/ |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
23 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
24 |
import java.io.File; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
25 |
import java.io.IOException; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
26 |
import java.io.RandomAccessFile; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
27 |
import java.lang.ref.Reference; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
28 |
import java.lang.ref.WeakReference; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
29 |
import java.nio.channels.FileLock; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
30 |
import java.nio.channels.OverlappingFileLockException; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
31 |
import java.nio.file.Files; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
32 |
import java.nio.file.Path; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
33 |
import jdk.test.lib.util.FileUtils; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
34 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
35 |
/* |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
36 |
* @test |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
37 |
* @bug 8166253 |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
38 |
* @summary Verify that OverlappingFileLockException is thrown when expected. |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
39 |
* @library .. /test/lib |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
40 |
* @build jdk.test.lib.util.FileUtils |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
41 |
* @run main/othervm FileLockGC |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
42 |
*/ |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
43 |
public class FileLockGC { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
44 |
public enum TestType { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
45 |
NO_GC_NO_RELEASE(true), |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
46 |
// A hypothetical 'GC_THEN_RELEASE' case is infeasible |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
47 |
RELEASE(false), |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
48 |
RELEASE_THEN_GC(false), |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
49 |
GC(true); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
50 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
51 |
private final boolean exceptionExpected; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
52 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
53 |
TestType(boolean exceptionExpected) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
54 |
this.exceptionExpected = exceptionExpected; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
55 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
56 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
57 |
boolean exceptionExpected() { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
58 |
return exceptionExpected; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
59 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
60 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
61 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
62 |
public static void main(String[] args) throws Exception { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
63 |
final File f = new File(System.getProperty("test.dir", ".") |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
64 |
+ File.separator + "junk.txt"); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
65 |
final Path p = f.toPath(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
66 |
int failures = 0; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
67 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
68 |
for (TestType t : TestType.values()) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
69 |
try { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
70 |
if (!testFileLockGC(f, t)) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
71 |
failures++; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
72 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
73 |
} finally { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
74 |
FileUtils.deleteFileIfExistsWithRetry(p); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
75 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
76 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
77 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
78 |
if (failures != 0) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
79 |
throw new RuntimeException("Test had " + failures + " failure(s)"); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
80 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
81 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
82 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
83 |
private static boolean testFileLockGC(File f, TestType type) |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
84 |
throws InterruptedException, IOException { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
85 |
System.out.printf("Test %s starting%n", type.toString()); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
86 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
87 |
final RandomAccessFile raf1 = new RandomAccessFile(f, "rw"); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
88 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
89 |
FileLock lock1 = raf1.getChannel().tryLock(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
90 |
WeakReference<FileLock> ref1 = new WeakReference(lock1); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
91 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
92 |
switch (type) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
93 |
case GC: |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
94 |
lock1 = null; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
95 |
System.gc(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
96 |
break; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
97 |
case RELEASE: |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
98 |
lock1.release(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
99 |
break; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
100 |
case RELEASE_THEN_GC: |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
101 |
lock1.release(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
102 |
lock1 = null; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
103 |
System.gc(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
104 |
break; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
105 |
default: // NO_GC_NO_RELEASE |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
106 |
// lock1 is neither collected nor released |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
107 |
break; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
108 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
109 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
110 |
final RandomAccessFile raf2 = new RandomAccessFile(f, "rw"); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
111 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
112 |
boolean success = true; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
113 |
FileLock lock2 = null; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
114 |
try { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
115 |
lock2 = raf2.getChannel().tryLock(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
116 |
if (type.exceptionExpected()) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
117 |
System.err.printf |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
118 |
("No expected OverlappingFileLockException for test %s%n", |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
119 |
type.toString()); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
120 |
success = false; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
121 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
122 |
} catch (OverlappingFileLockException ofe) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
123 |
if (!type.exceptionExpected()) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
124 |
System.err.printf |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
125 |
("Unexpected OverlappingFileLockException for test %s%n", |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
126 |
type.toString()); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
127 |
success = false; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
128 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
129 |
} finally { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
130 |
if (lock1 != null) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
131 |
lock1.release(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
132 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
133 |
if (lock2 != null) { |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
134 |
lock2.release(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
135 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
136 |
raf2.close(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
137 |
raf1.close(); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
138 |
System.out.printf("Test %s finished%n", type.toString()); |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
139 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
140 |
|
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
141 |
return success; |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
142 |
} |
cdd3239a2a61
8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
bpb
parents:
diff
changeset
|
143 |
} |