/*
* 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 4094891
* @summary unable to retry call if cached connection to server is used
* @library ../../../../java/rmi/testlibrary
* @build TestLibrary JavaVM
*/
/* Fault: Cached connections used for remote invocations exhibited
* failure (sudden EOF or a TCP-related exception) immediately on
* sending a new request. It was then impossible to tell whether the
* connection had managed to transport the request before dying; even
* deserialization of request arguments is non-idempotent in general.
*
* In fact, this problem cannot be solved generally without rewriting
* the protocol. For now, the common case is the closing of an idle
*
* waiting for delivery. This is a 99%/1% solution, but until the
* great protocol rewrite, it's the best option.
*
* Reproducing is by establishing a connection to a registry and
* killing/restarting that registry (this forces the TCP connection
* to close). The next call to the registry will use the (stale)
* cached connection, and will fail without the bugfix.
*/
public class DeadCachedConnection {
throws Exception {
// establish the registry (we hope)
// Get a handle to the registry
try {
} catch (RemoteException e) {
throw new InternalError ("Can't find registry after starting it.");
}
// Contact the registry by invoking something on it.
// Kill and restart the registry
// Try again (this is the test)
// we're happy
try {
}
}
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 {
}
}
public static void killRegistry() {
}
}
}