/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6760712
* @summary test the connector server option that causes it not to prevent the
* VM from exiting
* @author Shanliang JIANG, Eamonn McManus
*/
// Test the connector server option that causes it not to prevent the VM
// from exiting. It's tricky to test exactly that, though possible. If
// we're being run from within jtreg, then jtreg has threads of its own
// that will prevent the VM from exiting. What's more it will kill all
// threads that the test created as soon as the main method returns,
// including the ones that would prevent the VM from exiting without the
// special option.
// Here we check that the test code does not create
// any permanent non-daemon threads, by recording the initial set of
// non-daemon threads (including at least one from jtreg), doing our stuff,
// then waiting for there to be no non-daemon threads that were not in
// the initial set.
public class DaemonRMIExporterTest {
env,
"exit normally, otherwise will be blocked forever if the bug is not fixed.");
ok: {
if (nonDaemonThreads.isEmpty())
break ok;
try {
} catch (InterruptedException e) {
throw new AssertionError(e);
}
}
throw new Exception("TEST FAILED: non-daemon threads remain");
}
}
if (n < size) {
break;
}
}
if (!t.isDaemon())
}
return ndThreads;
}
}