17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.api.flightrecorder;
27 import static jdk.test.lib.Asserts.assertTrue;
28
29 import java.util.concurrent.TimeUnit;
30 import java.util.concurrent.locks.Condition;
31 import java.util.concurrent.locks.Lock;
32 import java.util.concurrent.locks.ReentrantLock;
33
34 import jdk.jfr.FlightRecorder;
35 import jdk.jfr.FlightRecorderListener;
36
37 /*
38 * @test
39 * @key jfr
40 * @library /test/lib
41 * @run main/othervm jdk.jfr.api.flightrecorder.TestFlightRecorderListenerRecorderInitialized
42 */
43 public class TestFlightRecorderListenerRecorderInitialized {
44
45 /**
46 * Utility class to wait/notify
47 */
48 private static class Signal {
49
50 private static volatile boolean signalled;
51 private static final Lock lock = new ReentrantLock();
52 private static final Condition cond = lock.newCondition();
53
54 private static void waitFor(long timeout, TimeUnit timeUnit) throws InterruptedException {
55 try {
56 lock.lock();
57 if (!signalled) {
58 log("Waiting for FlightRecorder.recorderInitialized notification...");
59 cond.await(timeout, timeUnit);
|
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.api.flightrecorder;
27 import static jdk.test.lib.Asserts.assertTrue;
28
29 import java.util.concurrent.TimeUnit;
30 import java.util.concurrent.locks.Condition;
31 import java.util.concurrent.locks.Lock;
32 import java.util.concurrent.locks.ReentrantLock;
33
34 import jdk.jfr.FlightRecorder;
35 import jdk.jfr.FlightRecorderListener;
36
37 /**
38 * @test
39 * @key jfr
40 * @requires vm.hasJFR
41 * @library /test/lib
42 * @run main/othervm jdk.jfr.api.flightrecorder.TestFlightRecorderListenerRecorderInitialized
43 */
44 public class TestFlightRecorderListenerRecorderInitialized {
45
46 /**
47 * Utility class to wait/notify
48 */
49 private static class Signal {
50
51 private static volatile boolean signalled;
52 private static final Lock lock = new ReentrantLock();
53 private static final Condition cond = lock.newCondition();
54
55 private static void waitFor(long timeout, TimeUnit timeUnit) throws InterruptedException {
56 try {
57 lock.lock();
58 if (!signalled) {
59 log("Waiting for FlightRecorder.recorderInitialized notification...");
60 cond.await(timeout, timeUnit);
|