author | jbhateja |
Tue, 26 Nov 2019 16:09:25 +0300 | |
changeset 59278 | 8375560db76b |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
21318
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
1 |
/* |
37817
5fd92fde53db
8156512: Mark several tests from java/nio as intermittently failing
amlu
parents:
21318
diff
changeset
|
2 |
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
21318
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
4 |
* |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
8 |
* |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
13 |
* accompanied this code). |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
14 |
* |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
18 |
* |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
21 |
* questions. |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
22 |
*/ |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
23 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
24 |
/* @test |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
25 |
* @bug 8024833 |
37817
5fd92fde53db
8156512: Mark several tests from java/nio as intermittently failing
amlu
parents:
21318
diff
changeset
|
26 |
* @key intermittent |
21318
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
27 |
* @summary Tests interruption of threads mapping sections of a file channel in |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
28 |
* an attempt to deadlock due to nesting of begin calls. |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
29 |
*/ |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
30 |
import java.io.IOException; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
31 |
import java.nio.ByteBuffer; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
32 |
import java.nio.channels.*; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
33 |
import java.nio.channels.FileChannel.MapMode; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
34 |
import java.nio.file.*; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
35 |
import java.util.concurrent.Semaphore; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
36 |
import static java.nio.file.StandardOpenOption.*; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
37 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
38 |
public class InterruptMapDeadlock { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
39 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
40 |
static class Mapper extends Thread { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
41 |
final FileChannel fc; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
42 |
final Semaphore gate; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
43 |
volatile Exception exception; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
44 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
45 |
Mapper(FileChannel fc, Semaphore gate) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
46 |
this.fc = fc; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
47 |
this.gate = gate; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
48 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
49 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
50 |
@Override |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
51 |
public void run() { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
52 |
try { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
53 |
gate.acquireUninterruptibly(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
54 |
fc.map(MapMode.READ_ONLY, 0, 1); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
55 |
throw new Exception("Map succeeded"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
56 |
} catch (IOException x) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
57 |
System.out.println(x.getClass() + " (expected)"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
58 |
} catch (Exception unexpected) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
59 |
this.exception = unexpected; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
60 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
61 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
62 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
63 |
Exception exception() { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
64 |
return exception; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
65 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
66 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
67 |
static Mapper startMapper(FileChannel fc, Semaphore gate) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
68 |
Mapper r = new Mapper(fc, gate); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
69 |
r.setDaemon(true); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
70 |
r.start(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
71 |
return r; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
72 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
73 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
74 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
75 |
static class Interruptor extends Thread { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
76 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
77 |
final Mapper[] mappers; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
78 |
final Semaphore gate; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
79 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
80 |
Interruptor(Mapper[] mappers, Semaphore gate) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
81 |
this.mappers = mappers; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
82 |
this.gate = gate; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
83 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
84 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
85 |
public void run() { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
86 |
gate.release(mappers.length); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
87 |
for (Mapper m : mappers) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
88 |
m.interrupt(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
89 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
90 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
91 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
92 |
// the number of mapper threads to start |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
93 |
private static final int MAPPER_COUNT = 4; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
94 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
95 |
public static void main(String[] args) throws Exception { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
96 |
Path file = Paths.get("data.txt"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
97 |
FileChannel.open(file, CREATE, TRUNCATE_EXISTING, WRITE).close(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
98 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
99 |
Mapper[] mappers = new Mapper[MAPPER_COUNT]; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
100 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
101 |
for (int i=1; i<=20; i++) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
102 |
System.out.format("Iteration: %s%n", i); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
103 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
104 |
FileChannel fc = FileChannel.open(file); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
105 |
boolean failed = false; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
106 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
107 |
Semaphore gate = new Semaphore(0); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
108 |
// start mapper threads |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
109 |
for (int j=0; j<MAPPER_COUNT; j++) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
110 |
mappers[j] = Mapper.startMapper(fc, gate); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
111 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
112 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
113 |
// interrupt and wait for the mappers to terminate |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
114 |
Interruptor interruptor = new Interruptor(mappers, gate); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
115 |
interruptor.start(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
116 |
try { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
117 |
interruptor.join(10000); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
118 |
if (interruptor.isAlive()) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
119 |
System.err.println("Interruptor thread did not terminate:"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
120 |
Throwable t = new Exception("Stack trace"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
121 |
t.setStackTrace(interruptor.getStackTrace()); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
122 |
t.printStackTrace(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
123 |
failed = true; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
124 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
125 |
} catch (InterruptedException x) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
126 |
System.err.println("Main thread was interrupted"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
127 |
failed = true; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
128 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
129 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
130 |
for (Mapper m: mappers) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
131 |
try { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
132 |
m.join(10000); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
133 |
Exception e = m.exception(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
134 |
if (e != null) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
135 |
System.err.println("Mapper thread failed with: " + e); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
136 |
failed = true; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
137 |
} else if (m.isAlive()) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
138 |
System.err.println("Mapper thread did not terminate:"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
139 |
Throwable t = new Exception("Stack trace"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
140 |
t.setStackTrace(m.getStackTrace()); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
141 |
t.printStackTrace(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
142 |
failed = true; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
143 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
144 |
} catch (InterruptedException x) { |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
145 |
System.err.println("Main thread was interrupted"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
146 |
failed = true; |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
147 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
148 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
149 |
|
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
150 |
if (failed) |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
151 |
throw new RuntimeException("Test failed - see log for details"); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
152 |
else |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
153 |
fc.close(); |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
154 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
155 |
} |
2dffe829fb18
8024833: (fc) FileChannel.map does not handle async close/interrupt correctly
alanb
parents:
diff
changeset
|
156 |
} |