--- old/test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent/SimpleAgent.java 2020-07-26 22:10:07.525583693 -0700 +++ new/test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent/SimpleAgent.java 2020-07-26 22:10:07.213571948 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,29 @@ */ import java.lang.instrument.Instrumentation; -public class SimpleAgent { +public class SimpleAgent implements Runnable { public static void premain(String agentArg, Instrumentation instrumentation) { System.out.println("inside SimpleAgent"); + + Thread t = new Thread(new SimpleAgent()); + t.setDaemon(true); + t.start(); + } + + // Test for JDK-8249276: make sure we can handle objects that are locked during + // -Xshare:dump + public void run() { + try { + while (true) { + System.out.println("Let's wait ....."); + synchronized (Object.class) { + Object.class.wait(); + } + System.out.println("Huh?? notified??"); + } + } catch (Throwable t) { + System.err.println("Unexpected: " + t); + throw new RuntimeException(t); + } } }