1 |
|
/* |
2 |
– |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 |
– |
* |
4 |
– |
* This code is free software; you can redistribute it and/or modify it |
5 |
– |
* under the terms of the GNU General Public License version 2 only, as |
6 |
– |
* published by the Free Software Foundation. |
7 |
– |
* |
8 |
– |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9 |
– |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
10 |
– |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
11 |
– |
* version 2 for more details (a copy is included in the LICENSE file that |
12 |
– |
* accompanied this code). |
13 |
– |
* |
14 |
– |
* You should have received a copy of the GNU General Public License version |
15 |
– |
* 2 along with this work; if not, write to the Free Software Foundation, |
16 |
– |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
17 |
– |
* |
18 |
– |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
19 |
– |
* CA 95054 USA or visit www.sun.com if you need additional information or |
20 |
– |
* have any questions. |
21 |
– |
*/ |
22 |
– |
|
23 |
– |
/* |
24 |
– |
* This file is available under and governed by the GNU General Public |
25 |
– |
* License version 2 only, as published by the Free Software Foundation. |
26 |
– |
* However, the following notice accompanied the original version of this |
27 |
– |
* file: |
28 |
– |
* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
/* |
11 |
|
* @summary Test concurrent offer vs. drainTo |
12 |
|
*/ |
13 |
|
|
14 |
< |
import java.util.*; |
15 |
< |
import java.util.concurrent.*; |
16 |
< |
import java.util.concurrent.atomic.*; |
17 |
< |
//import jsr166y.*; |
14 |
> |
import java.util.ArrayList; |
15 |
> |
import java.util.List; |
16 |
> |
import java.util.concurrent.ArrayBlockingQueue; |
17 |
> |
import java.util.concurrent.BlockingQueue; |
18 |
> |
import java.util.concurrent.LinkedBlockingDeque; |
19 |
> |
import java.util.concurrent.LinkedBlockingQueue; |
20 |
> |
import java.util.concurrent.LinkedTransferQueue; |
21 |
> |
import java.util.concurrent.ThreadLocalRandom; |
22 |
> |
import java.util.concurrent.atomic.AtomicLong; |
23 |
|
|
24 |
|
@SuppressWarnings({"unchecked", "rawtypes"}) |
25 |
|
public class OfferDrainToLoops { |
67 |
|
protected boolean quittingTime(long i) { |
68 |
|
return (i % 1024) == 0 && quittingTime(); |
69 |
|
} |
70 |
< |
abstract protected void realRun(); |
70 |
> |
protected abstract void realRun(); |
71 |
|
public void run() { |
72 |
|
try { realRun(); } catch (Throwable t) { unexpected(t); } |
73 |
|
} |