5266N/A * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A /** time safeDestroy should wait before failing on shutdown rmid */ 0N/A * Deactivate an activated Activatable 5325N/A // We do as much as 50 deactivation trials, each separated by 5325N/A // at least 100 milliseconds sleep time (max sleep time of 5 secs). 5325N/A for (
int i =
0; i <
50; i ++) {
5325N/A " milliseconds before next trial");
5325N/A mesg(
"Thread interrupted while trying to deactivate activatable. Exiting deactivation");
0N/A // forcibly unexport the object 5325N/A mesg(
"Unexpected exception. Have to forcibly unexport the object." +
0N/A mesg(
"unable to inactivate after several attempts");
0N/A mesg(
"unexporting object forcibly instead");
0N/A * Simple method call to see if rmid is running. 0N/A * This method intentionally avoids performing a lookup on the 0N/A * activation system. 5325N/A /* We wait as much as a total of 7.5 secs trying to see Rmid running. 5325N/A * We do this by pausing steps of 100 milliseconds (so up to 75 steps), 5325N/A * right after trying to lookup and find RMID running in the other vm. 5325N/A for (
int i =
0; i <=
74; i++) {
0N/A // ignore connect exceptions until we decide rmid is not up 5325N/A /* Activation System still unavailable. 5325N/A * Ignore this since we are just waiting for its availibility. 5325N/A * Just signal unavailibility. 5325N/A mesg(
"Activation System still unavailable after more than " +
5325N/A /* print out other types of exceptions as an FYI. 5325N/A * test should not fail as rmid is likely to be in an 5325N/A * undetermined state at this point. 0N/A mesg(
"caught an exception trying to" +
0N/A " start rmid, last exception was: " +
5325N/A // Waiting for another 100 milliseconds. 5325N/A mesg(
"Thread interrupted while checking if Activation System is running. Exiting check");
0N/A /** cleanup after rmid */ 0N/A * Invoke shutdown on rmid in a way that will not cause a test 0N/A * @return whether or not shutdown completed succesfully in the 0N/A * Thread class to handle the destruction of rmid 0N/A synchronized (
this) {
0N/A // flag that the test was able to shutdown rmid 0N/A mesg(
"tried to shutdown when rmid was not running");