author | zgu |
Thu, 04 Sep 2014 14:50:31 -0400 | |
changeset 26561 | e104c9397ca1 |
parent 24005 | 6841a4be0faa |
child 28394 | 6d382dc493e5 |
permissions | -rw-r--r-- |
24005
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
1 |
/* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
4 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
8 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
14 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
18 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
22 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
23 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
24 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
25 |
package rtm; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
26 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
27 |
import java.util.Objects; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
28 |
import java.util.concurrent.BrokenBarrierException; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
29 |
import java.util.concurrent.CyclicBarrier; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
30 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
31 |
import com.oracle.java.testlibrary.Asserts; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
32 |
import com.oracle.java.testlibrary.Utils; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
33 |
import sun.misc.Unsafe; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
34 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
35 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
36 |
* Base class for different transactional execution abortion |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
37 |
* provokers aimed to force abort due to specified reason. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
38 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
39 |
public abstract class AbortProvoker implements CompilableTest { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
40 |
public static final long DEFAULT_ITERATIONS = 10000L; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
41 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
42 |
* Inflates monitor associated with object {@code monitor}. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
43 |
* Inflation is forced by entering the same monitor from |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
44 |
* two different threads. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
45 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
46 |
* @param monitor monitor to be inflated. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
47 |
* @return inflated monitor. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
48 |
* @throws Exception if something went wrong. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
49 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
50 |
public static Object inflateMonitor(Object monitor) throws Exception { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
51 |
Unsafe unsafe = Utils.getUnsafe(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
52 |
CyclicBarrier barrier = new CyclicBarrier(2); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
53 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
54 |
Runnable inflatingRunnable = () -> { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
55 |
unsafe.monitorEnter(monitor); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
56 |
try { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
57 |
barrier.await(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
58 |
barrier.await(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
59 |
} catch (InterruptedException | BrokenBarrierException e) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
60 |
throw new RuntimeException( |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
61 |
"Synchronization issue occurred.", e); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
62 |
} finally { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
63 |
unsafe.monitorExit(monitor); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
64 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
65 |
}; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
66 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
67 |
Thread t = new Thread(inflatingRunnable); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
68 |
t.start(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
69 |
// Wait until thread t enters the monitor. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
70 |
barrier.await(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
71 |
// At this point monitor will be owned by thread t, |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
72 |
// so our attempt to enter the same monitor will force |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
73 |
// monitor inflation. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
74 |
Asserts.assertFalse(unsafe.tryMonitorEnter(monitor), |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
75 |
"Not supposed to enter the monitor first"); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
76 |
barrier.await(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
77 |
t.join(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
78 |
return monitor; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
79 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
80 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
81 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
82 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
83 |
* Get instance of specified AbortProvoker, inflate associated monitor |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
84 |
* if needed and then invoke forceAbort method in a loop. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
85 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
86 |
* Usage: |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
87 |
* AbortProvoker <AbortType name> [<inflate monitor> |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
88 |
* [<iterations> [ <delay>]]] |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
89 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
90 |
* Default parameters are: |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
91 |
* <ul> |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
92 |
* <li>inflate monitor = <b>true</b></li> |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
93 |
* <li>iterations = {@code AbortProvoker.DEFAULT_ITERATIONS}</li> |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
94 |
* <li>delay = <b>0</b></li> |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
95 |
* </ul> |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
96 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
97 |
public static void main(String args[]) throws Throwable { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
98 |
Asserts.assertGT(args.length, 0, "At least one argument is required."); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
99 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
100 |
AbortType abortType = AbortType.lookup(Integer.valueOf(args[0])); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
101 |
boolean monitorShouldBeInflated = true; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
102 |
long iterations = AbortProvoker.DEFAULT_ITERATIONS; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
103 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
104 |
if (args.length > 1) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
105 |
monitorShouldBeInflated = Boolean.valueOf(args[1]); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
106 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
107 |
if (args.length > 2) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
108 |
iterations = Long.valueOf(args[2]); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
109 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
110 |
if (args.length > 3) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
111 |
Thread.sleep(Integer.valueOf(args[3])); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
112 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
113 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
114 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
115 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
116 |
AbortProvoker provoker = abortType.provoker(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
117 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
118 |
if (monitorShouldBeInflated) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
119 |
provoker.inflateMonitor(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
120 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
121 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
122 |
for (long i = 0; i < iterations; i++) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
123 |
provoker.forceAbort(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
124 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
125 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
126 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
127 |
protected final Object monitor; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
128 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
129 |
protected AbortProvoker() { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
130 |
this(new Object()); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
131 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
132 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
133 |
protected AbortProvoker(Object monitor) { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
134 |
this.monitor = Objects.requireNonNull(monitor); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
135 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
136 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
137 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
138 |
* Inflates monitor used by this AbortProvoker instance. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
139 |
* @throws Exception |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
140 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
141 |
public void inflateMonitor() throws Exception { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
142 |
AbortProvoker.inflateMonitor(monitor); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
143 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
144 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
145 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
146 |
* Forces transactional execution abortion. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
147 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
148 |
public abstract void forceAbort(); |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
149 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
150 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
151 |
* Returns names of all methods that have to be compiled |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
152 |
* in order to successfully force transactional execution |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
153 |
* abortion. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
154 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
155 |
* @return array with methods' names that have to be compiled. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
156 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
157 |
@Override |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
158 |
public String[] getMethodsToCompileNames() { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
159 |
return new String[] { getMethodWithLockName() }; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
160 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
161 |
|
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
162 |
/** |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
163 |
* Returns name of the method that will contain monitor whose locking |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
164 |
* will be elided using transactional execution. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
165 |
* |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
166 |
* @return name of the method that will contain elided lock. |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
167 |
*/ |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
168 |
@Override |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
169 |
public String getMethodWithLockName() { |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
170 |
return this.getClass().getName() + "::forceAbort"; |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
171 |
} |
6841a4be0faa
8039499: Add all common classes used by tests on RTM support to testlibrary
iignatyev
parents:
diff
changeset
|
172 |
} |