/*
* 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 4308492
* @summary In addition to keeping the VM alive (with a non-daeman thread)
* while there are remote objects exported, the RMI runtime should also
* keep it alive while there remain calls in progress (to remote objects
* the have presumably been unexported), so that a remote object can more
* conveniently implement a graceful remote shutdown method (that unexports
* the object).
* @author Peter Jones
*
* @library ../../../testlibrary
* @build TestLibrary JavaVM KeepAliveDuringCall_Stub
* ShutdownMonitor Shutdown ShutdownImpl ShutdownImpl_Stub
*/
private boolean stillAlive = false;
synchronized (lock) {
}
}
public void declareStillAlive() {
synchronized (lock) {
stillAlive = true;
}
}
try {
(new JavaVM("ShutdownImpl",
"-Drmi.registry.port=" +
Shutdown s;
"waiting for submission of object to shutdown...");
}
if (s == null) {
throw new RuntimeException(
"TEST FAILED: timeout waiting for shutdown object " +
"to make initial contact");
}
}
try {
s.shutdown();
} catch (RemoteException e) {
throw new RuntimeException(
"TEST FAILED: shutdown method threw remote exception", e);
}
if (!obj.stillAlive) {
throw new RuntimeException("TEST FAILED: " +
"shutdown object not detected alive after unexport");
}
}
"shutdown object detected still alive after unexport");
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(
"TEST FAILED: unexpected exception", e);
}
} finally {
try {
} catch (RemoteException e) {
}
}
}
}