test/java/rmi/testlibrary/ActivationLibrary.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2006, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1998, 2012, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 167,207 **** } } return false; } - /** - * Check to see if an arry of Strings contains a given string. - */ - private static boolean - containsString(String[] strings, String contained) - { - if (strings == null) { - if (contained == null) { - return true; - } - return false; - } - - for (int i = 0 ; i < strings.length ; i ++ ) { - if ((strings[i] != null) && - (strings[i].indexOf(contained) >= 0)) - { - return true; - } - } - return false; - } - /** cleanup after rmid */ public static void rmidCleanup(RMID rmid) { - rmidCleanup(rmid, TestLibrary.RMID_PORT); - } - - public static void rmidCleanup(RMID rmid, int port) { if (rmid != null) { ! if (!ActivationLibrary.safeDestroy(rmid, port, SAFE_WAIT_TIME)) { TestLibrary.bomb("rmid not destroyed in: " + SAFE_WAIT_TIME + " milliseconds"); } } --- 167,180 ---- } } return false; } /** cleanup after rmid */ public static void rmidCleanup(RMID rmid) { if (rmid != null) { ! if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) { TestLibrary.bomb("rmid not destroyed in: " + SAFE_WAIT_TIME + " milliseconds"); } }
*** 213,224 **** * to hang. * * @return whether or not shutdown completed succesfully in the * timeAllowed */ ! private static boolean safeDestroy(RMID rmid, int port, long timeAllowed) { ! DestroyThread destroyThread = new DestroyThread(rmid, port); destroyThread.start(); try { destroyThread.join(timeAllowed); } catch (InterruptedException ie) { --- 186,197 ---- * to hang. * * @return whether or not shutdown completed succesfully in the * timeAllowed */ ! private static boolean safeDestroy(RMID rmid, long timeAllowed) { ! DestroyThread destroyThread = new DestroyThread(rmid); destroyThread.start(); try { destroyThread.join(timeAllowed); } catch (InterruptedException ie) {
*** 234,246 **** private static class DestroyThread extends Thread { private final RMID rmid; private final int port; private boolean succeeded = false; ! DestroyThread(RMID rmid, int port) { this.rmid = rmid; ! this.port = port; this.setDaemon(true); } public void run() { if (ActivationLibrary.rmidRunning(port)) { --- 207,219 ---- private static class DestroyThread extends Thread { private final RMID rmid; private final int port; private boolean succeeded = false; ! DestroyThread(RMID rmid) { this.rmid = rmid; ! this.port = rmid.getPort(); this.setDaemon(true); } public void run() { if (ActivationLibrary.rmidRunning(port)) {