4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
– |
import java.util.Random; |
7 |
|
import java.util.concurrent.ArrayBlockingQueue; |
8 |
|
import java.util.concurrent.BlockingQueue; |
9 |
|
import java.util.concurrent.CyclicBarrier; |
253 |
|
static final class LTQasSQ<T> extends LinkedTransferQueue<T> { |
254 |
|
LTQasSQ() { super(); } |
255 |
|
public void put(T x) { |
256 |
< |
try { super.transfer(x); |
257 |
< |
} catch (InterruptedException ex) { throw new Error(); } |
256 |
> |
try { super.transfer(x); } |
257 |
> |
catch (InterruptedException ex) { throw new Error(ex); } |
258 |
|
} |
259 |
|
} |
260 |
|
|
265 |
|
if ((++calls & 1) == 0) |
266 |
|
super.put(x); |
267 |
|
else { |
268 |
< |
try { super.transfer(x); |
269 |
< |
} catch (InterruptedException ex) { |
271 |
< |
throw new Error(); |
272 |
< |
} |
268 |
> |
try { super.transfer(x); } |
269 |
> |
catch (InterruptedException ex) { throw new Error(ex); } |
270 |
|
} |
271 |
|
} |
272 |
|
} |