/*
* 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 4120329
* @summary RMI registry creation is impossible if first attempt fails.
* @library ../../testlibrary
* @build TestLibrary JavaVM RegistryRunner RegistryRunner_Stub
*/
/*
* If a VM could not create an RMI registry because another registry
* usually in another process, was using the registry port, the next
* time the VM tried to create a registry (after the other registry
* was brought down) the attempt would fail. The second try to create
* a registry would fail because the registry ObjID would still be in
* use when it should never have been allocated.
*
* The test creates this conflict using Runtime.exec and ensures that
* a registry can still be created after the conflict is resolved.
*/
public class Reexport {
try {
// establish the registry (we hope)
// Get a handle to the registry
}
// Kill the first registry.
try {
}
// start another registry now that the first is gone; this should work
"registry... this should work");
}
} catch (Exception e) {
TestLibrary.bomb(e);
} finally {
// dont leave the registry around to affect other tests.
}
}
try {
} catch (Throwable e) {
if (remoteOk) {
e.printStackTrace();
} else {
}
}
return reg;
}
public static void makeRegistry(int p) {
// sadly, we can't kill a registry if we have too-close control
// over it. We must make it in a subprocess, and then kill the
// subprocess when it has served our needs.
try {
} catch (IOException e) {
// one of these is summarily dropped, can't remember which one
}
// Slop - wait for registry to come up. This is stupid.
try {
}
}
try {
} catch (InterruptedException ie) {
}
}
}
}