6627823: Missed whitespace normalization files: jdk/test/java/rmi
Summary: Just missed a few files being normalized in rev 0.
Reviewed-by: xdono
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -49,116 +49,116 @@
public class CreatePrivateActivatable
{
private static class PrivateActivatable extends Activatable
- implements ActivateMe, Runnable
+ implements ActivateMe, Runnable
{
- private PrivateActivatable(ActivationID id, MarshalledObject obj)
- throws ActivationException, RemoteException
- {
- super(id, 0);
- }
+ private PrivateActivatable(ActivationID id, MarshalledObject obj)
+ throws ActivationException, RemoteException
+ {
+ super(id, 0);
+ }
- public void ping()
- {}
+ public void ping()
+ {}
- /**
- * Spawns a thread to deactivate the object.
- */
- public void shutdown() throws Exception
- {
- (new Thread(this, "CreatePrivateActivatable$PrivateActivatable")).start();
- }
+ /**
+ * Spawns a thread to deactivate the object.
+ */
+ public void shutdown() throws Exception
+ {
+ (new Thread(this, "CreatePrivateActivatable$PrivateActivatable")).start();
+ }
- /**
- * Thread to deactivate object. First attempts to make object
- * inactive (via the inactive method). If that fails (the
- * object may still have pending/executing calls), then
- * unexport the object forcibly.
- */
- public void run() {
- ActivationLibrary.deactivate(this, getID());
- }
+ /**
+ * Thread to deactivate object. First attempts to make object
+ * inactive (via the inactive method). If that fails (the
+ * object may still have pending/executing calls), then
+ * unexport the object forcibly.
+ */
+ public void run() {
+ ActivationLibrary.deactivate(this, getID());
+ }
}
-
+
public static void main(String[] args) {
- /*
- * The following line is required with the JDK 1.2 VM so that the
- * VM can exit gracefully when this test completes. Otherwise, the
- * conservative garbage collector will find a handle to the server
- * object on the native stack and not clear the weak reference to
- * it in the RMI runtime's object table.
- */
- Object dummy = new Object();
- RMID rmid = null;
- ActivateMe obj;
+ /*
+ * The following line is required with the JDK 1.2 VM so that the
+ * VM can exit gracefully when this test completes. Otherwise, the
+ * conservative garbage collector will find a handle to the server
+ * object on the native stack and not clear the weak reference to
+ * it in the RMI runtime's object table.
+ */
+ Object dummy = new Object();
+ RMID rmid = null;
+ ActivateMe obj;
- System.err.println("\nRegression test for bug 4164971\n");
- System.err.println("java.security.policy = " +
- System.getProperty("java.security.policy", "no policy"));
+ System.err.println("\nRegression test for bug 4164971\n");
+ System.err.println("java.security.policy = " +
+ System.getProperty("java.security.policy", "no policy"));
- CreatePrivateActivatable server;
- try {
- TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
+ CreatePrivateActivatable server;
+ try {
+ TestLibrary.suggestSecurityManager(TestParams.defaultSecurityManager);
+
+ // start an rmid.
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ rmid.start();
- // start an rmid.
- RMID.removeLog();
- rmid = RMID.createRMID();
- rmid.start();
-
- /* Cause activation groups to have a security policy that will
- * allow security managers to be downloaded and installed
- */
- Properties p = new Properties();
- // this test must always set policies/managers in its
- // activation groups
- p.put("java.security.policy",
- TestParams.defaultGroupPolicy);
- p.put("java.security.manager",
- TestParams.defaultSecurityManager);
-
- /*
- * Activate an object by registering its object
- * descriptor and invoking a method on the
- * stub returned from the register call.
- */
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(p, null);
- ActivationSystem system = ActivationGroup.getSystem();
- ActivationGroupID groupID = system.registerGroup(groupDesc);
+ /* Cause activation groups to have a security policy that will
+ * allow security managers to be downloaded and installed
+ */
+ Properties p = new Properties();
+ // this test must always set policies/managers in its
+ // activation groups
+ p.put("java.security.policy",
+ TestParams.defaultGroupPolicy);
+ p.put("java.security.manager",
+ TestParams.defaultSecurityManager);
+
+ /*
+ * Activate an object by registering its object
+ * descriptor and invoking a method on the
+ * stub returned from the register call.
+ */
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(p, null);
+ ActivationSystem system = ActivationGroup.getSystem();
+ ActivationGroupID groupID = system.registerGroup(groupDesc);
+
+ System.err.println("Creating descriptor");
+ ActivationDesc desc =
+ new ActivationDesc(groupID,
+ "CreatePrivateActivatable$PrivateActivatable",
+ null, null);
- System.err.println("Creating descriptor");
- ActivationDesc desc =
- new ActivationDesc(groupID,
- "CreatePrivateActivatable$PrivateActivatable",
- null, null);
-
- System.err.println("Registering descriptor");
- obj = (ActivateMe) Activatable.register(desc);
-
- /*
- * Loop a bunch of times to force activator to
- * spawn VMs (groups)
- */
- System.err.println("Activate object via method call");
- obj.ping();
-
- /*
- * Clean up object too.
- */
- System.err.println("Deactivate object via method call");
- obj.shutdown();
-
- System.err.println("\nsuccess: CreatePrivateActivatable test passed ");
-
- } catch (Exception e) {
- if (e instanceof java.security.PrivilegedActionException) {
- e = ((java.security.PrivilegedActionException)e).getException();
- }
- TestLibrary.bomb("\nfailure: unexpected exception " +
- e.getClass().getName(), e);
-
- } finally {
- ActivationLibrary.rmidCleanup(rmid);
- obj = null;
- }
+ System.err.println("Registering descriptor");
+ obj = (ActivateMe) Activatable.register(desc);
+
+ /*
+ * Loop a bunch of times to force activator to
+ * spawn VMs (groups)
+ */
+ System.err.println("Activate object via method call");
+ obj.ping();
+
+ /*
+ * Clean up object too.
+ */
+ System.err.println("Deactivate object via method call");
+ obj.shutdown();
+
+ System.err.println("\nsuccess: CreatePrivateActivatable test passed ");
+
+ } catch (Exception e) {
+ if (e instanceof java.security.PrivilegedActionException) {
+ e = ((java.security.PrivilegedActionException)e).getException();
+ }
+ TestLibrary.bomb("\nfailure: unexpected exception " +
+ e.getClass().getName(), e);
+
+ } finally {
+ ActivationLibrary.rmidCleanup(rmid);
+ obj = null;
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -24,10 +24,10 @@
/* @test
* @bug 4097135
* @summary Need a specific subtype of RemoteException for activation failure.
- * If activation fails to happen during a call to a remote object,
- * then the call should end in an ActivateFailedException. In this
- * test, the actual "activatable" remote object fails to activate
- * since its * "activation" constructor throws an exception.
+ * If activation fails to happen during a call to a remote object,
+ * then the call should end in an ActivateFailedException. In this
+ * test, the actual "activatable" remote object fails to activate
+ * since its * "activation" constructor throws an exception.
* @author Ann Wollrath
*
* @library ../../../testlibrary
@@ -46,128 +46,127 @@
import java.util.Properties;
public class ActivateFails
- extends Activatable
- implements ActivateMe
+ extends Activatable
+ implements ActivateMe
{
public ActivateFails(ActivationID id, MarshalledObject obj)
- throws ActivationException, RemoteException
+ throws ActivationException, RemoteException
{
- super(id, 0);
+ super(id, 0);
- boolean refuseToActivate = false;
- try {
- refuseToActivate = ((Boolean)obj.get()).booleanValue();
- } catch (Exception impossible) {
- }
-
- if (refuseToActivate)
- throw new RemoteException("object refuses to activate");
+ boolean refuseToActivate = false;
+ try {
+ refuseToActivate = ((Boolean)obj.get()).booleanValue();
+ } catch (Exception impossible) {
+ }
+
+ if (refuseToActivate)
+ throw new RemoteException("object refuses to activate");
}
public void ping()
{}
-
+
/**
* Spawns a thread to deactivate the object.
*/
public ShutdownThread shutdown() throws Exception
{
- ShutdownThread shutdownThread = new ShutdownThread(this, getID());
- shutdownThread.start();
- return(shutdownThread);
+ ShutdownThread shutdownThread = new ShutdownThread(this, getID());
+ shutdownThread.start();
+ return(shutdownThread);
}
-
- public static void main(String[] args)
+
+ public static void main(String[] args)
{
- RMID rmid = null;
- ActivateMe obj1, obj2;
- ShutdownThread shutdownThread;
-
- System.err.println("\nRegression test for bug 4097135\n");
- try {
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ RMID rmid = null;
+ ActivateMe obj1, obj2;
+ ShutdownThread shutdownThread;
+
+ System.err.println("\nRegression test for bug 4097135\n");
+ try {
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+
+ /*
+ * First run "rmid" and wait for it to start up.
+ */
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ rmid.start();
- /*
- * First run "rmid" and wait for it to start up.
- */
- RMID.removeLog();
- rmid = RMID.createRMID();
- rmid.start();
+ /* Cause activation groups to have a security policy that will
+ * allow security managers to be downloaded and installed
+ */
+ Properties p = new Properties();
+ // this test must always set policies/managers in its
+ // activation groups
+ p.put("java.security.policy",
+ TestParams.defaultGroupPolicy);
+ p.put("java.security.manager",
+ TestParams.defaultSecurityManager);
- /* Cause activation groups to have a security policy that will
- * allow security managers to be downloaded and installed
- */
- Properties p = new Properties();
- // this test must always set policies/managers in its
- // activation groups
- p.put("java.security.policy",
- TestParams.defaultGroupPolicy);
- p.put("java.security.manager",
- TestParams.defaultSecurityManager);
+ /*
+ * Create activation descriptor...
+ */
+ System.err.println("creating activation descriptor...");
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(p, null);
+ ActivationGroupID groupID =
+ ActivationGroup.getSystem().registerGroup(groupDesc);
+
+ ActivationDesc desc1 =
+ new ActivationDesc(groupID, "ActivateFails",
+ null,
+ new MarshalledObject(new Boolean(true)));
- /*
- * Create activation descriptor...
- */
- System.err.println("creating activation descriptor...");
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(p, null);
- ActivationGroupID groupID =
- ActivationGroup.getSystem().registerGroup(groupDesc);
-
- ActivationDesc desc1 =
- new ActivationDesc(groupID, "ActivateFails",
- null,
- new MarshalledObject(new Boolean(true)));
-
- ActivationDesc desc2 =
- new ActivationDesc(groupID, "ActivateFails",
- null,
- new MarshalledObject(new Boolean(false)));
- /*
- * Register activation descriptor and make a call on
- * the stub. Activation should fail with an
- * ActivateFailedException. If not, report an
- * error as a RuntimeException
- */
+ ActivationDesc desc2 =
+ new ActivationDesc(groupID, "ActivateFails",
+ null,
+ new MarshalledObject(new Boolean(false)));
+ /*
+ * Register activation descriptor and make a call on
+ * the stub. Activation should fail with an
+ * ActivateFailedException. If not, report an
+ * error as a RuntimeException
+ */
- System.err.println("registering activation descriptor...");
- obj1 = (ActivateMe)Activatable.register(desc1);
- obj2 = (ActivateMe)Activatable.register(desc2);
+ System.err.println("registering activation descriptor...");
+ obj1 = (ActivateMe)Activatable.register(desc1);
+ obj2 = (ActivateMe)Activatable.register(desc2);
+
+ System.err.println("invoking method on activatable object...");
+ try {
+ obj1.ping();
+
+ } catch (ActivateFailedException e) {
- System.err.println("invoking method on activatable object...");
- try {
- obj1.ping();
-
- } catch (ActivateFailedException e) {
+ /*
+ * This is what is expected so exit with status 0
+ */
+ System.err.println("\nsuccess: ActivateFailedException " +
+ "generated");
+ e.getMessage();
+ }
- /*
- * This is what is expected so exit with status 0
- */
- System.err.println("\nsuccess: ActivateFailedException " +
- "generated");
- e.getMessage();
- }
+ obj2.ping();
+ shutdownThread = obj2.shutdown();
- obj2.ping();
- shutdownThread = obj2.shutdown();
+ // wait for shutdown to work
+ Thread.sleep(2000);
- // wait for shutdown to work
- Thread.sleep(2000);
+ shutdownThread = null;
- shutdownThread = null;
-
- } catch (Exception e) {
- /*
- * Test failed; unexpected exception generated.
- */
- TestLibrary.bomb("\nfailure: unexpected exception " +
- e.getClass().getName() + ": " + e.getMessage(), e);
-
- } finally {
- obj1 = obj2 = null;
- ActivationLibrary.rmidCleanup(rmid);
- }
+ } catch (Exception e) {
+ /*
+ * Test failed; unexpected exception generated.
+ */
+ TestLibrary.bomb("\nfailure: unexpected exception " +
+ e.getClass().getName() + ": " + e.getMessage(), e);
+
+ } finally {
+ obj1 = obj2 = null;
+ ActivationLibrary.rmidCleanup(rmid);
+ }
}
}
-
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,88 +29,88 @@
implements ActivateMe, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void ping()"),
- new java.rmi.server.Operation("ShutdownThread shutdown()")
+ new java.rmi.server.Operation("void ping()"),
+ new java.rmi.server.Operation("ShutdownThread shutdown()")
};
-
+
private static final long interfaceHash = -6632667923281093978L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_ping_0;
private static java.lang.reflect.Method $method_shutdown_1;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {});
- $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_ping_0 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {});
+ $method_shutdown_1 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public ActivateFails_Stub() {
- super();
+ super();
}
public ActivateFails_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of ping()
public void ping()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of shutdown()
public ShutdownThread shutdown()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_shutdown_1, null, -3616843253114182719L);
- return ((ShutdownThread) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- ref.invoke(call);
- ShutdownThread $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (ShutdownThread) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_shutdown_1, null, -3616843253114182719L);
+ return ((ShutdownThread) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ ref.invoke(call);
+ ShutdownThread $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (ShutdownThread) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateMe.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateMe.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ShutdownThread.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ShutdownThread.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,21 +31,20 @@
ActivationID activationID = null;
public ShutdownThread(Remote remoteObject, ActivationID activationID) {
- remoteObject = remoteObject;
- activationID = activationID;
+ remoteObject = remoteObject;
+ activationID = activationID;
}
public void run() {
- try {
+ try {
- Activatable.unexportObject(remoteObject, true);
- Activatable.inactive(activationID);
+ Activatable.unexportObject(remoteObject, true);
+ Activatable.inactive(activationID);
- } catch (Exception e) {
- }
+ } catch (Exception e) {
+ }
}
}
-
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4510355
+ * @bug 4510355
* @summary ActivationGroup implementations cannot be downloaded by default;
* Creates a custom activation group without setting a security manager
* in activation group's descriptor. The custom activation group
@@ -49,28 +49,28 @@
import java.util.Properties;
public class DownloadActivationGroup
- implements Ping, Runnable
+ implements Ping, Runnable
{
private ActivationID id;
public DownloadActivationGroup(ActivationID id, MarshalledObject mobj)
- throws ActivationException, RemoteException
+ throws ActivationException, RemoteException
{
- this.id = id;
- Activatable.exportObject(this, id, 0);
- System.err.println("object activated in group");
+ this.id = id;
+ Activatable.exportObject(this, id, 0);
+ System.err.println("object activated in group");
}
public DownloadActivationGroup() throws RemoteException {
- UnicastRemoteObject.exportObject(this, 0);
+ UnicastRemoteObject.exportObject(this, 0);
}
/**
* Used to activate object.
*/
public void ping() {
- System.err.println("received ping");
+ System.err.println("received ping");
}
/**
@@ -79,87 +79,87 @@
*/
public void shutdown() throws Exception
{
- (new Thread(this,"DownloadActivationGroup")).start();
+ (new Thread(this,"DownloadActivationGroup")).start();
}
/**
* Thread to deactivate object.
*/
public void run() {
- ActivationLibrary.deactivate(this, getID());
+ ActivationLibrary.deactivate(this, getID());
}
-
+
public ActivationID getID() {
- return id;
+ return id;
}
public static void main(String[] args) {
- RMID rmid = null;
-
- System.out.println("\nRegression test for bug 4510355\n");
-
- try {
- TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
+ RMID rmid = null;
+
+ System.out.println("\nRegression test for bug 4510355\n");
+
+ try {
+ TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
+
+ /*
+ * Install group class file in codebase.
+ */
+ System.err.println("install class file in codebase");
+ URL groupURL = TestLibrary.installClassInCodebase(
+ "MyActivationGroupImpl", "group");
+ System.err.println("class file installed");
- /*
- * Install group class file in codebase.
- */
- System.err.println("install class file in codebase");
- URL groupURL = TestLibrary.installClassInCodebase(
- "MyActivationGroupImpl", "group");
- System.err.println("class file installed");
+ /*
+ * Start rmid.
+ */
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none";
+ rmid.addOptions(new String[] { execPolicyOption });
+ rmid.start();
- /*
- * Start rmid.
- */
- RMID.removeLog();
- rmid = RMID.createRMID();
- String execPolicyOption = "-Dsun.rmi.activation.execPolicy=none";
- rmid.addOptions(new String[] { execPolicyOption });
- rmid.start();
+ /*
+ * Create and register descriptors for custom group and an
+ * activatable object in that group.
+ */
+ System.err.println("register group");
- /*
- * Create and register descriptors for custom group and an
- * activatable object in that group.
- */
- System.err.println("register group");
-
- Properties p = new Properties();
- p.put("java.security.policy", TestParams.defaultGroupPolicy);
-
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc("MyActivationGroupImpl",
- groupURL.toExternalForm(),
- null, p, null);
- ActivationGroupID groupID =
- ActivationGroup.getSystem().registerGroup(groupDesc);
-
-
- System.err.println("register activatable object");
- ActivationDesc desc =
- new ActivationDesc(groupID, "DownloadActivationGroup",
- null, null);
- Ping obj = (Ping) Activatable.register(desc);
+ Properties p = new Properties();
+ p.put("java.security.policy", TestParams.defaultGroupPolicy);
+
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc("MyActivationGroupImpl",
+ groupURL.toExternalForm(),
+ null, p, null);
+ ActivationGroupID groupID =
+ ActivationGroup.getSystem().registerGroup(groupDesc);
+
+
+ System.err.println("register activatable object");
+ ActivationDesc desc =
+ new ActivationDesc(groupID, "DownloadActivationGroup",
+ null, null);
+ Ping obj = (Ping) Activatable.register(desc);
- /*
- * Start group (by calling ping).
- */
- System.err.println(
- "ping object (forces download of group's class)");
- obj.ping();
- System.err.println(
- "TEST PASSED: group's class downloaded successfully");
- System.err.println("shutdown object");
- obj.shutdown();
- System.err.println("TEST PASSED");
+ /*
+ * Start group (by calling ping).
+ */
+ System.err.println(
+ "ping object (forces download of group's class)");
+ obj.ping();
+ System.err.println(
+ "TEST PASSED: group's class downloaded successfully");
+ System.err.println("shutdown object");
+ obj.shutdown();
+ System.err.println("TEST PASSED");
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- ActivationLibrary.rmidCleanup(rmid);
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ ActivationLibrary.rmidCleanup(rmid);
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,46 +29,46 @@
implements Ping
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_ping_0;
private static java.lang.reflect.Method $method_shutdown_1;
-
+
static {
- try {
- $method_ping_0 = Ping.class.getMethod("ping", new java.lang.Class[] {});
- $method_shutdown_1 = Ping.class.getMethod("shutdown", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_ping_0 = Ping.class.getMethod("ping", new java.lang.Class[] {});
+ $method_shutdown_1 = Ping.class.getMethod("shutdown", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public DownloadActivationGroup_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of ping()
public void ping()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of shutdown()
public void shutdown()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L);
+ ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L);
}
}
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/MyActivationGroupImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/MyActivationGroupImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,11 +27,11 @@
public class MyActivationGroupImpl extends ActivationGroupImpl {
-
+
public MyActivationGroupImpl(ActivationGroupID id, MarshalledObject mobj)
- throws RemoteException, ActivationException
+ throws RemoteException, ActivationException
{
- super(id, mobj);
- System.err.println("custom group implementation created");
+ super(id, mobj);
+ System.err.println("custom group implementation created");
}
}
--- a/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -42,19 +42,19 @@
*/
public class CheckDefaultGroupName {
public static void main(String[] args) {
- System.out.println("\n\nRegression test for, 4252236\n\n");
+ System.out.println("\n\nRegression test for, 4252236\n\n");
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(null, null);
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(null, null);
- String className = groupDesc.getClassName();
- if (className != null) {
- TestLibrary.bomb("ActivationGroupDesc had incorrect default" +
- " group implementation class name: " + className);
- } else {
- System.err.println("test passed, had correct default group" +
- " implementation class name: " + className +
- "\n\n");
- }
+ String className = groupDesc.getClassName();
+ if (className != null) {
+ TestLibrary.bomb("ActivationGroupDesc had incorrect default" +
+ " group implementation class name: " + className);
+ } else {
+ System.err.println("test passed, had correct default group" +
+ " implementation class name: " + className +
+ "\n\n");
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -49,81 +49,81 @@
import java.rmi.server.UnicastRemoteObject;
public class IdempotentActiveGroup {
-
+
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4720528\n");
-
- TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
- RMID rmid = null;
- ActivationInstantiator inst1 = null;
- ActivationInstantiator inst2 = null;
-
- try {
- RMID.removeLog();
- rmid = RMID.createRMID();
- rmid.start();
+ System.err.println("\nRegression test for bug 4720528\n");
+
+ TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
+ RMID rmid = null;
+ ActivationInstantiator inst1 = null;
+ ActivationInstantiator inst2 = null;
+
+ try {
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ rmid.start();
- System.err.println("Create group descriptor");
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(null, null);
- ActivationSystem system = ActivationGroup.getSystem();
- System.err.println("Register group descriptor");
- ActivationGroupID groupID = system.registerGroup(groupDesc);
- inst1 = new FakeInstantiator();
- inst2 = new FakeInstantiator();
-
- System.err.println("Invoke activeGroup with inst1");
- system.activeGroup(groupID, inst1, 0);
+ System.err.println("Create group descriptor");
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(null, null);
+ ActivationSystem system = ActivationGroup.getSystem();
+ System.err.println("Register group descriptor");
+ ActivationGroupID groupID = system.registerGroup(groupDesc);
+ inst1 = new FakeInstantiator();
+ inst2 = new FakeInstantiator();
+
+ System.err.println("Invoke activeGroup with inst1");
+ system.activeGroup(groupID, inst1, 0);
- try {
- System.err.println("Invoke activeGroup with inst2");
- system.activeGroup(groupID, inst2, 0);
- throw new RuntimeException(
- "TEST FAILED: activeGroup with unequal groups succeeded!");
- } catch (ActivationException expected) {
- System.err.println("Caught expected ActivationException");
- System.err.println("Test 1 (of 2) passed");
- }
+ try {
+ System.err.println("Invoke activeGroup with inst2");
+ system.activeGroup(groupID, inst2, 0);
+ throw new RuntimeException(
+ "TEST FAILED: activeGroup with unequal groups succeeded!");
+ } catch (ActivationException expected) {
+ System.err.println("Caught expected ActivationException");
+ System.err.println("Test 1 (of 2) passed");
+ }
- try {
- System.err.println("Invoke activeGroup with inst1");
- system.activeGroup(groupID, inst1, 0);
- System.err.println("activeGroup call succeeded");
- System.err.println("Test 2 (of 2) passed");
- } catch (ActivationException unexpected) {
- throw new RuntimeException(
- "TEST FAILED: activeGroup with equal groups failed!",
- unexpected);
- }
-
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
- } finally {
- try {
- if (inst1 != null) {
- UnicastRemoteObject.unexportObject(inst1, true);
- }
- if (inst2 != null) {
- UnicastRemoteObject.unexportObject(inst2, true);
- }
- } catch (NoSuchObjectException unexpected) {
- throw new AssertionError(unexpected);
- }
- ActivationLibrary.rmidCleanup(rmid);
- }
+ try {
+ System.err.println("Invoke activeGroup with inst1");
+ system.activeGroup(groupID, inst1, 0);
+ System.err.println("activeGroup call succeeded");
+ System.err.println("Test 2 (of 2) passed");
+ } catch (ActivationException unexpected) {
+ throw new RuntimeException(
+ "TEST FAILED: activeGroup with equal groups failed!",
+ unexpected);
+ }
+
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
+ } finally {
+ try {
+ if (inst1 != null) {
+ UnicastRemoteObject.unexportObject(inst1, true);
+ }
+ if (inst2 != null) {
+ UnicastRemoteObject.unexportObject(inst2, true);
+ }
+ } catch (NoSuchObjectException unexpected) {
+ throw new AssertionError(unexpected);
+ }
+ ActivationLibrary.rmidCleanup(rmid);
+ }
}
private static class FakeInstantiator
- extends UnicastRemoteObject
- implements ActivationInstantiator
+ extends UnicastRemoteObject
+ implements ActivationInstantiator
{
- FakeInstantiator() throws RemoteException {}
+ FakeInstantiator() throws RemoteException {}
- public MarshalledObject newInstance(ActivationID id,
- ActivationDesc desc)
- {
- throw new AssertionError();
- }
+ public MarshalledObject newInstance(ActivationID id,
+ ActivationDesc desc)
+ {
+ throw new AssertionError();
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ActivateMe.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ActivateMe.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,7 @@
* @bug 4127754
*
* @summary synopsis: need to modify registered ActivationDesc and
- * ActivationGroupDesc
+ * ActivationGroupDesc
* @author Ann Wollrath
*
* @library ../../../testlibrary
@@ -43,7 +43,7 @@
import java.util.*;
public class ModifyDescriptor
- implements ActivateMe, Runnable
+ implements ActivateMe, Runnable
{
private ActivationID id;
@@ -54,28 +54,28 @@
public ModifyDescriptor(ActivationID id, MarshalledObject mobj)
- throws ActivationException, RemoteException
+ throws ActivationException, RemoteException
{
- this.id = id;
- Activatable.exportObject(this, id, 0);
-
- try {
- message = (String) mobj.get();
- } catch (Exception e) {
- System.err.println("unable to get message from marshalled object");
- }
+ this.id = id;
+ Activatable.exportObject(this, id, 0);
+
+ try {
+ message = (String) mobj.get();
+ } catch (Exception e) {
+ System.err.println("unable to get message from marshalled object");
+ }
}
public String getMessage() {
- return message;
+ return message;
}
public String getProperty(String name) {
- return TestLibrary.getProperty(name, null);
+ return TestLibrary.getProperty(name, null);
}
public ActivationID getID() {
- return id;
+ return id;
}
/**
@@ -83,7 +83,7 @@
*/
public void shutdown() throws Exception
{
- (new Thread(this,"ModifyDescriptor")).start();
+ (new Thread(this,"ModifyDescriptor")).start();
}
/**
@@ -93,165 +93,165 @@
* unexport the object forcibly.
*/
public void run() {
- ActivationLibrary.deactivate(this, getID());
+ ActivationLibrary.deactivate(this, getID());
}
-
+
public static void main(String[] args) {
- System.out.println("\nRegression test for bug 4127754\n");
-
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ System.out.println("\nRegression test for bug 4127754\n");
+
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+
+ RMID rmid = null;
- RMID rmid = null;
-
- try {
- RMID.removeLog();
- rmid = RMID.createRMID();
- rmid.start();
+ try {
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ rmid.start();
- /*
- * Create and register a group and activatable object
- */
+ /*
+ * Create and register a group and activatable object
+ */
- System.err.println("Creating group descriptor");
- Properties props = new Properties();
- props.put("java.security.policy",
- TestParams.defaultGroupPolicy);
- props.put("java.security.manager",
- TestParams.defaultSecurityManager);
- props.put("test.message", MESSAGE1);
- ActivationGroupDesc initialGroupDesc =
- new ActivationGroupDesc(props, null);
- System.err.println("Registering group");
- ActivationSystem system = ActivationGroup.getSystem();
- ActivationGroupID groupID = system.registerGroup(initialGroupDesc);
-
- System.err.println("Creating descriptor");
- ActivationDesc initialDesc =
- new ActivationDesc(groupID, "ModifyDescriptor", null,
- new MarshalledObject(MESSAGE1), false);
-
- System.err.println("Registering descriptor");
- ActivateMe obj = (ActivateMe) Activatable.register(initialDesc);
+ System.err.println("Creating group descriptor");
+ Properties props = new Properties();
+ props.put("java.security.policy",
+ TestParams.defaultGroupPolicy);
+ props.put("java.security.manager",
+ TestParams.defaultSecurityManager);
+ props.put("test.message", MESSAGE1);
+ ActivationGroupDesc initialGroupDesc =
+ new ActivationGroupDesc(props, null);
+ System.err.println("Registering group");
+ ActivationSystem system = ActivationGroup.getSystem();
+ ActivationGroupID groupID = system.registerGroup(initialGroupDesc);
+
+ System.err.println("Creating descriptor");
+ ActivationDesc initialDesc =
+ new ActivationDesc(groupID, "ModifyDescriptor", null,
+ new MarshalledObject(MESSAGE1), false);
+
+ System.err.println("Registering descriptor");
+ ActivateMe obj = (ActivateMe) Activatable.register(initialDesc);
- /*
- * Ping object and verify that MarshalledObject is okay.
- */
- System.err.println("Ping object");
- String message1 = obj.getMessage();
- System.err.println("message = " + message1);
+ /*
+ * Ping object and verify that MarshalledObject is okay.
+ */
+ System.err.println("Ping object");
+ String message1 = obj.getMessage();
+ System.err.println("message = " + message1);
- if (message1.equals(MESSAGE1)) {
- System.err.println("Test1a passed: initial MarshalledObject " +
- "correct");
- } else {
- TestLibrary.bomb("Test1 failed: unexpected MarshalledObject passed to " +
- "constructor", null);
- }
+ if (message1.equals(MESSAGE1)) {
+ System.err.println("Test1a passed: initial MarshalledObject " +
+ "correct");
+ } else {
+ TestLibrary.bomb("Test1 failed: unexpected MarshalledObject passed to " +
+ "constructor", null);
+ }
- /*
- * Get property from remote group and make sure it's okay
- */
- message1 = obj.getProperty("test.message");
- if (message1.equals(MESSAGE1)) {
- System.err.println("Test1b passed: initial group property " +
- "correct");
- } else {
- TestLibrary.bomb("Test1 failed: unexpected property passed to " +
- "group", null);
- }
+ /*
+ * Get property from remote group and make sure it's okay
+ */
+ message1 = obj.getProperty("test.message");
+ if (message1.equals(MESSAGE1)) {
+ System.err.println("Test1b passed: initial group property " +
+ "correct");
+ } else {
+ TestLibrary.bomb("Test1 failed: unexpected property passed to " +
+ "group", null);
+ }
- /*
- * Update activation descriptor for object and group
- */
- System.err.println("Update activation descriptor");
- ActivationDesc newDesc =
- new ActivationDesc(groupID, "ModifyDescriptor", null,
- new MarshalledObject(MESSAGE2), false);
- ActivationID id = obj.getID();
- ActivationDesc oldDesc = system.setActivationDesc(id, newDesc);
+ /*
+ * Update activation descriptor for object and group
+ */
+ System.err.println("Update activation descriptor");
+ ActivationDesc newDesc =
+ new ActivationDesc(groupID, "ModifyDescriptor", null,
+ new MarshalledObject(MESSAGE2), false);
+ ActivationID id = obj.getID();
+ ActivationDesc oldDesc = system.setActivationDesc(id, newDesc);
- if (oldDesc.equals(initialDesc)) {
- System.err.println("Test2a passed: desc returned from " +
- "setActivationDesc is okay");
- } else {
- TestLibrary.bomb("Test2a failed: desc returned from setActivationDesc " +
- "is not the initial descriptor!", null);
- }
+ if (oldDesc.equals(initialDesc)) {
+ System.err.println("Test2a passed: desc returned from " +
+ "setActivationDesc is okay");
+ } else {
+ TestLibrary.bomb("Test2a failed: desc returned from setActivationDesc " +
+ "is not the initial descriptor!", null);
+ }
- Properties props2 = new Properties();
- props2.put("test.message", MESSAGE2);
- props2.put("java.security.policy",
- TestParams.defaultGroupPolicy);
- props2.put("java.security.manager",
- TestParams.defaultSecurityManager);
- ActivationGroupDesc newGroupDesc =
- new ActivationGroupDesc(props2, null);
+ Properties props2 = new Properties();
+ props2.put("test.message", MESSAGE2);
+ props2.put("java.security.policy",
+ TestParams.defaultGroupPolicy);
+ props2.put("java.security.manager",
+ TestParams.defaultSecurityManager);
+ ActivationGroupDesc newGroupDesc =
+ new ActivationGroupDesc(props2, null);
- ActivationGroupDesc oldGroupDesc =
- system.setActivationGroupDesc(groupID, newGroupDesc);
+ ActivationGroupDesc oldGroupDesc =
+ system.setActivationGroupDesc(groupID, newGroupDesc);
- if (oldGroupDesc.equals(initialGroupDesc)) {
- System.err.println("Test2b passed: group desc returned from " +
- "setActivationGroupDesc is okay");
- } else {
- TestLibrary.bomb("Test2b failed: group desc returned from " +
- "setActivationGroupDesc is not the initial descriptor!",
- null);
- }
-
- /*
- * Restart rmid; and ping object to make sure that it has
- * new message.
- */
- rmid.restart();
+ if (oldGroupDesc.equals(initialGroupDesc)) {
+ System.err.println("Test2b passed: group desc returned from " +
+ "setActivationGroupDesc is okay");
+ } else {
+ TestLibrary.bomb("Test2b failed: group desc returned from " +
+ "setActivationGroupDesc is not the initial descriptor!",
+ null);
+ }
- System.err.println("Ping object after restart");
- String message2 = obj.getMessage();
+ /*
+ * Restart rmid; and ping object to make sure that it has
+ * new message.
+ */
+ rmid.restart();
+
+ System.err.println("Ping object after restart");
+ String message2 = obj.getMessage();
- if (message2.equals(MESSAGE2)) {
- System.err.println("Test3a passed: setActivationDesc takes " +
- "effect after a restart");
- } else {
- TestLibrary.bomb("Test3a failed: setActivationDesc did not take effect " +
- "after a restart", null);
- }
+ if (message2.equals(MESSAGE2)) {
+ System.err.println("Test3a passed: setActivationDesc takes " +
+ "effect after a restart");
+ } else {
+ TestLibrary.bomb("Test3a failed: setActivationDesc did not take effect " +
+ "after a restart", null);
+ }
+
+ message2 = obj.getProperty("test.message");
- message2 = obj.getProperty("test.message");
-
- if (message2.equals(MESSAGE2)) {
- System.err.println("Test3b passed: setActivationGroupDesc " +
- "takes effect after a restart");
- } else {
- TestLibrary.bomb("Test3b failed: setActivationGroupDesc did not take " +
- "effect after a restart", null);
- }
+ if (message2.equals(MESSAGE2)) {
+ System.err.println("Test3b passed: setActivationGroupDesc " +
+ "takes effect after a restart");
+ } else {
+ TestLibrary.bomb("Test3b failed: setActivationGroupDesc did not take " +
+ "effect after a restart", null);
+ }
- System.err.println("Get activation descriptor");
- ActivationDesc latestDesc = system.getActivationDesc(id);
+ System.err.println("Get activation descriptor");
+ ActivationDesc latestDesc = system.getActivationDesc(id);
- if (latestDesc.equals(newDesc)) {
- System.err.println("Test4a passed: desc is same as latest");
- } else {
- TestLibrary.bomb("Test4a failed: there is no way this would happen", null);
- }
+ if (latestDesc.equals(newDesc)) {
+ System.err.println("Test4a passed: desc is same as latest");
+ } else {
+ TestLibrary.bomb("Test4a failed: there is no way this would happen", null);
+ }
- System.err.println("Get activation group descriptor");
- ActivationGroupDesc latestGroupDesc =
- system.getActivationGroupDesc(groupID);
+ System.err.println("Get activation group descriptor");
+ ActivationGroupDesc latestGroupDesc =
+ system.getActivationGroupDesc(groupID);
- if (latestGroupDesc.equals(newGroupDesc)) {
- System.err.println("Test4b passed: group desc is same as " +
- "latest");
- } else {
- TestLibrary.bomb("Test4b failed: there is no way this would happen", null);
- }
-
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
- } finally {
- ActivationLibrary.rmidCleanup(rmid);
- }
+ if (latestGroupDesc.equals(newGroupDesc)) {
+ System.err.println("Test4b passed: group desc is same as " +
+ "latest");
+ } else {
+ TestLibrary.bomb("Test4b failed: there is no way this would happen", null);
+ }
+
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
+ } finally {
+ ActivationLibrary.rmidCleanup(rmid);
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,166 +29,166 @@
implements ActivateMe
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("java.rmi.activation.ActivationID getID()"),
- new java.rmi.server.Operation("java.lang.String getMessage()"),
- new java.rmi.server.Operation("java.lang.String getProperty(java.lang.String)"),
- new java.rmi.server.Operation("void shutdown()")
+ new java.rmi.server.Operation("java.rmi.activation.ActivationID getID()"),
+ new java.rmi.server.Operation("java.lang.String getMessage()"),
+ new java.rmi.server.Operation("java.lang.String getProperty(java.lang.String)"),
+ new java.rmi.server.Operation("void shutdown()")
};
-
+
private static final long interfaceHash = 7998207954486691383L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_getID_0;
private static java.lang.reflect.Method $method_getMessage_1;
private static java.lang.reflect.Method $method_getProperty_2;
private static java.lang.reflect.Method $method_shutdown_3;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_getID_0 = ActivateMe.class.getMethod("getID", new java.lang.Class[] {});
- $method_getMessage_1 = ActivateMe.class.getMethod("getMessage", new java.lang.Class[] {});
- $method_getProperty_2 = ActivateMe.class.getMethod("getProperty", new java.lang.Class[] {java.lang.String.class});
- $method_shutdown_3 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_getID_0 = ActivateMe.class.getMethod("getID", new java.lang.Class[] {});
+ $method_getMessage_1 = ActivateMe.class.getMethod("getMessage", new java.lang.Class[] {});
+ $method_getProperty_2 = ActivateMe.class.getMethod("getProperty", new java.lang.Class[] {java.lang.String.class});
+ $method_shutdown_3 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public ModifyDescriptor_Stub() {
- super();
+ super();
}
public ModifyDescriptor_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of getID()
public java.rmi.activation.ActivationID getID()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getID_0, null, -7795865521150345044L);
- return ((java.rmi.activation.ActivationID) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- java.rmi.activation.ActivationID $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.activation.ActivationID) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getID_0, null, -7795865521150345044L);
+ return ((java.rmi.activation.ActivationID) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ java.rmi.activation.ActivationID $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.rmi.activation.ActivationID) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of getMessage()
public java.lang.String getMessage()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getMessage_1, null, 5353407034680111516L);
- return ((java.lang.String) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- ref.invoke(call);
- java.lang.String $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getMessage_1, null, 5353407034680111516L);
+ return ((java.lang.String) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ ref.invoke(call);
+ java.lang.String $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.String) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of getProperty(String)
public java.lang.String getProperty(java.lang.String $param_String_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getProperty_2, new java.lang.Object[] {$param_String_1}, 77249282285080913L);
- return ((java.lang.String) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.lang.String $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getProperty_2, new java.lang.Object[] {$param_String_1}, 77249282285080913L);
+ return ((java.lang.String) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ java.lang.String $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.String) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of shutdown()
public void shutdown()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- if (useNewInvoke) {
- ref.invoke(this, $method_shutdown_3, null, -7207851917985848402L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
+ if (useNewInvoke) {
+ ref.invoke(this, $method_shutdown_3, null, -7207851917985848402L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/CanCreateStubs.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/CanCreateStubs.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,4 +34,3 @@
Object getForbiddenClass() throws Exception;
ActivationGroupID returnGroupID() throws RemoteException;
}
-
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -20,7 +20,7 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
-
+
/* @test
* @bug 4179055
* @summary Some java apps need to have access to read "accessClassInPackage.sun.rmi.server"
@@ -55,151 +55,151 @@
*
* The test causes the activation system to need to create each of
* these classes in turn. The test will fail if the activation system
- * does not allow these classes to be created.
+ * does not allow these classes to be created.
*/
public class StubClassesPermitted
extends Activatable implements Runnable, CanCreateStubs
{
public static boolean sameGroup = false;
-
+
private static CanCreateStubs canCreateStubs = null;
private static Registry registry = null;
- public static void main(String args[]) {
+ public static void main(String args[]) {
- sameGroup = true;
-
- RMID rmid = null;
+ sameGroup = true;
+
+ RMID rmid = null;
- System.err.println("\nRegression test for bug/rfe 4179055\n");
-
- try {
- TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
+ System.err.println("\nRegression test for bug/rfe 4179055\n");
- registry = java.rmi.registry.LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT);
+ try {
+ TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
+
+ registry = java.rmi.registry.LocateRegistry.
+ createRegistry(TestLibrary.REGISTRY_PORT);
- // must run with java.lang.SecurityManager or the test
- // result will be nullified if running with a build where
- // 4180392 has not been fixed.
- String smClassName =
- System.getSecurityManager().getClass().getName();
- if (!smClassName.equals("java.lang.SecurityManager")) {
- TestLibrary.bomb("Test must run with java.lang.SecurityManager");
- }
+ // must run with java.lang.SecurityManager or the test
+ // result will be nullified if running with a build where
+ // 4180392 has not been fixed.
+ String smClassName =
+ System.getSecurityManager().getClass().getName();
+ if (!smClassName.equals("java.lang.SecurityManager")) {
+ TestLibrary.bomb("Test must run with java.lang.SecurityManager");
+ }
- // start an rmid.
- RMID.removeLog();
- rmid = RMID.createRMID();
- rmid.start();
+ // start an rmid.
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ rmid.start();
- //rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"});
+ //rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"});
- // Ensure that activation groups run with the correct
- // security manager.
- //
- Properties p = new Properties();
- p.put("java.security.policy",
- TestParams.defaultGroupPolicy);
- p.put("java.security.manager",
- "java.lang.SecurityManager");
+ // Ensure that activation groups run with the correct
+ // security manager.
+ //
+ Properties p = new Properties();
+ p.put("java.security.policy",
+ TestParams.defaultGroupPolicy);
+ p.put("java.security.manager",
+ "java.lang.SecurityManager");
- // This action causes the following classes to be created
- // in this VM (RMI must permit the creation of these classes):
- //
- // sun.rmi.server.Activation$ActivationSystemImpl_Stub
- // sun.rmi.server.Activation$ActivationMonitorImpl_Stub
- //
- System.err.println("Create activation group, in a new VM");
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(p, null);
- ActivationSystem system = ActivationGroup.getSystem();
- ActivationGroupID groupID = system.registerGroup(groupDesc);
-
- System.err.println("register activatable");
- // Fix for: 4271615: make sure activation group runs in a new VM
- ActivationDesc desc = new ActivationDesc
- (groupID, "StubClassesPermitted", null, null);
- canCreateStubs = (CanCreateStubs) Activatable.register(desc);
+ // This action causes the following classes to be created
+ // in this VM (RMI must permit the creation of these classes):
+ //
+ // sun.rmi.server.Activation$ActivationSystemImpl_Stub
+ // sun.rmi.server.Activation$ActivationMonitorImpl_Stub
+ //
+ System.err.println("Create activation group, in a new VM");
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(p, null);
+ ActivationSystem system = ActivationGroup.getSystem();
+ ActivationGroupID groupID = system.registerGroup(groupDesc);
+
+ System.err.println("register activatable");
+ // Fix for: 4271615: make sure activation group runs in a new VM
+ ActivationDesc desc = new ActivationDesc
+ (groupID, "StubClassesPermitted", null, null);
+ canCreateStubs = (CanCreateStubs) Activatable.register(desc);
- // ensure registry stub can be passed in a remote call
- System.err.println("getting the registry");
- registry = canCreateStubs.getRegistry();
+ // ensure registry stub can be passed in a remote call
+ System.err.println("getting the registry");
+ registry = canCreateStubs.getRegistry();
+
+ // make sure a client cant load just any sun.* class, just
+ // as a sanity check, try to create a class we are not
+ // allowed to access but which was passed in a remote call
+ try {
+ System.err.println("accessing forbidden class");
+ Object secureRandom = canCreateStubs.getForbiddenClass();
- // make sure a client cant load just any sun.* class, just
- // as a sanity check, try to create a class we are not
- // allowed to access but which was passed in a remote call
- try {
- System.err.println("accessing forbidden class");
- Object secureRandom = canCreateStubs.getForbiddenClass();
-
- TestLibrary.bomb("test allowed to access forbidden class," +
- " sun.security.provider.SecureRandom");
- } catch (java.security.AccessControlException e) {
+ TestLibrary.bomb("test allowed to access forbidden class," +
+ " sun.security.provider.SecureRandom");
+ } catch (java.security.AccessControlException e) {
- // Make sure we received a *local* AccessControlException
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(bout);
- e.printStackTrace(ps);
- ps.flush();
- String trace = new String(bout.toByteArray());
- if ((trace.indexOf("exceptionReceivedFromServer") >= 0) ||
- trace.equals(""))
+ // Make sure we received a *local* AccessControlException
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(bout);
+ e.printStackTrace(ps);
+ ps.flush();
+ String trace = new String(bout.toByteArray());
+ if ((trace.indexOf("exceptionReceivedFromServer") >= 0) ||
+ trace.equals(""))
{
- throw e;
- }
- System.err.println("received expected local access control exception");
- }
+ throw e;
+ }
+ System.err.println("received expected local access control exception");
+ }
- // make sure that an ActivationGroupID can be passed in a
- // remote call; this is slightly more inclusive than
- // just passing a reference to the activation system
- System.err.println("returning group desc");
- canCreateStubs.returnGroupID();
-
- // Clean up object
- System.err.println
- ("Deactivate object via method call");
- canCreateStubs.shutdown();
+ // make sure that an ActivationGroupID can be passed in a
+ // remote call; this is slightly more inclusive than
+ // just passing a reference to the activation system
+ System.err.println("returning group desc");
+ canCreateStubs.returnGroupID();
+
+ // Clean up object
+ System.err.println
+ ("Deactivate object via method call");
+ canCreateStubs.shutdown();
+
+ System.err.println
+ ("\nsuccess: StubClassesPermitted test passed ");
- System.err.println
- ("\nsuccess: StubClassesPermitted test passed ");
-
- } catch (Exception e) {
- TestLibrary.bomb("\nfailure: unexpected exception ", e);
- } finally {
- try {
- Thread.sleep(4000);
- } catch (InterruptedException e) {
- }
-
- canCreateStubs = null;
- ActivationLibrary.rmidCleanup(rmid);
- System.err.println("rmid shut down");
- }
+ } catch (Exception e) {
+ TestLibrary.bomb("\nfailure: unexpected exception ", e);
+ } finally {
+ try {
+ Thread.sleep(4000);
+ } catch (InterruptedException e) {
+ }
+
+ canCreateStubs = null;
+ ActivationLibrary.rmidCleanup(rmid);
+ System.err.println("rmid shut down");
+ }
}
-
+
static ActivationGroupID GroupID = null;
/**
- * implementation of CanCreateStubs
+ * implementation of CanCreateStubs
*/
public StubClassesPermitted
- (ActivationID id, MarshalledObject mo) throws RemoteException
+ (ActivationID id, MarshalledObject mo) throws RemoteException
{
- // register/export anonymously
- super(id, 0);
+ // register/export anonymously
+ super(id, 0);
- // obtain reference to the test registry
- registry = java.rmi.registry.LocateRegistry.
- getRegistry(TestLibrary.REGISTRY_PORT);
+ // obtain reference to the test registry
+ registry = java.rmi.registry.LocateRegistry.
+ getRegistry(TestLibrary.REGISTRY_PORT);
}
-
+
/**
* Spawns a thread to deactivate the object.
*/
public void shutdown() throws Exception {
- (new Thread(this,"StubClassesPermitted")).start();
+ (new Thread(this,"StubClassesPermitted")).start();
}
/**
@@ -209,7 +209,7 @@
* unexport the object forcibly.
*/
public void run() {
- ActivationLibrary.deactivate(this, getID());
+ ActivationLibrary.deactivate(this, getID());
}
/**
@@ -217,12 +217,12 @@
* the stub for it can be deserialized in the test client VM.
*/
public Registry getRegistry() throws RemoteException {
- if (sameGroup) {
- System.out.println("in same group");
- } else {
- System.out.println("not in same group");
- }
- return registry;
+ if (sameGroup) {
+ System.out.println("in same group");
+ } else {
+ System.out.println("not in same group");
+ }
+ return registry;
}
/**
@@ -232,8 +232,8 @@
* can be resolved in a remote call.
*/
public Object getForbiddenClass() throws RemoteException {
- System.err.println("creating sun class");
- return new sun.security.provider.SecureRandom();
+ System.err.println("creating sun class");
+ return new sun.security.provider.SecureRandom();
}
/**
@@ -242,6 +242,6 @@
* system implementation).
*/
public ActivationGroupID returnGroupID() throws RemoteException {
- return ActivationGroup.currentGroupID();
+ return ActivationGroup.currentGroupID();
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,152 +29,152 @@
implements CanCreateStubs, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("java.lang.Object getForbiddenClass()"),
- new java.rmi.server.Operation("java.rmi.registry.Registry getRegistry()"),
- new java.rmi.server.Operation("java.rmi.activation.ActivationGroupID returnGroupID()"),
- new java.rmi.server.Operation("void shutdown()")
+ new java.rmi.server.Operation("java.lang.Object getForbiddenClass()"),
+ new java.rmi.server.Operation("java.rmi.registry.Registry getRegistry()"),
+ new java.rmi.server.Operation("java.rmi.activation.ActivationGroupID returnGroupID()"),
+ new java.rmi.server.Operation("void shutdown()")
};
-
+
private static final long interfaceHash = 1677779850431817575L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_getForbiddenClass_0;
private static java.lang.reflect.Method $method_getRegistry_1;
private static java.lang.reflect.Method $method_returnGroupID_2;
private static java.lang.reflect.Method $method_shutdown_3;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_getForbiddenClass_0 = CanCreateStubs.class.getMethod("getForbiddenClass", new java.lang.Class[] {});
- $method_getRegistry_1 = CanCreateStubs.class.getMethod("getRegistry", new java.lang.Class[] {});
- $method_returnGroupID_2 = CanCreateStubs.class.getMethod("returnGroupID", new java.lang.Class[] {});
- $method_shutdown_3 = CanCreateStubs.class.getMethod("shutdown", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_getForbiddenClass_0 = CanCreateStubs.class.getMethod("getForbiddenClass", new java.lang.Class[] {});
+ $method_getRegistry_1 = CanCreateStubs.class.getMethod("getRegistry", new java.lang.Class[] {});
+ $method_returnGroupID_2 = CanCreateStubs.class.getMethod("returnGroupID", new java.lang.Class[] {});
+ $method_shutdown_3 = CanCreateStubs.class.getMethod("shutdown", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public StubClassesPermitted_Stub() {
- super();
+ super();
}
public StubClassesPermitted_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of getForbiddenClass()
public java.lang.Object getForbiddenClass()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getForbiddenClass_0, null, -658265783646674294L);
- return ((java.lang.Object) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- java.lang.Object $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.Object) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getForbiddenClass_0, null, -658265783646674294L);
+ return ((java.lang.Object) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ java.lang.Object $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.Object) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
}
-
+
// implementation of getRegistry()
public java.rmi.registry.Registry getRegistry()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getRegistry_1, null, 255311215504696981L);
- return ((java.rmi.registry.Registry) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- ref.invoke(call);
- java.rmi.registry.Registry $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.registry.Registry) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getRegistry_1, null, 255311215504696981L);
+ return ((java.rmi.registry.Registry) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ ref.invoke(call);
+ java.rmi.registry.Registry $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.rmi.registry.Registry) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of returnGroupID()
public java.rmi.activation.ActivationGroupID returnGroupID()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_returnGroupID_2, null, 6267304638191237098L);
- return ((java.rmi.activation.ActivationGroupID) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
- ref.invoke(call);
- java.rmi.activation.ActivationGroupID $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.activation.ActivationGroupID) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_returnGroupID_2, null, 6267304638191237098L);
+ return ((java.rmi.activation.ActivationGroupID) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
+ ref.invoke(call);
+ java.rmi.activation.ActivationGroupID $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.rmi.activation.ActivationGroupID) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of shutdown()
public void shutdown()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- if (useNewInvoke) {
- ref.invoke(this, $method_shutdown_3, null, -7207851917985848402L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
+ if (useNewInvoke) {
+ ref.invoke(this, $method_shutdown_3, null, -7207851917985848402L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/ActivateMe.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/CallbackInterface.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/CallbackInterface.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,4 +27,3 @@
public void inc() throws RemoteException;
public int getNumDeactivated() throws RemoteException;
}
-
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/Callback_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/Callback_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,94 +29,94 @@
implements CallbackInterface, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("int getNumDeactivated()"),
- new java.rmi.server.Operation("void inc()")
+ new java.rmi.server.Operation("int getNumDeactivated()"),
+ new java.rmi.server.Operation("void inc()")
};
-
+
private static final long interfaceHash = -1008194523112388035L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_getNumDeactivated_0;
private static java.lang.reflect.Method $method_inc_1;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_getNumDeactivated_0 = CallbackInterface.class.getMethod("getNumDeactivated", new java.lang.Class[] {});
- $method_inc_1 = CallbackInterface.class.getMethod("inc", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_getNumDeactivated_0 = CallbackInterface.class.getMethod("getNumDeactivated", new java.lang.Class[] {});
+ $method_inc_1 = CallbackInterface.class.getMethod("inc", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public Callback_Stub() {
- super();
+ super();
}
public Callback_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of getNumDeactivated()
public int getNumDeactivated()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getNumDeactivated_0, null, -761062487639949912L);
- return ((java.lang.Integer) $result).intValue();
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- int $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = in.readInt();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getNumDeactivated_0, null, -761062487639949912L);
+ return ((java.lang.Integer) $result).intValue();
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ int $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = in.readInt();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of inc()
public void inc()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_inc_1, null, 4394985085384332959L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_inc_1, null, 4394985085384332959L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -65,8 +65,8 @@
}
public class UnregisterGroup
- extends Activatable
- implements ActivateMe, Runnable
+ extends Activatable
+ implements ActivateMe, Runnable
{
private static Exception exception = null;
@@ -77,30 +77,30 @@
private static int PORT = 2006;
public UnregisterGroup(ActivationID id, MarshalledObject mobj)
- throws Exception
+ throws Exception
{
- super(id, 0);
+ super(id, 0);
}
public void ping()
{}
public void unregister() throws Exception {
- super.unregister(super.getID());
+ super.unregister(super.getID());
}
-
+
/**
* Spawns a thread to deactivate the object.
*/
public void shutdown() throws Exception {
- (new Thread(this,"UnregisterGroup")).start();
+ (new Thread(this,"UnregisterGroup")).start();
}
/**
* To support exiting of group VM as a last resort
*/
public void justGoAway() {
- System.exit(0);
+ System.exit(0);
}
/**
@@ -111,151 +111,151 @@
*/
public void run() {
- ActivationLibrary.deactivate(this, getID());
- System.err.println("\tActivationLibrary.deactivate returned");
+ ActivationLibrary.deactivate(this, getID());
+ System.err.println("\tActivationLibrary.deactivate returned");
- try {
- CallbackInterface cobj =
- (CallbackInterface)Naming.lookup("//:" + PORT + "/Callback");
- cobj.inc();
- } catch (Exception e) {
- System.err.println("cobj.inc exception");
- e.printStackTrace();
- }
+ try {
+ CallbackInterface cobj =
+ (CallbackInterface)Naming.lookup("//:" + PORT + "/Callback");
+ cobj.inc();
+ } catch (Exception e) {
+ System.err.println("cobj.inc exception");
+ e.printStackTrace();
+ }
}
public static void main(String[] args) {
- Registry registry;
+ Registry registry;
+
+ System.err.println("\nRegression test for bug 4134233\n");
+
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ RMID rmid = null;
+
+ try {
+ RMID.removeLog();
+ rmid = RMID.createRMID();
+ rmid.start();
- System.err.println("\nRegression test for bug 4134233\n");
-
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
- RMID rmid = null;
-
- try {
- RMID.removeLog();
- rmid = RMID.createRMID();
- rmid.start();
+ /* Cause activation groups to have a security policy that will
+ * allow security managers to be downloaded and installed
+ */
+ final Properties p = new Properties();
+ // this test must always set policies/managers in its
+ // activation groups
+ p.put("java.security.policy",
+ TestParams.defaultGroupPolicy);
+ p.put("java.security.manager",
+ TestParams.defaultSecurityManager);
- /* Cause activation groups to have a security policy that will
- * allow security managers to be downloaded and installed
- */
- final Properties p = new Properties();
- // this test must always set policies/managers in its
- // activation groups
- p.put("java.security.policy",
- TestParams.defaultGroupPolicy);
- p.put("java.security.manager",
- TestParams.defaultSecurityManager);
+ //final int NUM_OBJECTS = 10;
- //final int NUM_OBJECTS = 10;
-
- Thread t = new Thread() {
- public void run () {
- try {
- System.err.println("Creating group descriptor");
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(p, null);
- ActivationSystem system = ActivationGroup.getSystem();
- ActivationGroupID groupID =
- system.registerGroup(groupDesc);
+ Thread t = new Thread() {
+ public void run () {
+ try {
+ System.err.println("Creating group descriptor");
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(p, null);
+ ActivationSystem system = ActivationGroup.getSystem();
+ ActivationGroupID groupID =
+ system.registerGroup(groupDesc);
- ActivateMe[] obj = new ActivateMe[NUM_OBJECTS];
+ ActivateMe[] obj = new ActivateMe[NUM_OBJECTS];
- for (int i = 0; i < NUM_OBJECTS; i++) {
- System.err.println("Creating descriptor: " + i);
- ActivationDesc desc =
- new ActivationDesc(groupID, "UnregisterGroup",
- null, null);
- System.err.println("Registering descriptor: " + i);
- obj[i] = (ActivateMe) Activatable.register(desc);
- System.err.println("Activating object: " + i);
- obj[i].ping();
- }
- lastResortExitObj = obj[0];
+ for (int i = 0; i < NUM_OBJECTS; i++) {
+ System.err.println("Creating descriptor: " + i);
+ ActivationDesc desc =
+ new ActivationDesc(groupID, "UnregisterGroup",
+ null, null);
+ System.err.println("Registering descriptor: " + i);
+ obj[i] = (ActivateMe) Activatable.register(desc);
+ System.err.println("Activating object: " + i);
+ obj[i].ping();
+ }
+ lastResortExitObj = obj[0];
- System.err.println("Unregistering group");
- system.unregisterGroup(groupID);
+ System.err.println("Unregistering group");
+ system.unregisterGroup(groupID);
- try {
- System.err.println("Get the group descriptor");
- system.getActivationGroupDesc(groupID);
- error = "test failed: group still registered";
- } catch (UnknownGroupException e) {
- System.err.println("Test passed: " +
- "group unregistered");
- }
+ try {
+ System.err.println("Get the group descriptor");
+ system.getActivationGroupDesc(groupID);
+ error = "test failed: group still registered";
+ } catch (UnknownGroupException e) {
+ System.err.println("Test passed: " +
+ "group unregistered");
+ }
- /*
- * Deactivate objects so group VM will exit.
- */
- for (int i = 0; i < NUM_OBJECTS; i++) {
- System.err.println("Deactivating object: " + i);
- obj[i].shutdown();
- obj[i] = null;
- }
- lastResortExitObj = null;
+ /*
+ * Deactivate objects so group VM will exit.
+ */
+ for (int i = 0; i < NUM_OBJECTS; i++) {
+ System.err.println("Deactivating object: " + i);
+ obj[i].shutdown();
+ obj[i] = null;
+ }
+ lastResortExitObj = null;
- } catch (Exception e) {
- exception = e;
- }
+ } catch (Exception e) {
+ exception = e;
+ }
- done = true;
- }
- };
+ done = true;
+ }
+ };
- t.start();
- t.join(120000);
+ t.start();
+ t.join(120000);
- if (exception != null) {
- TestLibrary.bomb("test failed", exception);
- } else if (error != null) {
- TestLibrary.bomb(error, null);
- } else if (!done) {
- TestLibrary.bomb("test failed: not completed before timeout", null);
- } else {
- System.err.println("Test passed");
- }
+ if (exception != null) {
+ TestLibrary.bomb("test failed", exception);
+ } else if (error != null) {
+ TestLibrary.bomb(error, null);
+ } else if (!done) {
+ TestLibrary.bomb("test failed: not completed before timeout", null);
+ } else {
+ System.err.println("Test passed");
+ }
+
-
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
- } finally {
- if (lastResortExitObj != null) {
- try {
- lastResortExitObj.justGoAway();
- } catch (Exception munch) {
- }
- }
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
+ } finally {
+ if (lastResortExitObj != null) {
+ try {
+ lastResortExitObj.justGoAway();
+ } catch (Exception munch) {
+ }
+ }
- // Wait for the object deactivation to take place first
- try {
+ // Wait for the object deactivation to take place first
+ try {
- // create reg and export callback object
- registry = LocateRegistry.createRegistry(PORT);
- Callback robj = new Callback();
- registry.bind("Callback", robj);
+ // create reg and export callback object
+ registry = LocateRegistry.createRegistry(PORT);
+ Callback robj = new Callback();
+ registry.bind("Callback", robj);
- //get the callback object
- int maxwait=30;
- int nd = robj.getNumDeactivated();
- while ((nd < NUM_OBJECTS) && (maxwait> 0)) {
- System.err.println("num_deactivated="+nd);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ie) {}
- maxwait--;
- nd = robj.getNumDeactivated();
- }
- } catch (Exception ce) {
- System.err.println("E:"+ce);
- ce.printStackTrace();
- }
+ //get the callback object
+ int maxwait=30;
+ int nd = robj.getNumDeactivated();
+ while ((nd < NUM_OBJECTS) && (maxwait> 0)) {
+ System.err.println("num_deactivated="+nd);
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {}
+ maxwait--;
+ nd = robj.getNumDeactivated();
+ }
+ } catch (Exception ce) {
+ System.err.println("E:"+ce);
+ ce.printStackTrace();
+ }
- ActivationLibrary.rmidCleanup(rmid);
- }
+ ActivationLibrary.rmidCleanup(rmid);
+ }
}
}
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,116 +29,116 @@
implements ActivateMe, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void justGoAway()"),
- new java.rmi.server.Operation("void ping()"),
- new java.rmi.server.Operation("void shutdown()"),
- new java.rmi.server.Operation("void unregister()")
+ new java.rmi.server.Operation("void justGoAway()"),
+ new java.rmi.server.Operation("void ping()"),
+ new java.rmi.server.Operation("void shutdown()"),
+ new java.rmi.server.Operation("void unregister()")
};
-
+
private static final long interfaceHash = -4733924075192691630L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_justGoAway_0;
private static java.lang.reflect.Method $method_ping_1;
private static java.lang.reflect.Method $method_shutdown_2;
private static java.lang.reflect.Method $method_unregister_3;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_justGoAway_0 = ActivateMe.class.getMethod("justGoAway", new java.lang.Class[] {});
- $method_ping_1 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {});
- $method_shutdown_2 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {});
- $method_unregister_3 = ActivateMe.class.getMethod("unregister", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_justGoAway_0 = ActivateMe.class.getMethod("justGoAway", new java.lang.Class[] {});
+ $method_ping_1 = ActivateMe.class.getMethod("ping", new java.lang.Class[] {});
+ $method_shutdown_2 = ActivateMe.class.getMethod("shutdown", new java.lang.Class[] {});
+ $method_unregister_3 = ActivateMe.class.getMethod("unregister", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public UnregisterGroup_Stub() {
- super();
+ super();
}
public UnregisterGroup_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of justGoAway()
public void justGoAway()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_justGoAway_0, null, -5382478058620783904L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_justGoAway_0, null, -5382478058620783904L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of ping()
public void ping()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_ping_1, null, 5866401369815527589L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_ping_1, null, 5866401369815527589L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of shutdown()
public void shutdown()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- if (useNewInvoke) {
- ref.invoke(this, $method_shutdown_2, null, -7207851917985848402L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
+ if (useNewInvoke) {
+ ref.invoke(this, $method_shutdown_2, null, -7207851917985848402L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
}
-
+
// implementation of unregister()
public void unregister()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- if (useNewInvoke) {
- ref.invoke(this, $method_unregister_3, null, -5366864281862648102L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
+ if (useNewInvoke) {
+ ref.invoke(this, $method_unregister_3, null, -5366864281862648102L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
}
}
--- a/jdk/test/java/rmi/dgc/VMID/CheckVMID.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/VMID/CheckVMID.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,17 +41,17 @@
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4171370\n");
+ System.err.println("\nRegression test for bug 4171370\n");
- TestLibrary.suggestSecurityManager(null);
+ TestLibrary.suggestSecurityManager(null);
- try {
- System.err.println("Create a VMID");
- VMID vmid = new VMID();
- System.err.println("vmid = " + vmid);
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("TEST FAILED: " + e.toString());
- }
+ try {
+ System.err.println("Create a VMID");
+ VMID vmid = new VMID();
+ System.err.println("vmid = " + vmid);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("TEST FAILED: " + e.toString());
+ }
}
}
--- a/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -51,123 +51,123 @@
private static final long TIMEOUT = 20000;
public Object returnRemote() {
- return new Wrapper(this);
+ return new Wrapper(this);
}
public static void main(String[] args) throws Exception {
- System.setProperty("sun.rmi.dgc.ackTimeout", "10000");
+ System.setProperty("sun.rmi.dgc.ackTimeout", "10000");
- /*
- * Set a socket factory that has a hook for shutting down all client
- * output (writes from client-created sockets and new connection
- * attempts). We then use this hook right before a remote stub gets
- * deserialized, so that the client will not be able to send a DGC
- * dirty call, or a DGC acknowledgment. Without the DGC ack, we
- * hope that the RMI runtime will still eventually allow the remote
- * object to be garbage collected.
- */
- RMISocketFactory.setSocketFactory(new TestSF());
- System.err.println("test socket factory set");
+ /*
+ * Set a socket factory that has a hook for shutting down all client
+ * output (writes from client-created sockets and new connection
+ * attempts). We then use this hook right before a remote stub gets
+ * deserialized, so that the client will not be able to send a DGC
+ * dirty call, or a DGC acknowledgment. Without the DGC ack, we
+ * hope that the RMI runtime will still eventually allow the remote
+ * object to be garbage collected.
+ */
+ RMISocketFactory.setSocketFactory(new TestSF());
+ System.err.println("test socket factory set");
- Remote impl = new DGCAckFailure();
- ReferenceQueue refQueue = new ReferenceQueue();
- Reference weakRef = new WeakReference(impl, refQueue);
- ReturnRemote stub =
- (ReturnRemote) UnicastRemoteObject.exportObject(impl);
- System.err.println("remote object exported; stub = " + stub);
+ Remote impl = new DGCAckFailure();
+ ReferenceQueue refQueue = new ReferenceQueue();
+ Reference weakRef = new WeakReference(impl, refQueue);
+ ReturnRemote stub =
+ (ReturnRemote) UnicastRemoteObject.exportObject(impl);
+ System.err.println("remote object exported; stub = " + stub);
- try {
- Object wrappedStub = stub.returnRemote();
- System.err.println("invocation returned: " + wrappedStub);
+ try {
+ Object wrappedStub = stub.returnRemote();
+ System.err.println("invocation returned: " + wrappedStub);
- impl = null;
- stub = null; // in case 4114579 ever gets fixed
- System.err.println("strong references to impl cleared");
+ impl = null;
+ stub = null; // in case 4114579 ever gets fixed
+ System.err.println("strong references to impl cleared");
- System.err.println("waiting for weak reference notification:");
- Reference ref = null;
- for (int i = 0; i < 6; i++) {
- System.gc();
- ref = refQueue.remove(TIMEOUT / 5);
- if (ref != null) {
- break;
- }
- }
- if (ref == weakRef) {
- System.err.println("TEST PASSED");
- } else {
- throw new RuntimeException("TEST FAILED: " +
- "timed out, remote object not garbage collected");
- }
- } finally {
- try {
- UnicastRemoteObject.unexportObject((Remote) weakRef.get(),
- true);
- } catch (Exception e) {
- }
- }
+ System.err.println("waiting for weak reference notification:");
+ Reference ref = null;
+ for (int i = 0; i < 6; i++) {
+ System.gc();
+ ref = refQueue.remove(TIMEOUT / 5);
+ if (ref != null) {
+ break;
+ }
+ }
+ if (ref == weakRef) {
+ System.err.println("TEST PASSED");
+ } else {
+ throw new RuntimeException("TEST FAILED: " +
+ "timed out, remote object not garbage collected");
+ }
+ } finally {
+ try {
+ UnicastRemoteObject.unexportObject((Remote) weakRef.get(),
+ true);
+ } catch (Exception e) {
+ }
+ }
}
private static class Wrapper implements Serializable {
- private final Remote obj;
- Wrapper(Remote obj) { this.obj = obj; }
+ private final Remote obj;
+ Wrapper(Remote obj) { this.obj = obj; }
- private void readObject(ObjectInputStream in)
- throws IOException, ClassNotFoundException
- {
- TestSF.shutdownClientOutput();
- System.err.println(
- "Wrapper.readObject: SHUTTING DOWN CLIENT OUTPUT");
- in.defaultReadObject();
- }
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException
+ {
+ TestSF.shutdownClientOutput();
+ System.err.println(
+ "Wrapper.readObject: SHUTTING DOWN CLIENT OUTPUT");
+ in.defaultReadObject();
+ }
- public String toString() { return "Wrapper[" + obj + "]"; }
+ public String toString() { return "Wrapper[" + obj + "]"; }
}
private static class TestSF extends RMISocketFactory {
- private static volatile boolean shutdown = false;
- static void shutdownClientOutput() { shutdown = true; }
+ private static volatile boolean shutdown = false;
+ static void shutdownClientOutput() { shutdown = true; }
- public Socket createSocket(String host, int port) throws IOException {
- if (shutdown) {
- IOException e = new java.net.ConnectException(
- "test socket factory rejecting client connection");
- System.err.println(e);
-// e.printStackTrace();
- throw e;
- } else {
- return new TestSocket(host, port);
- }
- }
+ public Socket createSocket(String host, int port) throws IOException {
+ if (shutdown) {
+ IOException e = new java.net.ConnectException(
+ "test socket factory rejecting client connection");
+ System.err.println(e);
+// e.printStackTrace();
+ throw e;
+ } else {
+ return new TestSocket(host, port);
+ }
+ }
- public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port);
- }
+ public ServerSocket createServerSocket(int port) throws IOException {
+ return new ServerSocket(port);
+ }
- private static class TestSocket extends Socket {
- TestSocket(String host, int port) throws IOException {
- super(host, port);
- }
- public OutputStream getOutputStream() throws IOException {
- return new TestOutputStream(super.getOutputStream());
- }
- }
+ private static class TestSocket extends Socket {
+ TestSocket(String host, int port) throws IOException {
+ super(host, port);
+ }
+ public OutputStream getOutputStream() throws IOException {
+ return new TestOutputStream(super.getOutputStream());
+ }
+ }
- private static class TestOutputStream extends FilterOutputStream {
- TestOutputStream(OutputStream out) { super(out); }
- public void write(int b) throws IOException {
- if (shutdown) {
- IOException e = new IOException(
- "connection broken by test socket factory");
- System.err.println(e);
-// e.printStackTrace();
- throw e;
- } else {
- super.write(b);
- }
- }
- }
+ private static class TestOutputStream extends FilterOutputStream {
+ TestOutputStream(OutputStream out) { super(out); }
+ public void write(int b) throws IOException {
+ if (shutdown) {
+ IOException e = new IOException(
+ "connection broken by test socket factory");
+ System.err.println(e);
+// e.printStackTrace();
+ throw e;
+ } else {
+ super.write(b);
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/dgcAckFailure/DGCAckFailure_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,38 +29,38 @@
implements ReturnRemote
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_returnRemote_0;
-
+
static {
- try {
- $method_returnRemote_0 = ReturnRemote.class.getMethod("returnRemote", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_returnRemote_0 = ReturnRemote.class.getMethod("returnRemote", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public DGCAckFailure_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of returnRemote()
public java.lang.Object returnRemote()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- Object $result = ref.invoke(this, $method_returnRemote_0, null, -8981544221566403070L);
- return ((java.lang.Object) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_returnRemote_0, null, -8981544221566403070L);
+ return ((java.lang.Object) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -57,55 +57,55 @@
public static void main(String[] args) throws Exception {
- TestLibrary.suggestSecurityManager(null);
+ TestLibrary.suggestSecurityManager(null);
- Permissions perms = new Permissions();
- perms.add(new SocketPermission("*:1024-", "listen"));
- AccessControlContext acc =
- new AccessControlContext(new ProtectionDomain[] {
- new ProtectionDomain(
- new CodeSource(null, (Certificate[]) null), perms) });
+ Permissions perms = new Permissions();
+ perms.add(new SocketPermission("*:1024-", "listen"));
+ AccessControlContext acc =
+ new AccessControlContext(new ProtectionDomain[] {
+ new ProtectionDomain(
+ new CodeSource(null, (Certificate[]) null), perms) });
- Remote impl = new DGCImplInsulation();;
+ Remote impl = new DGCImplInsulation();;
- try {
- Remote stub = (Remote) java.security.AccessController.doPrivileged(
- new ExportAction(impl));
- System.err.println("exported remote object; local stub: " + stub);
+ try {
+ Remote stub = (Remote) java.security.AccessController.doPrivileged(
+ new ExportAction(impl));
+ System.err.println("exported remote object; local stub: " + stub);
- MarshalledObject mobj = new MarshalledObject(stub);
- stub = (Remote) mobj.get();
- System.err.println("marshalled/unmarshalled stub: " + stub);
+ MarshalledObject mobj = new MarshalledObject(stub);
+ stub = (Remote) mobj.get();
+ System.err.println("marshalled/unmarshalled stub: " + stub);
- ReferenceQueue refQueue = new ReferenceQueue();
- Reference weakRef = new WeakReference(impl, refQueue);
- impl = null;
- System.gc();
- if (refQueue.remove(TIMEOUT) == weakRef) {
- throw new RuntimeException(
- "TEST FAILED: remote object garbage collected");
- } else {
- System.err.println("TEST PASSED");
- stub = null;
- System.gc();
- Thread.sleep(2000);
- System.gc();
- }
- } finally {
- try {
- UnicastRemoteObject.unexportObject(impl, true);
- } catch (Exception e) {
- }
- }
+ ReferenceQueue refQueue = new ReferenceQueue();
+ Reference weakRef = new WeakReference(impl, refQueue);
+ impl = null;
+ System.gc();
+ if (refQueue.remove(TIMEOUT) == weakRef) {
+ throw new RuntimeException(
+ "TEST FAILED: remote object garbage collected");
+ } else {
+ System.err.println("TEST PASSED");
+ stub = null;
+ System.gc();
+ Thread.sleep(2000);
+ System.gc();
+ }
+ } finally {
+ try {
+ UnicastRemoteObject.unexportObject(impl, true);
+ } catch (Exception e) {
+ }
+ }
}
private static class ExportAction implements PrivilegedExceptionAction {
- private final Remote impl;
- ExportAction(Remote impl) {
- this.impl = impl;
- }
- public Object run() throws Exception {
- return UnicastRemoteObject.exportObject(impl);
- }
+ private final Remote impl;
+ ExportAction(Remote impl) {
+ this.impl = impl;
+ }
+ public Object run() throws Exception {
+ return UnicastRemoteObject.exportObject(impl);
+ }
}
}
--- a/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,10 +29,10 @@
implements java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
// constructors
public DGCImplInsulation_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
}
--- a/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -55,108 +55,108 @@
* Return this object. The need for this method is explained below.
*/
public Self getSelf() {
- return this;
+ return this;
}
public void unreferenced() {
- synchronized (this) {
- unreferenced = true;
- notifyAll();
- }
+ synchronized (this) {
+ unreferenced = true;
+ notifyAll();
+ }
}
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4268258\n");
+ System.err.println("\nRegression test for bug 4268258\n");
- /*
- * Set properties to tweak DGC behavior so that this test will execute
- * quickly: set the granted lease duration to 10 seconds, the interval
- * that leases are checked to 3 seconds.
- */
- System.setProperty("java.rmi.dgc.leaseValue", "10000");
- System.setProperty("sun.rmi.dgc.checkInterval", "3000");
+ /*
+ * Set properties to tweak DGC behavior so that this test will execute
+ * quickly: set the granted lease duration to 10 seconds, the interval
+ * that leases are checked to 3 seconds.
+ */
+ System.setProperty("java.rmi.dgc.leaseValue", "10000");
+ System.setProperty("sun.rmi.dgc.checkInterval", "3000");
- /*
- * Make idle connections time out almost instantly (0.1 seconds) so
- * that the DGC implementation will have to make a new connection for
- * each dirty call, thus going through the socket factory, where we
- * can easily cause the operation to fail.
- */
- System.setProperty("sun.rmi.transport.connectionTimeout", "100");
+ /*
+ * Make idle connections time out almost instantly (0.1 seconds) so
+ * that the DGC implementation will have to make a new connection for
+ * each dirty call, thus going through the socket factory, where we
+ * can easily cause the operation to fail.
+ */
+ System.setProperty("sun.rmi.transport.connectionTimeout", "100");
- RetryDirtyCalls impl = new RetryDirtyCalls();
+ RetryDirtyCalls impl = new RetryDirtyCalls();
- try {
- TestSF sf = new TestSF();
- RMISocketFactory.setSocketFactory(sf);
+ try {
+ TestSF sf = new TestSF();
+ RMISocketFactory.setSocketFactory(sf);
- /*
- * The stub returned by UnicastRemoteObject.exportObject() does
- * not participate in DGC, but it does allow us to invoke a method
- * on the remote object through RMI. Therefore, we invoke the
- * getSelf() method through RMI, which returns an equivalent stub
- * that does participate in DGC.
- */
- Self stub = (Self) UnicastRemoteObject.exportObject(impl);
- Self dgcStub = stub.getSelf();
- stub = null; // in case 4114579 has been fixed
+ /*
+ * The stub returned by UnicastRemoteObject.exportObject() does
+ * not participate in DGC, but it does allow us to invoke a method
+ * on the remote object through RMI. Therefore, we invoke the
+ * getSelf() method through RMI, which returns an equivalent stub
+ * that does participate in DGC.
+ */
+ Self stub = (Self) UnicastRemoteObject.exportObject(impl);
+ Self dgcStub = stub.getSelf();
+ stub = null; // in case 4114579 has been fixed
- /*
- * Set the socket factory to cause 3 connections attempts in a row
- * to fail before allowing a connection to succeed, expecting the
- * client-side DGC implementation to make at least four attempts.
- */
- final int FLAKE_FACTOR = 3;
- sf.setFlakeFactor(FLAKE_FACTOR);
+ /*
+ * Set the socket factory to cause 3 connections attempts in a row
+ * to fail before allowing a connection to succeed, expecting the
+ * client-side DGC implementation to make at least four attempts.
+ */
+ final int FLAKE_FACTOR = 3;
+ sf.setFlakeFactor(FLAKE_FACTOR);
- long deadline = System.currentTimeMillis() + TIMEOUT;
- boolean unreferenced;
+ long deadline = System.currentTimeMillis() + TIMEOUT;
+ boolean unreferenced;
- synchronized (impl) {
- while (!(unreferenced = impl.unreferenced)) {
- long timeToWait = deadline - System.currentTimeMillis();
- if (timeToWait > 0) {
- impl.wait(timeToWait);
- } else {
- break;
- }
- }
- }
+ synchronized (impl) {
+ while (!(unreferenced = impl.unreferenced)) {
+ long timeToWait = deadline - System.currentTimeMillis();
+ if (timeToWait > 0) {
+ impl.wait(timeToWait);
+ } else {
+ break;
+ }
+ }
+ }
- if (unreferenced) {
- throw new RuntimeException("remote object unreferenced");
- }
+ if (unreferenced) {
+ throw new RuntimeException("remote object unreferenced");
+ }
- int createCount = sf.getCreateCount();
- if (createCount == 0) {
- throw new RuntimeException("test socket factory never used");
- } else if (createCount < (FLAKE_FACTOR + 3)) {
- /*
- * The unreferenced method was not invoked for some reason,
- * but the dirty calls were clearly not retried well enough.
- */
- throw new RuntimeException(
- "test failed because dirty calls not retried enough, " +
- "but remote object not unreferenced");
- }
+ int createCount = sf.getCreateCount();
+ if (createCount == 0) {
+ throw new RuntimeException("test socket factory never used");
+ } else if (createCount < (FLAKE_FACTOR + 3)) {
+ /*
+ * The unreferenced method was not invoked for some reason,
+ * but the dirty calls were clearly not retried well enough.
+ */
+ throw new RuntimeException(
+ "test failed because dirty calls not retried enough, " +
+ "but remote object not unreferenced");
+ }
- System.err.println(
- "TEST PASSED: remote object not unreferenced");
+ System.err.println(
+ "TEST PASSED: remote object not unreferenced");
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("TEST FAILED: " + e.toString());
- } finally {
- /*
- * When all is said and done, try to unexport the remote object
- * so that the VM has a chance to exit.
- */
- try {
- UnicastRemoteObject.unexportObject(impl, true);
- } catch (Exception e) {
- }
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("TEST FAILED: " + e.toString());
+ } finally {
+ /*
+ * When all is said and done, try to unexport the remote object
+ * so that the VM has a chance to exit.
+ */
+ try {
+ UnicastRemoteObject.unexportObject(impl, true);
+ } catch (Exception e) {
+ }
+ }
}
}
@@ -169,30 +169,30 @@
private int createCount = 0;
public synchronized void setFlakeFactor(int newFlakeFactor) {
- flakeFactor = newFlakeFactor;
+ flakeFactor = newFlakeFactor;
}
public synchronized int getCreateCount() {
- return createCount;
+ return createCount;
}
public synchronized Socket createSocket(String host, int port)
- throws IOException
+ throws IOException
{
- createCount++;
+ createCount++;
- if (++flakeState > flakeFactor) {
- flakeState = 0;
- }
+ if (++flakeState > flakeFactor) {
+ flakeState = 0;
+ }
- if (flakeState == 0) {
- return new Socket(host, port);
- } else {
- throw new IOException("random network failure");
- }
+ if (flakeState == 0) {
+ return new Socket(host, port);
+ } else {
+ throw new IOException("random network failure");
+ }
}
public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port);
+ return new ServerSocket(port);
}
}
--- a/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/dgc/retryDirtyCalls/RetryDirtyCalls_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,38 +29,38 @@
implements Self
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_getSelf_0;
-
+
static {
- try {
- $method_getSelf_0 = Self.class.getMethod("getSelf", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_getSelf_0 = Self.class.getMethod("getSelf", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public RetryDirtyCalls_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of getSelf()
public Self getSelf()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- Object $result = ref.invoke(this, $method_getSelf_0, null, 2868857108246021904L);
- return ((Self) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_getSelf_0, null, 2868857108246021904L);
+ return ((Self) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,8 +26,8 @@
* @summary rmid and rmiregistry could allow alternate security manager
* @author Laird Dornin
*
- * @library ../../testlibrary
- * @build StreamPipe TestParams TestLibrary JavaVM
+ * @library ../../testlibrary
+ * @build StreamPipe TestParams TestLibrary JavaVM
* @build AltSecurityManager TestSecurityManager
* @run main/othervm AltSecurityManager
*/
@@ -38,7 +38,7 @@
* that throws a runtime exception in its checkListen method, this
* will cause rmiregistry and rmid to exit early because those
* utilities will be unable to export any remote objects; test fails
- * if registry and rmid take too long to exit.
+ * if registry and rmid take too long to exit.
*/
public class AltSecurityManager implements Runnable {
@@ -54,74 +54,74 @@
static long TIME_OUT = 15000;
public void run() {
- try {
- vm = new JavaVM(utilityToStart,
- " -Djava.security.manager=TestSecurityManager",
- "");
- System.err.println("starting " + utilityToStart);
- vm.start();
- vm.getVM().waitFor();
+ try {
+ vm = new JavaVM(utilityToStart,
+ " -Djava.security.manager=TestSecurityManager",
+ "");
+ System.err.println("starting " + utilityToStart);
+ vm.start();
+ vm.getVM().waitFor();
- } catch (Exception e) {
- TestLibrary.bomb(e);
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ }
}
-
+
/**
* Wait to make sure that the registry and rmid exit after
* their security manager is set.
*/
public static void ensureExit(String utility) throws Exception {
- utilityToStart = utility;
-
- try {
- Thread thread = new Thread(new AltSecurityManager());
- System.err.println("expecting RuntimeException for " +
- "checkListen in child process");
- long start = System.currentTimeMillis();
- thread.start();
- thread.join(TIME_OUT);
-
- long time = System.currentTimeMillis() - start;
- System.err.println("waited " + time + " millis for " +
- utilityToStart + " to die");
+ utilityToStart = utility;
- if (time >= TIME_OUT) {
-
- // dont pollute other tests; increase the likelihood
+ try {
+ Thread thread = new Thread(new AltSecurityManager());
+ System.err.println("expecting RuntimeException for " +
+ "checkListen in child process");
+ long start = System.currentTimeMillis();
+ thread.start();
+ thread.join(TIME_OUT);
+
+ long time = System.currentTimeMillis() - start;
+ System.err.println("waited " + time + " millis for " +
+ utilityToStart + " to die");
+
+ if (time >= TIME_OUT) {
+
+ // dont pollute other tests; increase the likelihood
// that rmid will go away if it did not exit already.
- if (utility.equals(rmid)) {
- RMID.shutdown();
- }
-
- TestLibrary.bomb(utilityToStart +
- " took too long to die...");
- } else {
- System.err.println(utilityToStart +
- " terminated on time");
- }
- } finally {
- vm.destroy();
- vm = null;
- }
+ if (utility.equals(rmid)) {
+ RMID.shutdown();
+ }
+
+ TestLibrary.bomb(utilityToStart +
+ " took too long to die...");
+ } else {
+ System.err.println(utilityToStart +
+ " terminated on time");
+ }
+ } finally {
+ vm.destroy();
+ vm = null;
+ }
}
-
+
public static void main(String[] args) {
- try {
- System.err.println("\nRegression test for bug 4183202\n");
+ try {
+ System.err.println("\nRegression test for bug 4183202\n");
- // make sure the registry exits early.
- ensureExit(registry);
+ // make sure the registry exits early.
+ ensureExit(registry);
- // make sure rmid exits early
- ensureExit(rmid);
+ // make sure rmid exits early
+ ensureExit(rmid);
- System.err.println("test passed");
+ System.err.println("test passed");
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- RMID.removeLog();
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ RMID.removeLog();
+ }
}
}
--- a/jdk/test/java/rmi/registry/altSecurityManager/TestSecurityManager.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/altSecurityManager/TestSecurityManager.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -28,18 +28,18 @@
}
public void checkListen(int port) {
- // 4269910: ok, now rmid and the regsitry will *really* go
- // away...
- //
- // rmid and the registry need to listen on sockets so they
- // will exit when they try to do so... this is used as a sign
- // by the main test process to detect that the proper security
- // manager has been installed in the relevant VMs.
- //
- System.exit(1);
+ // 4269910: ok, now rmid and the regsitry will *really* go
+ // away...
+ //
+ // rmid and the registry need to listen on sockets so they
+ // will exit when they try to do so... this is used as a sign
+ // by the main test process to detect that the proper security
+ // manager has been installed in the relevant VMs.
+ //
+ System.exit(1);
}
public void checkExit(int status) {
- // permit check exit for all code
+ // permit check exit for all code
}
}
--- a/jdk/test/java/rmi/registry/checkusage/CheckUsage.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/checkusage/CheckUsage.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,48 +36,48 @@
/**
* Make sure that the rmiregistry prints out a correct usage statement
* when run with an incorrect command line; test written to conform to
- * new tighter bug fix/regression test guidelines.
+ * new tighter bug fix/regression test guidelines.
*/
public class CheckUsage {
public static void main(String[] args) {
- System.err.println("\nregression test for 4151966\n");
+ System.err.println("\nregression test for 4151966\n");
+
+ JavaVM registryVM = null;
- JavaVM registryVM = null;
+ try {
+ // make sure the registry exits with a proper usage statement
+ ByteArrayOutputStream berr = new ByteArrayOutputStream();
+
+ // run a VM to start the registry
+ registryVM = new JavaVM("sun.rmi.registry.RegistryImpl",
+ "", "foo",
+ System.out, berr);
+ System.err.println("starting registry");
+ registryVM.start();
- try {
- // make sure the registry exits with a proper usage statement
- ByteArrayOutputStream berr = new ByteArrayOutputStream();
-
- // run a VM to start the registry
- registryVM = new JavaVM("sun.rmi.registry.RegistryImpl",
- "", "foo",
- System.out, berr);
- System.err.println("starting registry");
- registryVM.start();
-
- // wait for registry exit
- System.err.println(" registry exited with status: " +
- registryVM.getVM().waitFor());
- try {
- Thread.sleep(7000);
- } catch (InterruptedException ie) {
- }
-
- String usage = new String(berr.toByteArray());
-
- System.err.println("rmiregistry usage: " + usage);
-
- if (usage.indexOf("-J") < 0) {
- TestLibrary.bomb("rmiregistry has incorrect usage statement");
- } else {
- System.err.println("test passed");
- }
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- registryVM.destroy();
- registryVM = null;
- }
+ // wait for registry exit
+ System.err.println(" registry exited with status: " +
+ registryVM.getVM().waitFor());
+ try {
+ Thread.sleep(7000);
+ } catch (InterruptedException ie) {
+ }
+
+ String usage = new String(berr.toByteArray());
+
+ System.err.println("rmiregistry usage: " + usage);
+
+ if (usage.indexOf("-J") < 0) {
+ TestLibrary.bomb("rmiregistry has incorrect usage statement");
+ } else {
+ System.err.println("test passed");
+ }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ registryVM.destroy();
+ registryVM = null;
+ }
}
}
--- a/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -55,121 +55,121 @@
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4242317\n");
+ System.err.println("\nRegression test for bug 4242317\n");
- TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
+ TestLibrary.suggestSecurityManager("java.lang.SecurityManager");
- Process rmiregistry = null;
+ Process rmiregistry = null;
- try {
- /*
- * Install a dummy class in two codebases: one that will be in
- * the rmiregistry's CLASSPATH (the "import" codebase) and one
- * that will be in the rmiregistry's "java.rmi.server.codebase"
- * property (the "export" codebase).
- */
- URL importCodebaseURL = TestLibrary.installClassInCodebase(
- dummyClassName, importCodebase, false);
- URL exportCodebaseURL = TestLibrary.installClassInCodebase(
- dummyClassName, exportCodebase, true);
+ try {
+ /*
+ * Install a dummy class in two codebases: one that will be in
+ * the rmiregistry's CLASSPATH (the "import" codebase) and one
+ * that will be in the rmiregistry's "java.rmi.server.codebase"
+ * property (the "export" codebase).
+ */
+ URL importCodebaseURL = TestLibrary.installClassInCodebase(
+ dummyClassName, importCodebase, false);
+ URL exportCodebaseURL = TestLibrary.installClassInCodebase(
+ dummyClassName, exportCodebase, true);
- /*
- * Spawn an rmiregistry in the "import" codebase directory.
- */
- File rmiregistryDir =
- new File(System.getProperty("user.dir", "."), importCodebase);
+ /*
+ * Spawn an rmiregistry in the "import" codebase directory.
+ */
+ File rmiregistryDir =
+ new File(System.getProperty("user.dir", "."), importCodebase);
+
+ String rmiregistryCommand =
+ System.getProperty("java.home") + File.separator +
+ "bin" + File.separator + "rmiregistry";
- String rmiregistryCommand =
- System.getProperty("java.home") + File.separator +
- "bin" + File.separator + "rmiregistry";
-
- String cmdarray[] = new String[] {
- rmiregistryCommand,
- "-J-Denv.class.path=.",
- "-J-Djava.rmi.server.codebase=" + exportCodebaseURL,
- Integer.toString(TestLibrary.REGISTRY_PORT) };
+ String cmdarray[] = new String[] {
+ rmiregistryCommand,
+ "-J-Denv.class.path=.",
+ "-J-Djava.rmi.server.codebase=" + exportCodebaseURL,
+ Integer.toString(TestLibrary.REGISTRY_PORT) };
- System.err.println("\nCommand used to spawn rmiregistry process:");
- System.err.println("\t" + Arrays.asList(cmdarray).toString());
+ System.err.println("\nCommand used to spawn rmiregistry process:");
+ System.err.println("\t" + Arrays.asList(cmdarray).toString());
- rmiregistry = Runtime.getRuntime().exec(cmdarray, null, rmiregistryDir);
+ rmiregistry = Runtime.getRuntime().exec(cmdarray, null, rmiregistryDir);
+
+ // pipe rmiregistry output to our output, for debugging failures
+ StreamPipe.plugTogether(rmiregistry.getInputStream(), System.err);
+ StreamPipe.plugTogether(rmiregistry.getErrorStream(), System.err);
- // pipe rmiregistry output to our output, for debugging failures
- StreamPipe.plugTogether(rmiregistry.getInputStream(), System.err);
- StreamPipe.plugTogether(rmiregistry.getErrorStream(), System.err);
+ /*
+ * Wait for the registry to initialize and be ready to call.
+ */
+ Thread.sleep(REGISTRY_WAIT);
+ System.err.println();
- /*
- * Wait for the registry to initialize and be ready to call.
- */
- Thread.sleep(REGISTRY_WAIT);
- System.err.println();
-
- /*
- * Create an instance of the dummy class, finding it from the
- * "import" codebase.
- */
- ClassLoader loader = URLClassLoader.newInstance(
- new URL[] { importCodebaseURL });
- Class dummyClass = Class.forName(dummyClassName, false, loader);
- Remote dummyObject = (Remote) dummyClass.newInstance();
+ /*
+ * Create an instance of the dummy class, finding it from the
+ * "import" codebase.
+ */
+ ClassLoader loader = URLClassLoader.newInstance(
+ new URL[] { importCodebaseURL });
+ Class dummyClass = Class.forName(dummyClassName, false, loader);
+ Remote dummyObject = (Remote) dummyClass.newInstance();
- /*
- * Find the registry that we created and bind the
- * dummy object to it.
- */
- Registry registry = LocateRegistry.getRegistry(
- "localhost", TestLibrary.REGISTRY_PORT);
+ /*
+ * Find the registry that we created and bind the
+ * dummy object to it.
+ */
+ Registry registry = LocateRegistry.getRegistry(
+ "localhost", TestLibrary.REGISTRY_PORT);
- try {
- registry.bind(dummyBinding, dummyObject);
- System.err.println("Bound dummy object in registry");
- } catch (java.rmi.ConnectException e) {
- System.err.println("Error: rmiregistry not started in time");
- throw e;
- } catch (ServerException e) {
- if (e.detail instanceof UnmarshalException &&
- ((UnmarshalException) e.detail).detail instanceof
- ClassNotFoundException)
- {
- System.err.println(
- "Error: another registry running on port " +
- TestLibrary.REGISTRY_PORT + "?");
- }
- throw e;
- }
+ try {
+ registry.bind(dummyBinding, dummyObject);
+ System.err.println("Bound dummy object in registry");
+ } catch (java.rmi.ConnectException e) {
+ System.err.println("Error: rmiregistry not started in time");
+ throw e;
+ } catch (ServerException e) {
+ if (e.detail instanceof UnmarshalException &&
+ ((UnmarshalException) e.detail).detail instanceof
+ ClassNotFoundException)
+ {
+ System.err.println(
+ "Error: another registry running on port " +
+ TestLibrary.REGISTRY_PORT + "?");
+ }
+ throw e;
+ }
- /*
- * Look up the dummy object from our registry and make sure
- * that its class was annotated with the "export" codebase.
- */
- Remote dummyLookup = registry.lookup(dummyBinding);
- System.err.println(
- "Looked up dummy object from registry: " + dummyLookup);
- Class dummyLookupClass = dummyLookup.getClass();
- String dummyLookupAnnotation =
- RMIClassLoader.getClassAnnotation(dummyLookupClass);
- System.err.println(
- "Class annotation from registry: " + dummyLookupAnnotation);
+ /*
+ * Look up the dummy object from our registry and make sure
+ * that its class was annotated with the "export" codebase.
+ */
+ Remote dummyLookup = registry.lookup(dummyBinding);
+ System.err.println(
+ "Looked up dummy object from registry: " + dummyLookup);
+ Class dummyLookupClass = dummyLookup.getClass();
+ String dummyLookupAnnotation =
+ RMIClassLoader.getClassAnnotation(dummyLookupClass);
+ System.err.println(
+ "Class annotation from registry: " + dummyLookupAnnotation);
- System.err.println();
- if (dummyLookupAnnotation.indexOf(exportCodebase) >= 0) {
- System.err.println("TEST PASSED");
- } else if (dummyLookupAnnotation.indexOf(importCodebase) >= 0) {
- throw new RuntimeException(
- "rmiregistry annotated with CLASSPATH element URL");
- } else {
- throw new RuntimeException(
- "rmiregistry used unexpected annotation: \"" +
- dummyLookupAnnotation + "\"");
- }
+ System.err.println();
+ if (dummyLookupAnnotation.indexOf(exportCodebase) >= 0) {
+ System.err.println("TEST PASSED");
+ } else if (dummyLookupAnnotation.indexOf(importCodebase) >= 0) {
+ throw new RuntimeException(
+ "rmiregistry annotated with CLASSPATH element URL");
+ } else {
+ throw new RuntimeException(
+ "rmiregistry used unexpected annotation: \"" +
+ dummyLookupAnnotation + "\"");
+ }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("TEST FAILED: " + e.toString());
- } finally {
- if (rmiregistry != null) {
- rmiregistry.destroy();
- }
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("TEST FAILED: " + e.toString());
+ } finally {
+ if (rmiregistry != null) {
+ rmiregistry.destroy();
+ }
+ }
}
}
--- a/jdk/test/java/rmi/registry/classPathCodebase/Dummy.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/classPathCodebase/Dummy.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,12 +36,12 @@
}
public void writeExternal(java.io.ObjectOutput out)
- throws java.io.IOException
+ throws java.io.IOException
{
}
public void readExternal(java.io.ObjectInput in)
- throws java.io.IOException, ClassNotFoundException
+ throws java.io.IOException, ClassNotFoundException
{
}
}
--- a/jdk/test/java/rmi/registry/emptyName/EmptyName.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/emptyName/EmptyName.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,12 +32,12 @@
public class EmptyName {
public static void main(String[] args) throws Exception {
- Registry impl = LocateRegistry.createRegistry(0);
- Registry stub = (Registry) RemoteObject.toStub(impl);
- stub.bind("", stub);
- stub.lookup("");
- stub.rebind("", stub);
- stub.lookup("");
- stub.unbind("");
+ Registry impl = LocateRegistry.createRegistry(0);
+ Registry stub = (Registry) RemoteObject.toStub(impl);
+ stub.bind("", stub);
+ stub.lookup("");
+ stub.rebind("", stub);
+ stub.lookup("");
+ stub.unbind("");
}
}
--- a/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -62,157 +62,157 @@
private static final String NAME = "WMM";
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4472769");
+ System.err.println("\nRegression test for bug 4472769");
- System.err.println(
- "\n=== verifying that J2SE registry's skeleton uses" +
- "\ncorrect interface hash and operation numbers:");
+ System.err.println(
+ "\n=== verifying that J2SE registry's skeleton uses" +
+ "\ncorrect interface hash and operation numbers:");
- Registry testImpl = LocateRegistry.createRegistry(PORT);
- System.err.println("created test registry on port " + PORT);
+ Registry testImpl = LocateRegistry.createRegistry(PORT);
+ System.err.println("created test registry on port " + PORT);
- RemoteRef ref = new UnicastRef(
- new LiveRef(new ObjID(ObjID.REGISTRY_ID),
- new TCPEndpoint("", PORT), false));
- Registry referenceStub = new ReferenceRegistryStub(ref);
- System.err.println("created reference registry stub: " +
- referenceStub);
+ RemoteRef ref = new UnicastRef(
+ new LiveRef(new ObjID(ObjID.REGISTRY_ID),
+ new TCPEndpoint("", PORT), false));
+ Registry referenceStub = new ReferenceRegistryStub(ref);
+ System.err.println("created reference registry stub: " +
+ referenceStub);
- referenceStub.bind(NAME, referenceStub);
- System.err.println("bound name \"" + NAME + "\" in registry");
+ referenceStub.bind(NAME, referenceStub);
+ System.err.println("bound name \"" + NAME + "\" in registry");
- String[] list = referenceStub.list();
- System.err.println("list of registry contents: " +
- Arrays.asList(list));
- if (list.length != 1 || !list[0].equals(NAME)) {
- throw new RuntimeException(
- "TEST FAILED: unexpected list contents");
- }
+ String[] list = referenceStub.list();
+ System.err.println("list of registry contents: " +
+ Arrays.asList(list));
+ if (list.length != 1 || !list[0].equals(NAME)) {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected list contents");
+ }
- Registry result = (Registry) referenceStub.lookup(NAME);
- System.err.println("lookup of name \"" + NAME + "\" returned: " +
- result);
- if (!result.equals(referenceStub)) {
- throw new RuntimeException(
- "TEST FAILED: unexpected lookup result");
- }
+ Registry result = (Registry) referenceStub.lookup(NAME);
+ System.err.println("lookup of name \"" + NAME + "\" returned: " +
+ result);
+ if (!result.equals(referenceStub)) {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected lookup result");
+ }
- referenceStub.rebind(NAME, referenceStub);
- referenceStub.unbind(NAME);
- System.err.println("unbound name \"" + NAME + "\"");
+ referenceStub.rebind(NAME, referenceStub);
+ referenceStub.unbind(NAME);
+ System.err.println("unbound name \"" + NAME + "\"");
- list = referenceStub.list();
- System.err.println("list of registry contents: " +
- Arrays.asList(list));
- if (list.length != 0) {
- throw new RuntimeException("TEST FAILED: list not empty");
- }
+ list = referenceStub.list();
+ System.err.println("list of registry contents: " +
+ Arrays.asList(list));
+ if (list.length != 0) {
+ throw new RuntimeException("TEST FAILED: list not empty");
+ }
- System.err.println("\n=== verifying that J2SE registry's stub uses" +
- "correct interface hash:");
+ System.err.println("\n=== verifying that J2SE registry's stub uses" +
+ "correct interface hash:");
- class FakeRemoteRef implements RemoteRef {
- long hash;
- int opnum;
- public RemoteCall newCall(RemoteObject obj, Operation[] op,
- int opnum, long hash)
- {
- this.hash = hash;
- this.opnum = opnum;
- throw new UnsupportedOperationException();
- }
- public void invoke(RemoteCall call) { }
- public void done(RemoteCall call) { }
- public Object invoke(Remote obj, Method method,
- Object[] args, long hash)
- {
- throw new UnsupportedOperationException();
- }
- public String getRefClass(java.io.ObjectOutput out) {
- return "FakeRemoteRef";
- }
- public int remoteHashCode() { return 1013; }
- public boolean remoteEquals(RemoteRef obj) { return false; }
- public String remoteToString() { return "FakeRemoteRef"; }
- public void writeExternal(java.io.ObjectOutput out) { }
- public void readExternal(java.io.ObjectInput in) { }
- }
- FakeRemoteRef f = new FakeRemoteRef();
+ class FakeRemoteRef implements RemoteRef {
+ long hash;
+ int opnum;
+ public RemoteCall newCall(RemoteObject obj, Operation[] op,
+ int opnum, long hash)
+ {
+ this.hash = hash;
+ this.opnum = opnum;
+ throw new UnsupportedOperationException();
+ }
+ public void invoke(RemoteCall call) { }
+ public void done(RemoteCall call) { }
+ public Object invoke(Remote obj, Method method,
+ Object[] args, long hash)
+ {
+ throw new UnsupportedOperationException();
+ }
+ public String getRefClass(java.io.ObjectOutput out) {
+ return "FakeRemoteRef";
+ }
+ public int remoteHashCode() { return 1013; }
+ public boolean remoteEquals(RemoteRef obj) { return false; }
+ public String remoteToString() { return "FakeRemoteRef"; }
+ public void writeExternal(java.io.ObjectOutput out) { }
+ public void readExternal(java.io.ObjectInput in) { }
+ }
+ FakeRemoteRef f = new FakeRemoteRef();
- Registry testRegistry = LocateRegistry.getRegistry(PORT);
- System.err.println("created original test registry stub: " +
- testRegistry);
+ Registry testRegistry = LocateRegistry.getRegistry(PORT);
+ System.err.println("created original test registry stub: " +
+ testRegistry);
- Class stubClass = testRegistry.getClass();
- System.err.println("test registry stub class: " + stubClass);
+ Class stubClass = testRegistry.getClass();
+ System.err.println("test registry stub class: " + stubClass);
- Constructor cons = stubClass.getConstructor(
- new Class[] { RemoteRef.class });
- Registry testStub = (Registry) cons.newInstance(
- new Object[] { f });
- System.err.println("created new instrumented test registry stub: " +
- testStub);
+ Constructor cons = stubClass.getConstructor(
+ new Class[] { RemoteRef.class });
+ Registry testStub = (Registry) cons.newInstance(
+ new Object[] { f });
+ System.err.println("created new instrumented test registry stub: " +
+ testStub);
- System.err.println("invoking bind:");
- try {
- testStub.bind(NAME, referenceStub);
- } catch (UnsupportedOperationException e) {
- }
- System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
- if (f.hash != 4905912898345647071L) {
- throw new RuntimeException("TEST FAILED: wrong interface hash");
- } else if (f.opnum != 0) {
- throw new RuntimeException("TEST FAILED: wrong operation number");
- }
+ System.err.println("invoking bind:");
+ try {
+ testStub.bind(NAME, referenceStub);
+ } catch (UnsupportedOperationException e) {
+ }
+ System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
+ if (f.hash != 4905912898345647071L) {
+ throw new RuntimeException("TEST FAILED: wrong interface hash");
+ } else if (f.opnum != 0) {
+ throw new RuntimeException("TEST FAILED: wrong operation number");
+ }
- System.err.println("invoking list:");
- try {
- testStub.list();
- } catch (UnsupportedOperationException e) {
- }
- System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
- if (f.hash != 4905912898345647071L) {
- throw new RuntimeException("TEST FAILED: wrong interface hash");
- } else if (f.opnum != 1) {
- throw new RuntimeException("TEST FAILED: wrong operation number");
- }
+ System.err.println("invoking list:");
+ try {
+ testStub.list();
+ } catch (UnsupportedOperationException e) {
+ }
+ System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
+ if (f.hash != 4905912898345647071L) {
+ throw new RuntimeException("TEST FAILED: wrong interface hash");
+ } else if (f.opnum != 1) {
+ throw new RuntimeException("TEST FAILED: wrong operation number");
+ }
- System.err.println("invoking lookup:");
- try {
- testStub.lookup(NAME);
- } catch (UnsupportedOperationException e) {
- }
- System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
- if (f.hash != 4905912898345647071L) {
- throw new RuntimeException("TEST FAILED: wrong interface hash");
- } else if (f.opnum != 2) {
- throw new RuntimeException("TEST FAILED: wrong operation number");
- }
+ System.err.println("invoking lookup:");
+ try {
+ testStub.lookup(NAME);
+ } catch (UnsupportedOperationException e) {
+ }
+ System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
+ if (f.hash != 4905912898345647071L) {
+ throw new RuntimeException("TEST FAILED: wrong interface hash");
+ } else if (f.opnum != 2) {
+ throw new RuntimeException("TEST FAILED: wrong operation number");
+ }
- System.err.println("invoking rebind:");
- try {
- testStub.rebind(NAME, referenceStub);
- } catch (UnsupportedOperationException e) {
- }
- System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
- if (f.hash != 4905912898345647071L) {
- throw new RuntimeException("TEST FAILED: wrong interface hash");
- } else if (f.opnum != 3) {
- throw new RuntimeException("TEST FAILED: wrong operation number");
- }
+ System.err.println("invoking rebind:");
+ try {
+ testStub.rebind(NAME, referenceStub);
+ } catch (UnsupportedOperationException e) {
+ }
+ System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
+ if (f.hash != 4905912898345647071L) {
+ throw new RuntimeException("TEST FAILED: wrong interface hash");
+ } else if (f.opnum != 3) {
+ throw new RuntimeException("TEST FAILED: wrong operation number");
+ }
- System.err.println("invoking unbind:");
- try {
- testStub.unbind(NAME);
- } catch (UnsupportedOperationException e) {
- }
- System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
- if (f.hash != 4905912898345647071L) {
- throw new RuntimeException("TEST FAILED: wrong interface hash");
- } else if (f.opnum != 4) {
- throw new RuntimeException("TEST FAILED: wrong operation number");
- }
+ System.err.println("invoking unbind:");
+ try {
+ testStub.unbind(NAME);
+ } catch (UnsupportedOperationException e) {
+ }
+ System.err.println("hash == " + f.hash + ", opnum == " + f.opnum);
+ if (f.hash != 4905912898345647071L) {
+ throw new RuntimeException("TEST FAILED: wrong interface hash");
+ } else if (f.opnum != 4) {
+ throw new RuntimeException("TEST FAILED: wrong operation number");
+ }
- System.err.println("TEST PASSED");
+ System.err.println("TEST PASSED");
}
}
--- a/jdk/test/java/rmi/registry/interfaceHash/ReferenceRegistryStub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/interfaceHash/ReferenceRegistryStub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,161 +26,161 @@
implements java.rmi.registry.Registry, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
- new java.rmi.server.Operation("java.lang.String list()[]"),
- new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
- new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
- new java.rmi.server.Operation("void unbind(java.lang.String)")
+ new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
+ new java.rmi.server.Operation("java.lang.String list()[]"),
+ new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
+ new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
+ new java.rmi.server.Operation("void unbind(java.lang.String)")
};
-
+
private static final long interfaceHash = 4905912898345647071L;
-
+
// constructors
public ReferenceRegistryStub() {
- super();
+ super();
}
public ReferenceRegistryStub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of bind(String, Remote)
public void bind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2)
- throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException
+ throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException
{
- try {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- out.writeObject($param_Remote_2);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- ref.done(call);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.rmi.AlreadyBoundException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ out.writeObject($param_Remote_2);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ ref.done(call);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.rmi.AlreadyBoundException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of list()
public java.lang.String[] list()
- throws java.rmi.AccessException, java.rmi.RemoteException
+ throws java.rmi.AccessException, java.rmi.RemoteException
{
- try {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- ref.invoke(call);
- java.lang.String[] $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String[]) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ ref.invoke(call);
+ java.lang.String[] $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.String[]) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of lookup(String)
public java.rmi.Remote lookup(java.lang.String $param_String_1)
- throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
+ throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
{
- try {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.rmi.Remote $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.Remote) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.rmi.NotBoundException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ java.rmi.Remote $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.rmi.Remote) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.rmi.NotBoundException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of rebind(String, Remote)
public void rebind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2)
- throws java.rmi.AccessException, java.rmi.RemoteException
+ throws java.rmi.AccessException, java.rmi.RemoteException
{
- try {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- out.writeObject($param_Remote_2);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- ref.done(call);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ out.writeObject($param_Remote_2);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ ref.done(call);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of unbind(String)
public void unbind(java.lang.String $param_String_1)
- throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
+ throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
{
- try {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 4, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- ref.done(call);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.rmi.NotBoundException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 4, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ ref.done(call);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.rmi.NotBoundException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,49 +41,49 @@
private static final String NAME = "MultipleRegistries";
public Object passObject(Object obj) {
- return obj;
+ return obj;
}
-
+
public static void main(String[] args) throws Exception {
-
- RemoteInterface server = null;
- RemoteInterface proxy = null;
-
- try {
- System.err.println("export object");
- server = new MultipleRegistries();
- proxy =
- (RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
+
+ RemoteInterface server = null;
+ RemoteInterface proxy = null;
- System.err.println("proxy = " + proxy);
+ try {
+ System.err.println("export object");
+ server = new MultipleRegistries();
+ proxy =
+ (RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
- System.err.println("export registries");
- Registry registryImpl1 = LocateRegistry.createRegistry(2030);
- Registry registryImpl2 = LocateRegistry.createRegistry(2040);
+ System.err.println("proxy = " + proxy);
+
+ System.err.println("export registries");
+ Registry registryImpl1 = LocateRegistry.createRegistry(2030);
+ Registry registryImpl2 = LocateRegistry.createRegistry(2040);
- System.err.println("bind remote object in registries");
- Registry registry1 = LocateRegistry.getRegistry(2030);
- Registry registry2 = LocateRegistry.getRegistry(2040);
+ System.err.println("bind remote object in registries");
+ Registry registry1 = LocateRegistry.getRegistry(2030);
+ Registry registry2 = LocateRegistry.getRegistry(2040);
- registry1.bind(NAME, proxy);
- registry2.bind(NAME, proxy);
+ registry1.bind(NAME, proxy);
+ registry2.bind(NAME, proxy);
- System.err.println("lookup remote object in registries");
+ System.err.println("lookup remote object in registries");
- RemoteInterface remote1 = (RemoteInterface) registry1.lookup(NAME);
- RemoteInterface remote2 = (RemoteInterface) registry2.lookup(NAME);
+ RemoteInterface remote1 = (RemoteInterface) registry1.lookup(NAME);
+ RemoteInterface remote2 = (RemoteInterface) registry2.lookup(NAME);
- System.err.println("invoke methods on remote objects");
- remote1.passObject(remote1);
- remote2.passObject(remote2);
+ System.err.println("invoke methods on remote objects");
+ remote1.passObject(remote1);
+ remote2.passObject(remote2);
+
+ System.err.println("TEST PASSED");
- System.err.println("TEST PASSED");
-
- } finally {
- if (proxy != null) {
- UnicastRemoteObject.unexportObject(server, true);
- }
- }
+ } finally {
+ if (proxy != null) {
+ UnicastRemoteObject.unexportObject(server, true);
+ }
+ }
}
}
--- a/jdk/test/java/rmi/registry/reexport/Reexport.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/registry/reexport/Reexport.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,13 +25,13 @@
* @bug 4120329
* @summary RMI registry creation is impossible if first attempt fails.
* @library ../../testlibrary
- * @build StreamPipe TestParams TestLibrary JavaVM
+ * @build StreamPipe TestParams TestLibrary JavaVM
* @build RegistryRunner RegistryRunner_Stub
* @build Reexport
* @run main/othervm Reexport
*/
-/*
+/*
* 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
@@ -40,7 +40,7 @@
* 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.
+ * a registry can still be created after the conflict is resolved.
*/
import java.io.*;
@@ -50,106 +50,106 @@
public class Reexport {
static public final int regport = TestLibrary.REGISTRY_PORT;
-
+
static public void main(String[] argv) {
- Registry reg = null;
+ Registry reg = null;
+
+ try {
+ System.err.println("\nregression test for 4120329\n");
+
+ // establish the registry (we hope)
+ System.err.println("Starting registry on port " + regport);
+ Reexport.makeRegistry(regport);
+
+ // Get a handle to the registry
+ System.err.println("Creating duplicate registry, this should fail...");
+ reg = createReg(true);
+
+ if (reg != null) {
+ TestLibrary.bomb("failed was able to duplicate the registry?!?");
+ }
+
+ // Kill the first registry.
+ System.err.println("Bringing down the first registry");
+ try {
+ Reexport.killRegistry();
+ } catch (Exception foo) {
+ }
+
+ // start another registry now that the first is gone; this should work
+ System.err.println("Trying again to start our own " +
+ "registry... this should work");
+
+ reg = createReg(false);
- try {
- System.err.println("\nregression test for 4120329\n");
-
- // establish the registry (we hope)
- System.err.println("Starting registry on port " + regport);
- Reexport.makeRegistry(regport);
-
- // Get a handle to the registry
- System.err.println("Creating duplicate registry, this should fail...");
- reg = createReg(true);
-
- if (reg != null) {
- TestLibrary.bomb("failed was able to duplicate the registry?!?");
- }
-
- // Kill the first registry.
- System.err.println("Bringing down the first registry");
- try {
- Reexport.killRegistry();
- } catch (Exception foo) {
- }
-
- // start another registry now that the first is gone; this should work
- System.err.println("Trying again to start our own " +
- "registry... this should work");
-
- reg = createReg(false);
-
- if (reg == null) {
- TestLibrary.bomb("Could not create registry on second try");
- }
-
- System.err.println("Test passed");
-
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- // dont leave the registry around to affect other tests.
- killRegistry();
+ if (reg == null) {
+ TestLibrary.bomb("Could not create registry on second try");
+ }
+
+ System.err.println("Test passed");
+
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ // dont leave the registry around to affect other tests.
+ killRegistry();
+
+ reg = null;
+ }
+ }
- reg = null;
- }
- }
-
static Registry createReg(boolean remoteOk) {
- Registry reg = null;
+ Registry reg = null;
- try {
- reg = LocateRegistry.createRegistry(regport);
- } catch (Throwable e) {
- if (remoteOk) {
- System.err.println("EXPECTING PORT IN USE EXCEPTION:");
- System.err.println(e.getMessage());
- e.printStackTrace();
- } else {
- TestLibrary.bomb((Exception) e);
- }
- }
+ try {
+ reg = LocateRegistry.createRegistry(regport);
+ } catch (Throwable e) {
+ if (remoteOk) {
+ System.err.println("EXPECTING PORT IN USE EXCEPTION:");
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ } else {
+ TestLibrary.bomb((Exception) e);
+ }
+ }
- return reg;
+ 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.
+ // 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 {
- JavaVM jvm = new JavaVM("RegistryRunner", "", Integer.toString(p));
- jvm.start();
- Reexport.subreg = jvm.getVM();
+ try {
+ JavaVM jvm = new JavaVM("RegistryRunner", "", Integer.toString(p));
+ jvm.start();
+ Reexport.subreg = jvm.getVM();
- } catch (IOException e) {
- // one of these is summarily dropped, can't remember which one
- System.out.println ("Test setup failed - cannot run rmiregistry");
- TestLibrary.bomb("Test setup failed - cannot run test", e);
- }
- // Slop - wait for registry to come up. This is stupid.
- try {
- Thread.sleep (5000);
- } catch (Exception whatever) {
- }
+ } catch (IOException e) {
+ // one of these is summarily dropped, can't remember which one
+ System.out.println ("Test setup failed - cannot run rmiregistry");
+ TestLibrary.bomb("Test setup failed - cannot run test", e);
+ }
+ // Slop - wait for registry to come up. This is stupid.
+ try {
+ Thread.sleep (5000);
+ } catch (Exception whatever) {
+ }
}
private static Process subreg = null;
-
+
public static void killRegistry() {
- if (Reexport.subreg != null) {
+ if (Reexport.subreg != null) {
- RegistryRunner.requestExit();
+ RegistryRunner.requestExit();
- try {
- Reexport.subreg.waitFor();
- } catch (InterruptedException ie) {
- }
- }
- Reexport.subreg = null;
- }
+ try {
+ Reexport.subreg.waitFor();
+ } catch (InterruptedException ie) {
+ }
+ }
+ Reexport.subreg = null;
+ }
}
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BenchServer.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BenchServer.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -33,7 +33,7 @@
/**
* The RMI benchmark server is a simple compute-engine-like server which allows
- * client benchmarks to create/export and unexport objects off of the server,
+ * client benchmarks to create/export and unexport objects off of the server,
* or run arbitrary tasks.
*/
public interface BenchServer extends Remote {
@@ -41,41 +41,40 @@
* Interface used for creating server-side remote objects.
*/
public interface RemoteObjectFactory extends Serializable {
- Remote create() throws RemoteException;
+ Remote create() throws RemoteException;
}
-
+
/**
* Interface used for server-side tasks.
*/
public interface Task extends Serializable {
- Object execute() throws Exception;
+ Object execute() throws Exception;
}
/**
- * Uses the given remote object factory to create a new remote object on
+ * Uses the given remote object factory to create a new remote object on
* the server side.
*/
Remote create(RemoteObjectFactory factory) throws RemoteException;
-
+
/**
- * Unexports the specified remote object. Returns true if successful,
+ * Unexports the specified remote object. Returns true if successful,
* false otherwise.
*/
boolean unexport(Remote obj, boolean force) throws RemoteException;
-
+
/**
* Execute given task.
*/
Object execute(Task task) throws Exception;
-
+
/**
* Invoke the garbage collector.
*/
void gc() throws RemoteException;
-
+
/**
* Terminate the server.
*/
void terminate(int delay) throws RemoteException;
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BenchServerImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BenchServerImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -37,8 +37,8 @@
/**
* Benchmark server implementation.
*/
-public class BenchServerImpl
- extends UnicastRemoteObject implements BenchServer
+public class BenchServerImpl
+ extends UnicastRemoteObject implements BenchServer
{
HashMap implTable = new HashMap();
@@ -47,52 +47,51 @@
*/
public BenchServerImpl() throws RemoteException {
}
-
+
/**
- * Uses the given remote object factory to create a new remote object on
+ * Uses the given remote object factory to create a new remote object on
* the server side.
*/
- public Remote create(BenchServer.RemoteObjectFactory factory)
- throws RemoteException
+ public Remote create(BenchServer.RemoteObjectFactory factory)
+ throws RemoteException
{
- Remote impl = factory.create();
- implTable.put(RemoteObject.toStub(impl), new WeakReference(impl));
- return impl;
+ Remote impl = factory.create();
+ implTable.put(RemoteObject.toStub(impl), new WeakReference(impl));
+ return impl;
}
-
+
/**
- * Unexports the specified remote object. Returns true if successful,
+ * Unexports the specified remote object. Returns true if successful,
* false otherwise.
*/
public boolean unexport(Remote obj, boolean force) throws RemoteException {
- WeakReference iref = (WeakReference) implTable.get(obj);
- if (iref == null)
- return false;
- Remote impl = (Remote) iref.get();
- if (impl == null)
- return false;
- return UnicastRemoteObject.unexportObject(impl, force);
+ WeakReference iref = (WeakReference) implTable.get(obj);
+ if (iref == null)
+ return false;
+ Remote impl = (Remote) iref.get();
+ if (impl == null)
+ return false;
+ return UnicastRemoteObject.unexportObject(impl, force);
}
-
+
/**
* Execute given task.
*/
public Object execute(BenchServer.Task task) throws Exception {
- return task.execute();
+ return task.execute();
}
-
+
/**
* Invoke the garbage collector.
*/
public void gc() throws RemoteException {
- System.gc();
+ System.gc();
}
-
+
/**
* Terminate the server.
*/
public void terminate(int delay) throws RemoteException {
- System.exit(0);
+ System.exit(0);
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BooleanArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BooleanArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class BooleanArrayCalls implements Benchmark {
interface Server extends Remote {
- public boolean[] call(boolean[] a) throws RemoteException;
+ public boolean[] call(boolean[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public boolean[] call(boolean[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public boolean[] call(boolean[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue boolean array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- boolean[] array = new boolean[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ boolean[] array = new boolean[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BooleanCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/BooleanCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class BooleanCalls implements Benchmark {
interface Server extends Remote {
- public boolean call(boolean val) throws RemoteException;
+ public boolean call(boolean val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public boolean call(boolean val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public boolean call(boolean val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue boolean calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call(true);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call(true);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ByteArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ByteArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class ByteArrayCalls implements Benchmark {
interface Server extends Remote {
- public byte[] call(byte[] a) throws RemoteException;
+ public byte[] call(byte[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public byte[] call(byte[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public byte[] call(byte[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue byte array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- byte[] array = new byte[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ byte[] array = new byte[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ByteCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ByteCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class ByteCalls implements Benchmark {
interface Server extends Remote {
- public byte call(byte val) throws RemoteException;
+ public byte call(byte val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public byte call(byte val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public byte call(byte val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue byte calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call((byte) 0);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call((byte) 0);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/CharArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/CharArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class CharArrayCalls implements Benchmark {
interface Server extends Remote {
- public char[] call(char[] a) throws RemoteException;
+ public char[] call(char[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public char[] call(char[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public char[] call(char[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue char array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- char[] array = new char[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ char[] array = new char[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/CharCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/CharCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class CharCalls implements Benchmark {
interface Server extends Remote {
- public char call(char val) throws RemoteException;
+ public char call(char val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public char call(char val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public char call(char val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue char calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call('0');
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call('0');
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ClassLoading.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ClassLoading.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,16 +45,15 @@
* Arguments: <# reps>
*/
public long run(String[] args) throws Exception {
- int reps = Integer.parseInt(args[0]);
- CodeSource csrc = getClass().getProtectionDomain().getCodeSource();
- String url = "jar:" + csrc.getLocation().toString() + ALTROOT;
-
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- RMIClassLoader.loadClass(url, CLASSNAME);
- long time = System.currentTimeMillis() - start;
-
- return time;
+ int reps = Integer.parseInt(args[0]);
+ CodeSource csrc = getClass().getProtectionDomain().getCodeSource();
+ String url = "jar:" + csrc.getLocation().toString() + ALTROOT;
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ RMIClassLoader.loadClass(url, CLASSNAME);
+ long time = System.currentTimeMillis() - start;
+
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/DoubleArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/DoubleArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class DoubleArrayCalls implements Benchmark {
interface Server extends Remote {
- public double[] call(double[] a) throws RemoteException;
+ public double[] call(double[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public double[] call(double[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public double[] call(double[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue double array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- double[] array = new double[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ double[] array = new double[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/DoubleCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/DoubleCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class DoubleCalls implements Benchmark {
interface Server extends Remote {
- public double call(double val) throws RemoteException;
+ public double call(double val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public double call(double val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public double call(double val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue double calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call(0.0);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call(0.0);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ExceptionCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ExceptionCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,43 +41,42 @@
}
interface Server extends Remote {
- public void call() throws RemoteException, FooException;
+ public void call() throws RemoteException, FooException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public void call() throws RemoteException, FooException {
- throw new FooException();
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public void call() throws RemoteException, FooException {
+ throw new FooException();
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue calls which throw exceptions.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int reps = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int reps = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++) {
- try {
- stub.call();
- } catch (FooException e) {}
- }
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++) {
+ try {
+ stub.call();
+ } catch (FooException e) {}
+ }
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ExportObjs.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ExportObjs.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of UnicastRemoteObject.exportObject().
*/
public class ExportObjs implements Benchmark {
-
+
static class RemoteObj implements Remote {
}
@@ -44,19 +44,18 @@
* Arguments: <# objects>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- Remote[] objs = new Remote[size];
- for (int i = 0; i < size; i++)
- objs[i] = new RemoteObj();
-
- long start = System.currentTimeMillis();
- for (int i = 0; i < size; i++)
- UnicastRemoteObject.exportObject(objs[i],0);
- long time = System.currentTimeMillis() - start;
-
- for (int i = 0; i < size; i++)
- UnicastRemoteObject.unexportObject(objs[i], true);
- return time;
+ int size = Integer.parseInt(args[0]);
+ Remote[] objs = new Remote[size];
+ for (int i = 0; i < size; i++)
+ objs[i] = new RemoteObj();
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < size; i++)
+ UnicastRemoteObject.exportObject(objs[i],0);
+ long time = System.currentTimeMillis() - start;
+
+ for (int i = 0; i < size; i++)
+ UnicastRemoteObject.unexportObject(objs[i], true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/FloatArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/FloatArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class FloatArrayCalls implements Benchmark {
interface Server extends Remote {
- public float[] call(float[] a) throws RemoteException;
+ public float[] call(float[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public float[] call(float[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public float[] call(float[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue float array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- float[] array = new float[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ float[] array = new float[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/FloatCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/FloatCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class FloatCalls implements Benchmark {
interface Server extends Remote {
- public float call(float val) throws RemoteException;
+ public float call(float val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public float call(float val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public float call(float val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue float calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call((float) 0.0);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call((float) 0.0);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/IntArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/IntArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class IntArrayCalls implements Benchmark {
interface Server extends Remote {
- public int[] call(int[] a) throws RemoteException;
+ public int[] call(int[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public int[] call(int[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public int[] call(int[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue int array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- int[] array = new int[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ int[] array = new int[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/IntCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/IntCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class IntCalls implements Benchmark {
interface Server extends Remote {
- public int call(int val) throws RemoteException;
+ public int call(int val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public int call(int val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public int call(int val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue int calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call(0);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call(0);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/LongArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/LongArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,42 +39,41 @@
public class LongArrayCalls implements Benchmark {
interface Server extends Remote {
- public long[] call(long[] a) throws RemoteException;
+ public long[] call(long[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public long[] call(long[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public long[] call(long[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue long array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- long[] array = new long[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ long[] array = new long[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/LongCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/LongCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class LongCalls implements Benchmark {
interface Server extends Remote {
- public long call(long val) throws RemoteException;
+ public long call(long val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public long call(long val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public long call(long val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue long calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call(0L);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call(0L);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -47,35 +47,35 @@
import java.util.Timer;
import java.util.TimerTask;
-/*
+/*
* RMI/Serialization benchmark tests.
*/
public class Main {
-
+
/**
* RMI-specific benchmark harness.
*/
static class RMIHarness extends Harness {
- /**
- * Construct new RMI benchmark harness.
- */
- RMIHarness(InputStream in) throws IOException, ConfigFormatException {
- super(in);
- }
-
- /**
- * Cleanup both client and server side in between each benchmark.
- */
- protected void cleanup() {
- System.gc();
- if (Main.runmode == CLIENT) {
- try {
- Main.server.gc();
- } catch (Exception e) {
- System.err.println("Warning: server gc failed: " + e);
- }
- }
- }
+ /**
+ * Construct new RMI benchmark harness.
+ */
+ RMIHarness(InputStream in) throws IOException, ConfigFormatException {
+ super(in);
+ }
+
+ /**
+ * Cleanup both client and server side in between each benchmark.
+ */
+ protected void cleanup() {
+ System.gc();
+ if (Main.runmode == CLIENT) {
+ try {
+ Main.server.gc();
+ } catch (Exception e) {
+ System.err.println("Warning: server gc failed: " + e);
+ }
+ }
+ }
}
static final String CONFFILE = "/bench/rmi/config";
@@ -85,7 +85,7 @@
static final int SAMEVM = 0;
static final int CLIENT = 1;
static final int SERVER = 2;
-
+
static final int TEXT = 0;
static final int HTML = 1;
static final int XML = 2;
@@ -111,7 +111,7 @@
* Returns reference to benchmark server.
*/
public static BenchServer getBenchServer() {
- return server;
+ return server;
}
/**
@@ -127,252 +127,252 @@
p.println(" -t <num hours> repeat benchmarks for specified number of hours");
p.println(" -o <file> specify output file");
p.println(" -c <file> specify (non-default) " +
- "configuration file");
+ "configuration file");
p.println(" -html format output as html " +
- "(default is text)");
+ "(default is text)");
p.println(" -xml format output as xml");
- p.println(" -client <host:port> run benchmark client using server " +
- "on specified host/port");
- p.println(" -server <port> run benchmark server on given port");
+ p.println(" -client <host:port> run benchmark client using server " +
+ "on specified host/port");
+ p.println(" -server <port> run benchmark server on given port");
}
-
+
/**
* Print error message and exit.
*/
static void die(String mesg) {
- System.err.println(mesg);
- System.exit(1);
+ System.err.println(mesg);
+ System.exit(1);
}
/**
* Stop server and exit.
*/
public static void exit() {
- switch (runmode) {
- case CLIENT:
- if (server != null) {
- try {
- server.terminate(0);
- } catch (RemoteException re) {
- // ignore
- }
- }
- default:
- System.exit(0);
- }
+ switch (runmode) {
+ case CLIENT:
+ if (server != null) {
+ try {
+ server.terminate(0);
+ } catch (RemoteException re) {
+ // ignore
+ }
+ }
+ default:
+ System.exit(0);
+ }
}
/**
* Benchmark mainline.
*/
public static void main(String[] args) {
- setupSecurity();
- parseArgs(args);
- setupStreams();
- if (list) {
- listConfig();
- } else {
- setupServer();
- if (runmode != SERVER) {
- setupHarness();
- setupReporter();
- if (exitOnTimer) {
- setupTimer(testDurationSeconds);
- while (true) {
- runBenchmarks();
- if (exitRequested) {
- exit();
- }
- }
- } else {
- runBenchmarks();
- exit();
- }
- }
- }
+ setupSecurity();
+ parseArgs(args);
+ setupStreams();
+ if (list) {
+ listConfig();
+ } else {
+ setupServer();
+ if (runmode != SERVER) {
+ setupHarness();
+ setupReporter();
+ if (exitOnTimer) {
+ setupTimer(testDurationSeconds);
+ while (true) {
+ runBenchmarks();
+ if (exitRequested) {
+ exit();
+ }
+ }
+ } else {
+ runBenchmarks();
+ exit();
+ }
+ }
+ }
}
-
+
/**
* Parse command-line arguments.
*/
static void parseArgs(String[] args) {
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-h")) {
- usage();
- System.exit(0);
- } else if (args[i].equals("-v")) {
- verbose = true;
- } else if (args[i].equals("-l")) {
- list = true;
- } else if (args[i].equals("-t")) {
- if (++i >= args.length)
- die("Error: no timeout value specified");
- try {
- exitOnTimer = true;
- testDurationSeconds = Integer.parseInt(args[i]) * 3600;
- } catch (Exception e) {
- die("Error: unable to determine timeout value");
- }
- } else if (args[i].equals("-o")) {
- if (++i >= args.length)
- die("Error: no output file specified");
- try {
- repstr = new FileOutputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-c")) {
- if (++i >= args.length)
- die("Error: no config file specified");
- try {
- confstr = new FileInputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-html")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = HTML;
- } else if (args[i].equals("-xml")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = XML;
- } else if (args[i].equals("-client")) {
- if (runmode == CLIENT)
- die("Error: multiple -client options");
- if (runmode == SERVER)
- die("Error: -client and -server options conflict");
- if (++i >= args.length)
- die("Error: -client missing host/port");
- try {
- int sepi = args[i].indexOf(':');
- host = args[i].substring(0, sepi);
- port = Integer.parseInt(args[i].substring(sepi + 1));
- } catch (Exception e) {
- die("Error: illegal host/port specified for -client");
- }
- runmode = CLIENT;
- } else if (args[i].equals("-server")) {
- if (runmode == CLIENT)
- die("Error: -client and -server options conflict");
- if (runmode == SERVER)
- die("Error: multiple -server options");
- if (++i >= args.length)
- die("Error: -server missing port");
- try {
- port = Integer.parseInt(args[i]);
- } catch (Exception e) {
- die("Error: illegal port specified for -server");
- }
- runmode = SERVER;
- } else {
- System.err.println("Illegal option: \"" + args[i] + "\"");
- usage();
- System.exit(1);
- }
- }
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("-h")) {
+ usage();
+ System.exit(0);
+ } else if (args[i].equals("-v")) {
+ verbose = true;
+ } else if (args[i].equals("-l")) {
+ list = true;
+ } else if (args[i].equals("-t")) {
+ if (++i >= args.length)
+ die("Error: no timeout value specified");
+ try {
+ exitOnTimer = true;
+ testDurationSeconds = Integer.parseInt(args[i]) * 3600;
+ } catch (Exception e) {
+ die("Error: unable to determine timeout value");
+ }
+ } else if (args[i].equals("-o")) {
+ if (++i >= args.length)
+ die("Error: no output file specified");
+ try {
+ repstr = new FileOutputStream(args[i]);
+ } catch (IOException e) {
+ die("Error: unable to open \"" + args[i] + "\"");
+ }
+ } else if (args[i].equals("-c")) {
+ if (++i >= args.length)
+ die("Error: no config file specified");
+ try {
+ confstr = new FileInputStream(args[i]);
+ } catch (IOException e) {
+ die("Error: unable to open \"" + args[i] + "\"");
+ }
+ } else if (args[i].equals("-html")) {
+ if (format != TEXT)
+ die("Error: conflicting formats");
+ format = HTML;
+ } else if (args[i].equals("-xml")) {
+ if (format != TEXT)
+ die("Error: conflicting formats");
+ format = XML;
+ } else if (args[i].equals("-client")) {
+ if (runmode == CLIENT)
+ die("Error: multiple -client options");
+ if (runmode == SERVER)
+ die("Error: -client and -server options conflict");
+ if (++i >= args.length)
+ die("Error: -client missing host/port");
+ try {
+ int sepi = args[i].indexOf(':');
+ host = args[i].substring(0, sepi);
+ port = Integer.parseInt(args[i].substring(sepi + 1));
+ } catch (Exception e) {
+ die("Error: illegal host/port specified for -client");
+ }
+ runmode = CLIENT;
+ } else if (args[i].equals("-server")) {
+ if (runmode == CLIENT)
+ die("Error: -client and -server options conflict");
+ if (runmode == SERVER)
+ die("Error: multiple -server options");
+ if (++i >= args.length)
+ die("Error: -server missing port");
+ try {
+ port = Integer.parseInt(args[i]);
+ } catch (Exception e) {
+ die("Error: illegal port specified for -server");
+ }
+ runmode = SERVER;
+ } else {
+ System.err.println("Illegal option: \"" + args[i] + "\"");
+ usage();
+ System.exit(1);
+ }
+ }
}
-
+
/**
* Set up security manager and policy, if not set already.
*/
static void setupSecurity() {
- if (System.getSecurityManager() != null)
- return;
-
- /* As of 1.4, it is too late to set the security policy
- * file at this point so these line have been commented out.
- */
- //System.setProperty("java.security.policy",
- // Main.class.getResource("/bench/rmi/policy.all").toString());
- System.setSecurityManager(new RMISecurityManager());
+ if (System.getSecurityManager() != null)
+ return;
+
+ /* As of 1.4, it is too late to set the security policy
+ * file at this point so these line have been commented out.
+ */
+ //System.setProperty("java.security.policy",
+ // Main.class.getResource("/bench/rmi/policy.all").toString());
+ System.setSecurityManager(new RMISecurityManager());
}
/**
* Set up configuration file and report streams, if not set already.
*/
static void setupStreams() {
- if (repstr == null)
- repstr = System.out;
- if (confstr == null)
- confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
- if (confstr == null)
- die("Error: unable to find default config file");
+ if (repstr == null)
+ repstr = System.out;
+ if (confstr == null)
+ confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
+ if (confstr == null)
+ die("Error: unable to find default config file");
}
-
+
/**
* Print contents of configuration file to selected output stream.
*/
static void listConfig() {
- try {
- byte[] buf = new byte[256];
- int len;
- while ((len = confstr.read(buf)) != -1)
- repstr.write(buf, 0, len);
- } catch (IOException e) {
- die("Error: failed to list config file");
- }
+ try {
+ byte[] buf = new byte[256];
+ int len;
+ while ((len = confstr.read(buf)) != -1)
+ repstr.write(buf, 0, len);
+ } catch (IOException e) {
+ die("Error: failed to list config file");
+ }
}
-
+
/**
* Setup benchmark server.
*/
static void setupServer() {
- switch (runmode) {
- case SAMEVM:
- try {
- serverImpl = new BenchServerImpl();
- server = (BenchServer) RemoteObject.toStub(serverImpl);
- } catch (Exception e) {
- die("Error: failed to create local server: " + e);
- }
- if (verbose)
- System.out.println("Benchmark server created locally");
- break;
-
- case CLIENT:
- try {
- Registry reg = LocateRegistry.getRegistry(host, port);
- server = (BenchServer) reg.lookup(REGNAME);
- } catch (Exception e) {
- die("Error: failed to connect to server: " + e);
- }
- if (server == null) {
- die("Error: server not found");
- }
- if (verbose) {
- System.out.println("Connected to benchmark server on " +
- host + ":" + port);
- }
- break;
-
- case SERVER:
- try {
- Registry reg = LocateRegistry.createRegistry(port);
- serverImpl = new BenchServerImpl();
- reg.bind(REGNAME, serverImpl);
- } catch (Exception e) {
- die("Error: failed to initialize server: " + e);
- }
- if (verbose) {
- System.out.println("Benchmark server started on port " +
- port);
- }
- break;
-
- default:
- throw new InternalError("illegal runmode");
- }
+ switch (runmode) {
+ case SAMEVM:
+ try {
+ serverImpl = new BenchServerImpl();
+ server = (BenchServer) RemoteObject.toStub(serverImpl);
+ } catch (Exception e) {
+ die("Error: failed to create local server: " + e);
+ }
+ if (verbose)
+ System.out.println("Benchmark server created locally");
+ break;
+
+ case CLIENT:
+ try {
+ Registry reg = LocateRegistry.getRegistry(host, port);
+ server = (BenchServer) reg.lookup(REGNAME);
+ } catch (Exception e) {
+ die("Error: failed to connect to server: " + e);
+ }
+ if (server == null) {
+ die("Error: server not found");
+ }
+ if (verbose) {
+ System.out.println("Connected to benchmark server on " +
+ host + ":" + port);
+ }
+ break;
+
+ case SERVER:
+ try {
+ Registry reg = LocateRegistry.createRegistry(port);
+ serverImpl = new BenchServerImpl();
+ reg.bind(REGNAME, serverImpl);
+ } catch (Exception e) {
+ die("Error: failed to initialize server: " + e);
+ }
+ if (verbose) {
+ System.out.println("Benchmark server started on port " +
+ port);
+ }
+ break;
+
+ default:
+ throw new InternalError("illegal runmode");
+ }
}
/**
* Set up the timer to end the test.
*
- * @param delay the amount of delay, in seconds, before requesting
+ * @param delay the amount of delay, in seconds, before requesting
* the process exit
*/
static void setupTimer(int delay) {
- timer = new Timer(true);
+ timer = new Timer(true);
timer.schedule(
new TimerTask() {
public void run() {
@@ -391,12 +391,12 @@
} catch (ConfigFormatException e) {
String errmsg = e.getMessage();
if (errmsg != null) {
- die("Error parsing config file: " + errmsg);
- } else {
+ die("Error parsing config file: " + errmsg);
+ } else {
die("Error: illegal config file syntax");
- }
+ }
} catch (IOException e) {
- die("Error: failed to read config file");
+ die("Error: failed to read config file");
}
}
@@ -405,24 +405,24 @@
*/
static void setupReporter() {
String title = "RMI Benchmark, v" + VERSION;
- switch (format) {
- case TEXT:
- reporter = new TextReporter(repstr, title);
- break;
-
- case HTML:
- reporter = new HtmlReporter(repstr, title);
- break;
+ switch (format) {
+ case TEXT:
+ reporter = new TextReporter(repstr, title);
+ break;
+
+ case HTML:
+ reporter = new HtmlReporter(repstr, title);
+ break;
- case XML:
- reporter = new XmlReporter(repstr, title);
- break;
-
- default:
- die("Error: unrecognized format type");
- }
+ case XML:
+ reporter = new XmlReporter(repstr, title);
+ break;
+
+ default:
+ die("Error: unrecognized format type");
+ }
}
-
+
/**
* Run benchmarks.
*/
@@ -430,4 +430,3 @@
harness.runBenchmarks(reporter, verbose);
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/NullCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/NullCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,39 +38,38 @@
public class NullCalls implements Benchmark {
interface Server extends Remote {
- public void call() throws RemoteException;
+ public void call() throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public void call() throws RemoteException {
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public void call() throws RemoteException {
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue null calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int reps = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int reps = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call();
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call();
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ObjArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ObjArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,16 +41,16 @@
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -61,44 +61,43 @@
}
interface Server extends Remote {
- public Node[] call(Node[] a) throws RemoteException;
+ public Node[] call(Node[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
+ public ServerImpl() throws RemoteException {
+ }
- public Node[] call(Node[] a) throws RemoteException {
- return a;
- }
+ public Node[] call(Node[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue calls using arrays of objects as parameters/return values.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- Node[] nodes = new Node[size];
- for (int i = 0; i < size; i++)
- nodes[i] = new Node(null, 0);
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ Node[] nodes = new Node[size];
+ for (int i = 0; i < size; i++)
+ nodes[i] = new Node(null, 0);
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(nodes);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(nodes);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ObjTreeCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ObjTreeCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,16 +41,16 @@
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -61,42 +61,41 @@
}
interface Server extends Remote {
- public Node call(Node val) throws RemoteException;
+ public Node call(Node val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
+ public ServerImpl() throws RemoteException {
+ }
- public Node call(Node val) throws RemoteException {
- return val;
- }
+ public Node call(Node val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue calls using trees of objects as parameters/return values.
* Arguments: <tree depth> <# calls>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- Node node = new Node(null, depth);
+ int depth = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ Node node = new Node(null, depth);
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(node);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(node);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ProxyArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ProxyArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -44,52 +44,52 @@
public class ProxyArrayCalls implements Benchmark {
static class DummyHandler implements InvocationHandler, Serializable {
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- return null;
- }
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ return null;
+ }
}
-
+
public static interface DummyInterface {
- public void foo();
+ public void foo();
}
interface Server extends Remote {
- public Proxy[] call(Proxy[] a) throws RemoteException;
+ public Proxy[] call(Proxy[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
+ public ServerImpl() throws RemoteException {
+ }
- public Proxy[] call(Proxy[] a) throws RemoteException {
- return a;
- }
+ public Proxy[] call(Proxy[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Generate proxy object array of the given size.
*/
Proxy[] genProxies(int size) throws Exception {
- Class proxyClass =
- Proxy.getProxyClass(DummyInterface.class.getClassLoader(),
- new Class[] { DummyInterface.class });
- Constructor proxyCons =
- proxyClass.getConstructor(new Class[] { InvocationHandler.class });
- Object[] consArgs = new Object[] { new DummyHandler() };
- Proxy[] proxies = new Proxy[size];
+ Class proxyClass =
+ Proxy.getProxyClass(DummyInterface.class.getClassLoader(),
+ new Class[] { DummyInterface.class });
+ Constructor proxyCons =
+ proxyClass.getConstructor(new Class[] { InvocationHandler.class });
+ Object[] consArgs = new Object[] { new DummyHandler() };
+ Proxy[] proxies = new Proxy[size];
- for (int i = 0; i < size; i++)
- proxies[i] = (Proxy) proxyCons.newInstance(consArgs);
+ for (int i = 0; i < size; i++)
+ proxies[i] = (Proxy) proxyCons.newInstance(consArgs);
- return proxies;
+ return proxies;
}
/**
@@ -97,19 +97,18 @@
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- Proxy[] proxies = genProxies(size);
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ Proxy[] proxies = genProxies(size);
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(proxies);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(proxies);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/RemoteObjArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/RemoteObjArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,49 +39,48 @@
public class RemoteObjArrayCalls implements Benchmark {
static class RemoteObj extends UnicastRemoteObject implements Remote {
- RemoteObj() throws RemoteException {
- }
+ RemoteObj() throws RemoteException {
+ }
}
interface Server extends Remote {
- public Remote[] call(Remote[] a) throws RemoteException;
+ public Remote[] call(Remote[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
+ public ServerImpl() throws RemoteException {
+ }
- public Remote[] call(Remote[] a) throws RemoteException {
- return a;
- }
+ public Remote[] call(Remote[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue calls using arrays of remote objects as parameters/return values.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- Remote[] objs = new Remote[size];
- for (int i = 0; i < size; i++)
- objs[i] = new RemoteObj();
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ Remote[] objs = new Remote[size];
+ for (int i = 0; i < size; i++)
+ objs[i] = new RemoteObj();
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(objs);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(objs);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ShortArrayCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ShortArrayCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -20,7 +20,7 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
-
+
/*
*
*/
@@ -39,42 +39,41 @@
public class ShortArrayCalls implements Benchmark {
interface Server extends Remote {
- public short[] call(short[] a) throws RemoteException;
+ public short[] call(short[] a) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public short[] call(short[] a) throws RemoteException {
- return a;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public short[] call(short[] a) throws RemoteException {
+ return a;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue short array calls.
* Arguments: <array size> <# calls>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- short[] array = new short[size];
+ int size = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ short[] array = new short[size];
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(array);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(array);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ShortCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/ShortCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,40 +38,39 @@
public class ShortCalls implements Benchmark {
interface Server extends Remote {
- public short call(short val) throws RemoteException;
+ public short call(short val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
-
- public short call(short val) throws RemoteException {
- return val;
- }
+ public ServerImpl() throws RemoteException {
+ }
+
+ public short call(short val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue short calls.
* Arguments: <# calls>
*/
public long run(String[] args) throws Exception {
- int cycles = Integer.parseInt(args[0]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
+ int cycles = Integer.parseInt(args[0]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
- long start = System.currentTimeMillis();
- for (int i = 0; i < cycles; i++)
- stub.call((short) 0);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < cycles; i++)
+ stub.call((short) 0);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/SmallObjTreeCalls.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/SmallObjTreeCalls.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -41,7 +41,7 @@
static class Node implements Serializable {
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -52,42 +52,41 @@
}
interface Server extends Remote {
- public Node call(Node val) throws RemoteException;
+ public Node call(Node val) throws RemoteException;
}
static class ServerImpl extends UnicastRemoteObject implements Server {
- public ServerImpl() throws RemoteException {
- }
+ public ServerImpl() throws RemoteException {
+ }
- public Node call(Node val) throws RemoteException {
- return val;
- }
+ public Node call(Node val) throws RemoteException {
+ return val;
+ }
}
-
+
static class ServerFactory implements BenchServer.RemoteObjectFactory {
- public Remote create() throws RemoteException {
- return new ServerImpl();
- }
+ public Remote create() throws RemoteException {
+ return new ServerImpl();
+ }
}
-
+
/**
* Issue calls using trees of small objects as parameters/return values.
* Arguments: <tree depth> <# calls>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int reps = Integer.parseInt(args[1]);
- BenchServer bsrv = Main.getBenchServer();
- Server stub = (Server) bsrv.create(new ServerFactory());
- Node node = new Node(null, depth);
+ int depth = Integer.parseInt(args[0]);
+ int reps = Integer.parseInt(args[1]);
+ BenchServer bsrv = Main.getBenchServer();
+ Server stub = (Server) bsrv.create(new ServerFactory());
+ Node node = new Node(null, depth);
- long start = System.currentTimeMillis();
- for (int i = 0; i < reps; i++)
- stub.call(node);
- long time = System.currentTimeMillis() - start;
-
- bsrv.unexport(stub, true);
- return time;
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < reps; i++)
+ stub.call(node);
+ long time = System.currentTimeMillis() - start;
+
+ bsrv.unexport(stub, true);
+ return time;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/BooleanArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/BooleanArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of boolean array reads/writes.
*/
public class BooleanArrays implements Benchmark {
-
+
/**
* Write and read boolean arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- boolean[][] arrays = new boolean[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ boolean[][] arrays = new boolean[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, boolean[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, boolean[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Booleans.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Booleans.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of boolean reads/writes.
*/
public class Booleans implements Benchmark {
-
+
/**
* Write and read boolean values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,40 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeBoolean(false);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readBoolean();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeBoolean(false);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readBoolean();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ByteArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ByteArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of byte array reads/writes.
*/
public class ByteArrays implements Benchmark {
-
+
/**
* Write and read byte arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- byte[][] arrays = new byte[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ byte[][] arrays = new byte[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, byte[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, byte[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Bytes.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Bytes.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of byte reads/writes.
*/
public class Bytes implements Benchmark {
-
+
/**
* Write and read byte values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeByte(0);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readByte();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeByte(0);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readByte();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/CharArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/CharArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of char array reads/writes.
*/
public class CharArrays implements Benchmark {
-
+
/**
* Write and read char arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- char[][] arrays = new char[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ char[][] arrays = new char[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, char[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, char[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Chars.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Chars.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of char reads/writes.
*/
public class Chars implements Benchmark {
-
+
/**
* Write and read char values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeChar('0');
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readChar();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeChar('0');
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readChar();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ClassDesc.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ClassDesc.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -89,41 +89,40 @@
static class Dummy48 extends Dummy47 { Dummy48 i48; }
static class Dummy49 extends Dummy48 { Dummy49 i49; }
static class Dummy50 extends Dummy49 { Dummy50 i50; }
-
+
/**
* Write and read class descriptors to/from a stream.
* Arguments: <# cycles>
*/
public long run(String[] args) throws Exception {
- int ncycles = Integer.parseInt(args[0]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
- ObjectStreamClass desc = ObjectStreamClass.lookup(Dummy50.class);
-
- doReps(oout, oin, sbuf, desc, 1); // warmup
+ int ncycles = Integer.parseInt(args[0]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
+ ObjectStreamClass desc = ObjectStreamClass.lookup(Dummy50.class);
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, desc, ncycles);
+ doReps(oout, oin, sbuf, desc, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, desc, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, ObjectStreamClass desc, int ncycles)
- throws Exception
+ StreamBuffer sbuf, ObjectStreamClass desc, int ncycles)
+ throws Exception
{
- for (int i = 0; i < ncycles; i++) {
- sbuf.reset();
- oout.reset();
- oout.writeObject(desc);
- oout.flush();
- oin.readObject();
- }
+ for (int i = 0; i < ncycles; i++) {
+ sbuf.reset();
+ oout.reset();
+ oout.writeObject(desc);
+ oout.flush();
+ oin.readObject();
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Cons.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Cons.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -53,29 +53,28 @@
public long run(String[] args) throws Exception {
int reps = Integer.parseInt(args[0]);
Dummy dummy = new Dummy();
- StreamBuffer sbuf = new StreamBuffer();
-
- doReps(sbuf, dummy, 1); // warmup
+ StreamBuffer sbuf = new StreamBuffer();
- long start = System.currentTimeMillis();
- doReps(sbuf, dummy, reps);
+ doReps(sbuf, dummy, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(sbuf, dummy, reps);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of cycles.
*/
void doReps(StreamBuffer sbuf, Dummy dummy, int reps) throws Exception {
- OutputStream out = sbuf.getOutputStream();
- InputStream in = sbuf.getInputStream();
- for (int i = 0; i < reps; i++) {
- sbuf.reset();
- ObjectOutputStream oout = new ObjectOutputStream(out);
- oout.writeObject(dummy);
- oout.flush();
- ObjectInputStream oin = new ObjectInputStream(in);
- oin.readObject();
- }
+ OutputStream out = sbuf.getOutputStream();
+ InputStream in = sbuf.getInputStream();
+ for (int i = 0; i < reps; i++) {
+ sbuf.reset();
+ ObjectOutputStream oout = new ObjectOutputStream(out);
+ oout.writeObject(dummy);
+ oout.flush();
+ ObjectInputStream oin = new ObjectInputStream(in);
+ oin.readObject();
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomDefaultObjTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomDefaultObjTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,19 +39,19 @@
* defaultWriteObject() and defaultReadObject().
*/
public class CustomDefaultObjTrees implements Benchmark {
-
+
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -61,13 +61,13 @@
}
private void writeObject(ObjectOutputStream out) throws IOException {
- out.defaultWriteObject();
+ out.defaultWriteObject();
}
-
- private void readObject(ObjectInputStream in)
+
+ private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
- in.defaultReadObject();
+ in.defaultReadObject();
}
}
@@ -79,20 +79,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -100,33 +100,32 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
- * Run benchmark for given number of batches, with each batch containing
+ * Run benchmark for given number of batches, with each batch containing
* the given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomObjTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomObjTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,19 +38,19 @@
* nodes contain custom writeObject() and readObject() methods.
*/
public class CustomObjTrees implements Benchmark {
-
+
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -60,35 +60,35 @@
}
private void writeObject(ObjectOutputStream out) throws IOException {
- out.writeBoolean(z);
- out.writeByte(b);
- out.writeChar(c);
- out.writeShort(s);
- out.writeInt(i);
- out.writeFloat(f);
- out.writeLong(j);
- out.writeDouble(d);
- out.writeObject(str);
- out.writeObject(parent);
- out.writeObject(left);
- out.writeObject(right);
+ out.writeBoolean(z);
+ out.writeByte(b);
+ out.writeChar(c);
+ out.writeShort(s);
+ out.writeInt(i);
+ out.writeFloat(f);
+ out.writeLong(j);
+ out.writeDouble(d);
+ out.writeObject(str);
+ out.writeObject(parent);
+ out.writeObject(left);
+ out.writeObject(right);
}
-
- private void readObject(ObjectInputStream in)
+
+ private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
- z = in.readBoolean();
- b = in.readByte();
- c = in.readChar();
- s = in.readShort();
- i = in.readInt();
- f = in.readFloat();
- j = in.readLong();
- d = in.readDouble();
- str = (String) in.readObject();
- parent = in.readObject();
- left = in.readObject();
- right = in.readObject();
+ z = in.readBoolean();
+ b = in.readByte();
+ c = in.readChar();
+ s = in.readShort();
+ i = in.readInt();
+ f = in.readFloat();
+ j = in.readLong();
+ d = in.readDouble();
+ str = (String) in.readObject();
+ parent = in.readObject();
+ left = in.readObject();
+ right = in.readObject();
}
}
@@ -100,20 +100,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -121,33 +121,32 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
- * Run benchmark for given number of batches, with each batch containing
+ * Run benchmark for given number of batches, with each batch containing
* the given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/DoubleArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/DoubleArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of double array reads/writes.
*/
public class DoubleArrays implements Benchmark {
-
+
/**
* Write and read double arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- double[][] arrays = new double[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ double[][] arrays = new double[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, double[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, double[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Doubles.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Doubles.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of double reads/writes.
*/
public class Doubles implements Benchmark {
-
+
/**
* Write and read double values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeDouble(0.0);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readDouble();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeDouble(0.0);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readDouble();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ExternObjTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ExternObjTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -40,19 +40,19 @@
* objects.
*/
public class ExternObjTrees implements Benchmark {
-
+
static class Node implements Externalizable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -61,40 +61,40 @@
}
}
- public Node() {
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeBoolean(z);
- out.writeByte(b);
- out.writeChar(c);
- out.writeShort(s);
- out.writeInt(i);
- out.writeFloat(f);
- out.writeLong(j);
- out.writeDouble(d);
- out.writeObject(str);
- out.writeObject(parent);
- out.writeObject(left);
- out.writeObject(right);
- }
-
- public void readExternal(ObjectInput in)
- throws IOException, ClassNotFoundException
- {
- z = in.readBoolean();
- b = in.readByte();
- c = in.readChar();
- s = in.readShort();
- i = in.readInt();
- f = in.readFloat();
- j = in.readLong();
- d = in.readDouble();
- str = (String) in.readObject();
- parent = in.readObject();
- left = in.readObject();
- right = in.readObject();
- }
+ public Node() {
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeBoolean(z);
+ out.writeByte(b);
+ out.writeChar(c);
+ out.writeShort(s);
+ out.writeInt(i);
+ out.writeFloat(f);
+ out.writeLong(j);
+ out.writeDouble(d);
+ out.writeObject(str);
+ out.writeObject(parent);
+ out.writeObject(left);
+ out.writeObject(right);
+ }
+
+ public void readExternal(ObjectInput in)
+ throws IOException, ClassNotFoundException
+ {
+ z = in.readBoolean();
+ b = in.readByte();
+ c = in.readChar();
+ s = in.readShort();
+ i = in.readInt();
+ f = in.readFloat();
+ j = in.readLong();
+ d = in.readDouble();
+ str = (String) in.readObject();
+ parent = in.readObject();
+ left = in.readObject();
+ right = in.readObject();
+ }
}
/**
@@ -105,20 +105,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -126,33 +126,32 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
- * Run benchmark for given number of batches, with each batch containing
+ * Run benchmark for given number of batches, with each batch containing
* the given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/FloatArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/FloatArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of float array reads/writes.
*/
public class FloatArrays implements Benchmark {
-
+
/**
* Write and read float arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- float[][] arrays = new float[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ float[][] arrays = new float[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, float[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, float[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Floats.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Floats.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of float reads/writes.
*/
public class Floats implements Benchmark {
-
+
/**
* Write and read float values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeFloat((float) 0.0);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readFloat();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeFloat((float) 0.0);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readFloat();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/GetPutFieldTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/GetPutFieldTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,19 +39,19 @@
* GetField()/PutField() API.
*/
public class GetPutFieldTrees implements Benchmark {
-
+
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -76,19 +76,19 @@
fields.put("right", right);
out.writeFields();
}
-
- private void readObject(ObjectInputStream in)
+
+ private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException
{
ObjectInputStream.GetField fields = in.readFields();
- z = fields.get("z", false);
- b = fields.get("b", (byte) 0);
- c = fields.get("c", (char) 0);
- s = fields.get("s", (short) 0);
- i = fields.get("i", (int) 0);
- f = fields.get("f", (float) 0.0);
- j = fields.get("j", (long) 0);
- d = fields.get("d", (double) 0.0);
+ z = fields.get("z", false);
+ b = fields.get("b", (byte) 0);
+ c = fields.get("c", (char) 0);
+ s = fields.get("s", (short) 0);
+ i = fields.get("i", (int) 0);
+ f = fields.get("f", (float) 0.0);
+ j = fields.get("j", (long) 0);
+ d = fields.get("d", (double) 0.0);
str = (String) fields.get("str", null);
parent = fields.get("parent", null);
left = fields.get("left", null);
@@ -104,20 +104,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -125,33 +125,32 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
- * Run benchmark for given number of batches, with each batch containing
+ * Run benchmark for given number of batches, with each batch containing
* the given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/IntArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/IntArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of int array reads/writes.
*/
public class IntArrays implements Benchmark {
-
+
/**
* Write and read int arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- int[][] arrays = new int[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ int[][] arrays = new int[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, int[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Ints.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Ints.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of int reads/writes.
*/
public class Ints implements Benchmark {
-
+
/**
* Write and read int values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeInt(0);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readInt();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeInt(0);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readInt();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/LongArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/LongArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of long array reads/writes.
*/
public class LongArrays implements Benchmark {
-
+
/**
* Write and read long arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- long[][] arrays = new long[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ long[][] arrays = new long[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, long[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, long[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Longs.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Longs.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of long reads/writes.
*/
public class Longs implements Benchmark {
-
+
/**
* Write and read long values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeLong(0);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readLong();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeLong(0);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readLong();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Main.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -46,7 +46,7 @@
* Object serialization benchmark mainline.
*/
public class Main {
-
+
static final String CONFFILE = "/bench/serial/config";
static final String VERSION = "1.3";
@@ -80,55 +80,55 @@
p.println(" -o <file> specify output file");
p.println(" -c <file> specify (non-default) configuration file");
p.println(" -html format output as html (default is text)");
- p.println(" -xml format output as xml");
+ p.println(" -xml format output as xml");
}
/**
* Print error message and exit.
*/
static void die(String mesg) {
- System.err.println(mesg);
- System.exit(1);
+ System.err.println(mesg);
+ System.exit(1);
}
/**
* Mainline parses command line, then hands off to benchmark harness.
*/
public static void main(String[] args) {
- parseArgs(args);
- setupStreams();
- if (list) {
- listConfig();
- } else {
- setupHarness();
- setupReporter();
- if (exitOnTimer) {
- setupTimer(testDurationSeconds);
- while (true) {
- runBenchmarks();
- if (exitRequested) {
- System.exit(0);
- }
- }
- } else {
- runBenchmarks();
- System.exit(0);
- }
- }
+ parseArgs(args);
+ setupStreams();
+ if (list) {
+ listConfig();
+ } else {
+ setupHarness();
+ setupReporter();
+ if (exitOnTimer) {
+ setupTimer(testDurationSeconds);
+ while (true) {
+ runBenchmarks();
+ if (exitRequested) {
+ System.exit(0);
+ }
+ }
+ } else {
+ runBenchmarks();
+ System.exit(0);
+ }
+ }
}
-
+
/**
* Parse command-line arguments.
*/
static void parseArgs(String[] args) {
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-h")) {
- usage();
- System.exit(0);
- } else if (args[i].equals("-v")) {
- verbose = true;
- } else if (args[i].equals("-l")) {
- list = true;
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("-h")) {
+ usage();
+ System.exit(0);
+ } else if (args[i].equals("-v")) {
+ verbose = true;
+ } else if (args[i].equals("-l")) {
+ list = true;
} else if (args[i].equals("-t")) {
if (++i >= args.length)
die("Error: no timeout value specified");
@@ -138,64 +138,64 @@
} catch (Exception e) {
die("Error: unable to determine timeout value");
}
- } else if (args[i].equals("-o")) {
- if (++i >= args.length)
- die("Error: no output file specified");
- try {
- repstr = new FileOutputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-c")) {
- if (++i >= args.length)
- die("Error: no config file specified");
- try {
- confstr = new FileInputStream(args[i]);
- } catch (IOException e) {
- die("Error: unable to open \"" + args[i] + "\"");
- }
- } else if (args[i].equals("-html")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = HTML;
- } else if (args[i].equals("-xml")) {
- if (format != TEXT)
- die("Error: conflicting formats");
- format = XML;
- } else {
- System.err.println("Illegal option: \"" + args[i] + "\"");
- usage();
- System.exit(1);
- }
- }
+ } else if (args[i].equals("-o")) {
+ if (++i >= args.length)
+ die("Error: no output file specified");
+ try {
+ repstr = new FileOutputStream(args[i]);
+ } catch (IOException e) {
+ die("Error: unable to open \"" + args[i] + "\"");
+ }
+ } else if (args[i].equals("-c")) {
+ if (++i >= args.length)
+ die("Error: no config file specified");
+ try {
+ confstr = new FileInputStream(args[i]);
+ } catch (IOException e) {
+ die("Error: unable to open \"" + args[i] + "\"");
+ }
+ } else if (args[i].equals("-html")) {
+ if (format != TEXT)
+ die("Error: conflicting formats");
+ format = HTML;
+ } else if (args[i].equals("-xml")) {
+ if (format != TEXT)
+ die("Error: conflicting formats");
+ format = XML;
+ } else {
+ System.err.println("Illegal option: \"" + args[i] + "\"");
+ usage();
+ System.exit(1);
+ }
+ }
}
-
+
/**
* Set up configuration file and report streams, if not set already.
*/
static void setupStreams() {
- if (repstr == null)
- repstr = System.out;
- if (confstr == null)
- confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
- if (confstr == null)
- die("Error: unable to find default config file");
+ if (repstr == null)
+ repstr = System.out;
+ if (confstr == null)
+ confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
+ if (confstr == null)
+ die("Error: unable to find default config file");
}
-
+
/**
* Print contents of configuration file to selected output stream.
*/
static void listConfig() {
- try {
- byte[] buf = new byte[256];
- int len;
- while ((len = confstr.read(buf)) != -1)
- repstr.write(buf, 0, len);
- } catch (IOException e) {
- die("Error: failed to list config file");
- }
+ try {
+ byte[] buf = new byte[256];
+ int len;
+ while ((len = confstr.read(buf)) != -1)
+ repstr.write(buf, 0, len);
+ } catch (IOException e) {
+ die("Error: failed to list config file");
+ }
}
-
+
/**
* Set up the timer to end the test.
*
@@ -222,12 +222,12 @@
} catch (ConfigFormatException e) {
String errmsg = e.getMessage();
if (errmsg != null) {
- die("Error parsing config file: " + errmsg);
- } else {
+ die("Error parsing config file: " + errmsg);
+ } else {
die("Error: illegal config file syntax");
- }
+ }
} catch (IOException e) {
- die("Error: failed to read config file");
+ die("Error: failed to read config file");
}
}
@@ -236,22 +236,22 @@
*/
static void setupReporter() {
String title = "Object Serialization Benchmark, v" + VERSION;
- switch (format) {
- case TEXT:
- reporter = new TextReporter(repstr, title);
- break;
-
- case HTML:
- reporter = new HtmlReporter(repstr, title);
- break;
+ switch (format) {
+ case TEXT:
+ reporter = new TextReporter(repstr, title);
+ break;
- case XML:
- reporter = new XmlReporter(repstr, title);
- break;
-
- default:
- die("Error: unrecognized format type");
- }
+ case HTML:
+ reporter = new HtmlReporter(repstr, title);
+ break;
+
+ case XML:
+ reporter = new XmlReporter(repstr, title);
+ break;
+
+ default:
+ die("Error: unrecognized format type");
+ }
}
/**
@@ -261,4 +261,3 @@
harness.runBenchmarks(reporter, verbose);
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ObjArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ObjArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,16 +39,16 @@
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -57,7 +57,7 @@
}
}
}
-
+
/**
* Write and read object arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -66,34 +66,34 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[][] arrays = genArrays(size, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[][] arrays = genArrays(size, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Generate object arrays.
*/
Node[][] genArrays(int size, int narrays) {
- Node[][] arrays = new Node[narrays][size];
- for (int i = 0; i < narrays; i++) {
- for (int j = 0; j < size; j++) {
- arrays[i][j] = new Node(null, 0);
- }
- }
- return arrays;
+ Node[][] arrays = new Node[narrays][size];
+ for (int i = 0; i < narrays; i++) {
+ for (int j = 0; j < size; j++) {
+ arrays[i][j] = new Node(null, 0);
+ }
+ }
+ return arrays;
}
/**
@@ -101,22 +101,20 @@
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ObjTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ObjTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,19 +36,19 @@
* Benchmark for testing speed of writes and reads of an object tree.
*/
public class ObjTrees implements Benchmark {
-
+
static class Node implements Serializable {
boolean z;
- byte b;
- char c;
- short s;
- int i;
- float f;
- long j;
- double d;
- String str = "bodega";
+ byte b;
+ char c;
+ short s;
+ int i;
+ float f;
+ long j;
+ double d;
+ String str = "bodega";
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -66,20 +66,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -87,33 +87,32 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
- * Run benchmark for given number of batches, with each batch containing
+ * Run benchmark for given number of batches, with each batch containing
* the given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ProxyArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ProxyArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -42,15 +42,15 @@
public class ProxyArrays implements Benchmark {
static class DummyHandler implements InvocationHandler, Serializable {
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable
- {
- return null;
- }
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable
+ {
+ return null;
+ }
}
-
+
static interface DummyInterface {
- public void foo();
+ public void foo();
}
/**
@@ -61,40 +61,40 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Proxy[][] arrays = genArrays(size, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Proxy[][] arrays = genArrays(size, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Generate proxy arrays.
*/
Proxy[][] genArrays(int size, int narrays) throws Exception {
- Class proxyClass =
- Proxy.getProxyClass(DummyInterface.class.getClassLoader(),
- new Class[] { DummyInterface.class });
- Constructor proxyCons =
- proxyClass.getConstructor(new Class[] { InvocationHandler.class });
- Object[] consArgs = new Object[] { new DummyHandler() };
- Proxy[][] arrays = new Proxy[narrays][size];
- for (int i = 0; i < narrays; i++) {
- for (int j = 0; j < size; j++) {
- arrays[i][j] = (Proxy) proxyCons.newInstance(consArgs);
- }
- }
- return arrays;
+ Class proxyClass =
+ Proxy.getProxyClass(DummyInterface.class.getClassLoader(),
+ new Class[] { DummyInterface.class });
+ Constructor proxyCons =
+ proxyClass.getConstructor(new Class[] { InvocationHandler.class });
+ Object[] consArgs = new Object[] { new DummyHandler() };
+ Proxy[][] arrays = new Proxy[narrays][size];
+ for (int i = 0; i < narrays; i++) {
+ for (int j = 0; j < size; j++) {
+ arrays[i][j] = (Proxy) proxyCons.newInstance(consArgs);
+ }
+ }
+ return arrays;
}
/**
@@ -102,22 +102,20 @@
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Proxy[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Proxy[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ProxyClassDesc.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ProxyClassDesc.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,7 +38,7 @@
* Benchmark for testing speed of proxy class descriptor reads/writes.
*/
public class ProxyClassDesc implements Benchmark {
-
+
static interface A1 {};
static interface A2 {};
static interface A3 {};
@@ -54,75 +54,74 @@
static interface C3 {};
static interface C4 {};
static interface C5 {};
-
+
/**
* Write and read proxy class descriptors to/from a stream.
* Arguments: <# cycles>
*/
public long run(String[] args) throws Exception {
- int ncycles = Integer.parseInt(args[0]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
- ObjectStreamClass[] descs = genDescs();
+ int ncycles = Integer.parseInt(args[0]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
+ ObjectStreamClass[] descs = genDescs();
- doReps(oout, oin, sbuf, descs, 1); // warmup
+ doReps(oout, oin, sbuf, descs, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, descs, ncycles);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, descs, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Generate proxy class descriptors.
*/
ObjectStreamClass[] genDescs() {
- ClassLoader ldr = ProxyClassDesc.class.getClassLoader();
- Class[] ifaces = new Class[3];
- Class[] a =
- new Class[] { A1.class, A2.class, A3.class, A4.class, A5.class };
- Class[] b =
- new Class[] { B1.class, B2.class, B3.class, B4.class, B5.class };
- Class[] c =
- new Class[] { C1.class, C2.class, C3.class, C4.class, C5.class };
- ObjectStreamClass[] descs =
- new ObjectStreamClass[a.length * b.length * c.length];
- int n = 0;
- for (int i = 0; i < a.length; i++) {
- ifaces[0] = a[i];
- for (int j = 0; j < b.length; j++) {
- ifaces[1] = b[j];
- for (int k = 0; k < c.length; k++) {
- ifaces[2] = c[k];
- Class proxyClass = Proxy.getProxyClass(ldr, ifaces);
- descs[n++] = ObjectStreamClass.lookup(proxyClass);
- }
- }
- }
- return descs;
+ ClassLoader ldr = ProxyClassDesc.class.getClassLoader();
+ Class[] ifaces = new Class[3];
+ Class[] a =
+ new Class[] { A1.class, A2.class, A3.class, A4.class, A5.class };
+ Class[] b =
+ new Class[] { B1.class, B2.class, B3.class, B4.class, B5.class };
+ Class[] c =
+ new Class[] { C1.class, C2.class, C3.class, C4.class, C5.class };
+ ObjectStreamClass[] descs =
+ new ObjectStreamClass[a.length * b.length * c.length];
+ int n = 0;
+ for (int i = 0; i < a.length; i++) {
+ ifaces[0] = a[i];
+ for (int j = 0; j < b.length; j++) {
+ ifaces[1] = b[j];
+ for (int k = 0; k < c.length; k++) {
+ ifaces[2] = c[k];
+ Class proxyClass = Proxy.getProxyClass(ldr, ifaces);
+ descs[n++] = ObjectStreamClass.lookup(proxyClass);
+ }
+ }
+ }
+ return descs;
}
/**
* Run benchmark for given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, ObjectStreamClass[] descs, int ncycles)
- throws Exception
+ StreamBuffer sbuf, ObjectStreamClass[] descs, int ncycles)
+ throws Exception
{
- int ndescs = descs.length;
- for (int i = 0; i < ncycles; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ndescs; j++) {
- oout.writeObject(descs[j]);
- }
- oout.flush();
- for (int j = 0; j < ndescs; j++) {
- oin.readObject();
- }
- }
+ int ndescs = descs.length;
+ for (int i = 0; i < ncycles; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ndescs; j++) {
+ oout.writeObject(descs[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ndescs; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/RepeatObjs.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/RepeatObjs.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,7 +36,7 @@
* Benchmark for testing speed of reads/writes of repeated objects.
*/
public class RepeatObjs implements Benchmark {
-
+
static class Node implements Serializable {
}
@@ -49,50 +49,49 @@
* Arguments: <# objects> <# cycles>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- Node[] objs = genObjs(size);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, objs, 1); // warmup
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ Node[] objs = genObjs(size);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, objs, nbatches);
+ doReps(oout, oin, sbuf, objs, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, objs, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Generate objects.
*/
Node[] genObjs(int nobjs) {
- Node[] objs = new Node[nobjs];
- for (int i = 0; i < nobjs; i++)
- objs[i] = new Node();
- return objs;
+ Node[] objs = new Node[nobjs];
+ for (int i = 0; i < nobjs; i++)
+ objs[i] = new Node();
+ return objs;
}
-
+
/**
* Run benchmark for given number of batches.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] objs, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] objs, int nbatches)
+ throws Exception
{
- int nobjs = objs.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < nobjs; j++) {
- oout.writeObject(objs[j]);
- }
- oout.flush();
- for (int j = 0; j < nobjs; j++) {
- oin.readObject();
- }
- }
+ int nobjs = objs.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < nobjs; j++) {
+ oout.writeObject(objs[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < nobjs; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ReplaceTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ReplaceTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -37,15 +37,15 @@
* objects.
*/
public class ReplaceTrees implements Benchmark {
-
+
static class Node implements Serializable {
Object parent, left, right;
-
- Node(Object parent, Object left, Object right) {
- this.parent = parent;
- this.left = left;
- this.right = right;
- }
+
+ Node(Object parent, Object left, Object right) {
+ this.parent = parent;
+ this.left = left;
+ this.right = right;
+ }
Node(Object parent, int depth) {
this.parent = parent;
@@ -54,26 +54,26 @@
right = new Node(this, depth - 1);
}
}
-
- Object writeReplace() {
- return new RepNode(parent, left, right);
- }
+
+ Object writeReplace() {
+ return new RepNode(parent, left, right);
+ }
}
-
+
static class RepNode implements Serializable {
- Object parent, left, right;
-
- RepNode(Object parent, Object left, Object right) {
- this.parent = parent;
- this.left = left;
- this.right = right;
- }
-
- Object readResolve() {
- return new Node(parent, left, right);
- }
+ Object parent, left, right;
+
+ RepNode(Object parent, Object left, Object right) {
+ this.parent = parent;
+ this.left = left;
+ this.right = right;
+ }
+
+ Object readResolve() {
+ return new Node(parent, left, right);
+ }
}
-
+
/**
* Write and read a tree of replaceable objects from a stream. The
* benchmark is run in batches: each "batch" consists of a fixed number of
@@ -82,20 +82,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -103,11 +103,11 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
@@ -115,21 +115,20 @@
* the given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/ShortArrays.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/ShortArrays.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of short array reads/writes.
*/
public class ShortArrays implements Benchmark {
-
+
/**
* Write and read short arrays to/from a stream. The benchmark is run in
* batches, with each batch consisting of a fixed number of read/write
@@ -44,44 +44,42 @@
* Arguments: <array size> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int size = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- short[][] arrays = new short[ncycles][size];
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
+ int size = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ short[][] arrays = new short[ncycles][size];
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- doReps(oout, oin, sbuf, arrays, 1); // warmup
+ doReps(oout, oin, sbuf, arrays, 1); // warmup
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, arrays, nbatches);
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, arrays, nbatches);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, short[][] arrays, int nbatches)
- throws Exception
+ StreamBuffer sbuf, short[][] arrays, int nbatches)
+ throws Exception
{
- int ncycles = arrays.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(arrays[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = arrays.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(arrays[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Shorts.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Shorts.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -35,7 +35,7 @@
* Benchmark for testing speed of short reads/writes.
*/
public class Shorts implements Benchmark {
-
+
/**
* Write and read short values to/from a stream. The benchmark is run in
* batches: each "batch" consists of a fixed number of read/write cycles,
@@ -44,39 +44,38 @@
* Arguments: <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int nbatches = Integer.parseInt(args[0]);
- int ncycles = Integer.parseInt(args[1]);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, 1, ncycles); // warmup
+ int nbatches = Integer.parseInt(args[0]);
+ int ncycles = Integer.parseInt(args[1]);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, nbatches, ncycles);
+ doReps(oout, oin, sbuf, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
-
+
/**
* Run benchmark for given number of batches, with given number of cycles
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeShort(0);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readShort();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeShort(0);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readShort();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/SmallObjTrees.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/SmallObjTrees.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,10 +36,10 @@
* Benchmark for testing speed of writes and reads of a tree of small objects.
*/
public class SmallObjTrees implements Benchmark {
-
+
static class Node implements Serializable {
Object parent, left, right;
-
+
Node(Object parent, int depth) {
this.parent = parent;
if (depth > 0) {
@@ -57,20 +57,20 @@
* Arguments: <tree depth> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int depth = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- Node[] trees = genTrees(depth, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, trees, 1); // warmup
+ int depth = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ Node[] trees = genTrees(depth, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, trees, nbatches);
+ doReps(oout, oin, sbuf, trees, 1); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, trees, nbatches);
return System.currentTimeMillis() - start;
}
@@ -78,11 +78,11 @@
* Generate object trees.
*/
Node[] genTrees(int depth, int ntrees) {
- Node[] trees = new Node[ntrees];
- for (int i = 0; i < ntrees; i++) {
- trees[i] = new Node(null, depth);
- }
- return trees;
+ Node[] trees = new Node[ntrees];
+ for (int i = 0; i < ntrees; i++) {
+ trees[i] = new Node(null, depth);
+ }
+ return trees;
}
/**
@@ -90,21 +90,20 @@
* given number of cycles.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, Node[] trees, int nbatches)
- throws Exception
+ StreamBuffer sbuf, Node[] trees, int nbatches)
+ throws Exception
{
- int ncycles = trees.length;
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(trees[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ int ncycles = trees.length;
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(trees[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/StreamBuffer.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/StreamBuffer.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -47,85 +47,85 @@
* StreamBufferInputStream.read().
*/
public class StreamBuffer {
-
+
/**
* Output stream for writing to stream buffer.
*/
private class StreamBufferOutputStream extends OutputStream {
-
- private int pos;
+
+ private int pos;
+
+ public void write(int b) throws IOException {
+ if (mode != WRITE_MODE)
+ throw new IOException();
+ while (pos >= buf.length)
+ grow();
+ buf[pos++] = (byte) b;
+ }
- public void write(int b) throws IOException {
- if (mode != WRITE_MODE)
- throw new IOException();
- while (pos >= buf.length)
- grow();
- buf[pos++] = (byte) b;
- }
-
- public void write(byte[] b, int off, int len) throws IOException {
- if (mode != WRITE_MODE)
- throw new IOException();
- while (pos + len > buf.length)
- grow();
- System.arraycopy(b, off, buf, pos, len);
- pos += len;
- }
-
- public void close() throws IOException {
- if (mode != WRITE_MODE)
- throw new IOException();
- mode = READ_MODE;
- }
+ public void write(byte[] b, int off, int len) throws IOException {
+ if (mode != WRITE_MODE)
+ throw new IOException();
+ while (pos + len > buf.length)
+ grow();
+ System.arraycopy(b, off, buf, pos, len);
+ pos += len;
+ }
+
+ public void close() throws IOException {
+ if (mode != WRITE_MODE)
+ throw new IOException();
+ mode = READ_MODE;
+ }
}
-
+
/**
* Input stream for reading from stream buffer.
*/
private class StreamBufferInputStream extends InputStream {
-
- private int pos;
+
+ private int pos;
+
+ public int read() throws IOException {
+ if (mode == CLOSED_MODE)
+ throw new IOException();
+ mode = READ_MODE;
+ return (pos < out.pos) ? (buf[pos++] & 0xFF) : -1;
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException {
+ if (mode == CLOSED_MODE)
+ throw new IOException();
+ mode = READ_MODE;
+ int avail = out.pos - pos;
+ int rlen = (avail < len) ? avail : len;
+ System.arraycopy(buf, pos, b, off, rlen);
+ pos += rlen;
+ return rlen;
+ }
- public int read() throws IOException {
- if (mode == CLOSED_MODE)
- throw new IOException();
- mode = READ_MODE;
- return (pos < out.pos) ? (buf[pos++] & 0xFF) : -1;
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- if (mode == CLOSED_MODE)
- throw new IOException();
- mode = READ_MODE;
- int avail = out.pos - pos;
- int rlen = (avail < len) ? avail : len;
- System.arraycopy(buf, pos, b, off, rlen);
- pos += rlen;
- return rlen;
- }
-
- public long skip(long len) throws IOException {
- if (mode == CLOSED_MODE)
- throw new IOException();
- mode = READ_MODE;
- int avail = out.pos - pos;
- long slen = (avail < len) ? avail : len;
- pos += slen;
- return slen;
- }
+ public long skip(long len) throws IOException {
+ if (mode == CLOSED_MODE)
+ throw new IOException();
+ mode = READ_MODE;
+ int avail = out.pos - pos;
+ long slen = (avail < len) ? avail : len;
+ pos += slen;
+ return slen;
+ }
- public int available() throws IOException {
- if (mode == CLOSED_MODE)
- throw new IOException();
- mode = READ_MODE;
- return out.pos - pos;
- }
-
- public void close() throws IOException {
- if (mode == CLOSED_MODE)
- throw new IOException();
- mode = CLOSED_MODE;
- }
+ public int available() throws IOException {
+ if (mode == CLOSED_MODE)
+ throw new IOException();
+ mode = READ_MODE;
+ return out.pos - pos;
+ }
+
+ public void close() throws IOException {
+ if (mode == CLOSED_MODE)
+ throw new IOException();
+ mode = CLOSED_MODE;
+ }
}
private static final int START_BUFSIZE = 256;
@@ -140,30 +140,29 @@
private int mode = WRITE_MODE;
public StreamBuffer() {
- this(START_BUFSIZE);
+ this(START_BUFSIZE);
}
-
+
public StreamBuffer(int size) {
- buf = new byte[size];
+ buf = new byte[size];
}
-
+
public OutputStream getOutputStream() {
- return out;
+ return out;
}
-
+
public InputStream getInputStream() {
- return in;
+ return in;
}
-
+
public void reset() {
- in.pos = out.pos = 0;
- mode = WRITE_MODE;
+ in.pos = out.pos = 0;
+ mode = WRITE_MODE;
}
-
+
private void grow() {
- byte[] newbuf = new byte[buf.length * GROW_FACTOR];
- System.arraycopy(buf, 0, newbuf, 0, buf.length);
- buf = newbuf;
+ byte[] newbuf = new byte[buf.length * GROW_FACTOR];
+ System.arraycopy(buf, 0, newbuf, 0, buf.length);
+ buf = newbuf;
}
}
-
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/Strings.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/Strings.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,20 +45,20 @@
* Arguments: <string length> <# batches> <# cycles per batch>
*/
public long run(String[] args) throws Exception {
- int slen = Integer.parseInt(args[0]);
- int nbatches = Integer.parseInt(args[1]);
- int ncycles = Integer.parseInt(args[2]);
- String[] strs = genStrings(slen, ncycles);
- StreamBuffer sbuf = new StreamBuffer();
- ObjectOutputStream oout =
- new ObjectOutputStream(sbuf.getOutputStream());
- ObjectInputStream oin =
- new ObjectInputStream(sbuf.getInputStream());
-
- doReps(oout, oin, sbuf, strs, 1, ncycles); // warmup
+ int slen = Integer.parseInt(args[0]);
+ int nbatches = Integer.parseInt(args[1]);
+ int ncycles = Integer.parseInt(args[2]);
+ String[] strs = genStrings(slen, ncycles);
+ StreamBuffer sbuf = new StreamBuffer();
+ ObjectOutputStream oout =
+ new ObjectOutputStream(sbuf.getOutputStream());
+ ObjectInputStream oin =
+ new ObjectInputStream(sbuf.getInputStream());
- long start = System.currentTimeMillis();
- doReps(oout, oin, sbuf, strs, nbatches, ncycles);
+ doReps(oout, oin, sbuf, strs, 1, ncycles); // warmup
+
+ long start = System.currentTimeMillis();
+ doReps(oout, oin, sbuf, strs, nbatches, ncycles);
return System.currentTimeMillis() - start;
}
@@ -66,16 +66,16 @@
* Generate nstrings random strings, each of length len.
*/
String[] genStrings(int len, int nstrings) {
- String[] strs = new String[nstrings];
- char[] ca = new char[len];
- Random rand = new Random(System.currentTimeMillis());
- for (int i = 0; i < nstrings; i++) {
- for (int j = 0; j < len; j++) {
- ca[j] = (char) rand.nextInt();
- }
- strs[i] = new String(ca);
- }
- return strs;
+ String[] strs = new String[nstrings];
+ char[] ca = new char[len];
+ Random rand = new Random(System.currentTimeMillis());
+ for (int i = 0; i < nstrings; i++) {
+ for (int j = 0; j < len; j++) {
+ ca[j] = (char) rand.nextInt();
+ }
+ strs[i] = new String(ca);
+ }
+ return strs;
}
/**
@@ -83,20 +83,19 @@
* for each batch.
*/
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
- StreamBuffer sbuf, String[] strs, int nbatches, int ncycles)
- throws Exception
+ StreamBuffer sbuf, String[] strs, int nbatches, int ncycles)
+ throws Exception
{
- for (int i = 0; i < nbatches; i++) {
- sbuf.reset();
- oout.reset();
- for (int j = 0; j < ncycles; j++) {
- oout.writeObject(strs[j]);
- }
- oout.flush();
- for (int j = 0; j < ncycles; j++) {
- oin.readObject();
- }
- }
+ for (int i = 0; i < nbatches; i++) {
+ sbuf.reset();
+ oout.reset();
+ for (int j = 0; j < ncycles; j++) {
+ oout.writeObject(strs[j]);
+ }
+ oout.flush();
+ for (int j = 0; j < ncycles; j++) {
+ oin.readObject();
+ }
+ }
}
}
-
--- a/jdk/test/java/rmi/reliability/juicer/Apple.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/Apple.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,7 @@
import java.rmi.RemoteException;
/**
- * A remote factory for Orange instances. This interface also
+ * A remote factory for Orange instances. This interface also
* includes a method to test object array serialization.
*/
public interface Apple extends Remote {
--- a/jdk/test/java/rmi/reliability/juicer/AppleEvent.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/AppleEvent.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,7 +26,7 @@
/**
* The AppleEvent class is simply an object to be passed to a
- * remote object exported by an applet. The intent is to verify
+ * remote object exported by an applet. The intent is to verify
* proper object serialization of arrays.
*/
public class AppleEvent implements Serializable {
@@ -39,24 +39,24 @@
private final Date when;
public AppleEvent(int what) {
- this.what = what;
- this.when = new Date();
+ this.what = what;
+ this.when = new Date();
}
public String toString() {
- String desc = "[";
- switch (what) {
- case BUY:
- desc += "BUY";
- break;
- case EAT:
- desc += "EAT";
- break;
- case THROW:
- desc += "THROW";
- break;
- }
- desc += " @ " + when + "]";
- return desc;
+ String desc = "[";
+ switch (what) {
+ case BUY:
+ desc += "BUY";
+ break;
+ case EAT:
+ desc += "EAT";
+ break;
+ case THROW:
+ desc += "THROW";
+ break;
+ }
+ desc += " @ " + when + "]";
+ return desc;
}
}
--- a/jdk/test/java/rmi/reliability/juicer/AppleImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/AppleImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,46 +34,46 @@
private static final Logger logger = Logger.getLogger("reliability.apple");
private final String name;
-
+
public AppleImpl(String name) throws RemoteException {
- this.name = name;
+ this.name = name;
}
/**
* Receive an array of AppleEvent objects.
*/
public void notify(AppleEvent[] events) {
- String threadName = Thread.currentThread().getName();
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".notify: BEGIN");
+ String threadName = Thread.currentThread().getName();
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".notify: BEGIN");
- for (int i = 0; i < events.length; i++) {
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".notify(): events["
- + i + "] = " + events[i].toString());
- }
+ for (int i = 0; i < events.length; i++) {
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".notify(): events["
+ + i + "] = " + events[i].toString());
+ }
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".notify(): END");
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".notify(): END");
}
/**
* Return a newly created and exported orange implementation.
*/
public Orange newOrange(String name) throws RemoteException {
- String threadName = Thread.currentThread().getName();
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".newOrange(" + name + "): BEGIN");
+ String threadName = Thread.currentThread().getName();
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".newOrange(" + name + "): BEGIN");
- Orange orange = new OrangeImpl(name);
-
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".newOrange(" + name + "): END");
+ Orange orange = new OrangeImpl(name);
- return orange;
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".newOrange(" + name + "): END");
+
+ return orange;
}
public String toString() {
- return name;
+ return name;
}
}
--- a/jdk/test/java/rmi/reliability/juicer/AppleUser.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/AppleUser.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,30 +27,30 @@
* a large number of concurrent, long running, remote method invocations
* between many threads which have exported remote objects. These
* threads use remote objects that carry on deep "two party"
- * recursion. The juicer relies on Distributed Garbage Collection to
- * unexport these remote objects when no more references are held to them.
+ * recursion. The juicer relies on Distributed Garbage Collection to
+ * unexport these remote objects when no more references are held to them.
* The two parties in the recursion are OrangeImpl and
* OrangeEchoImpl. OrangeImpl checks the base case of the recursion
* so that the program will exit.
*
* When the AppleUserImpl.main() method is invoked, the class binds an
* instance of itself in a registry. A second server process,
- * an ApplicationServer, is started which looks up the recently
+ * an ApplicationServer, is started which looks up the recently
* bound AppleUser object. This server is either started up in
* the same VM or can optionally be started in a separate VM on the
- * same host or on a different host. When this test is run on the
- * RMI profile, ApplicationServer must be started by AppleUserImpl
+ * same host or on a different host. When this test is run on the
+ * RMI profile, ApplicationServer must be started by AppleUserImpl
* and the complete juicer runs in a single process.
*
* The second server process instructs the AppleUserImpl to "use" some apples.
* AppleUserImpl creates a new thread for each apple. These threads
* initiate the two party recursion.
- *
+ *
* Each recursive call nests to a depth determined by this
- * expression: (2 + Math.abs(random.nextInt() % (maxLevel + 1)),
+ * expression: (2 + Math.abs(random.nextInt() % (maxLevel + 1)),
* where maxLevel is a command line parameter. Thus each recursive
* call nests a random number of levels between 2 and maxLevel.
- *
+ *
* The test ends when an exception is encountered or the stop time
* has been reached.
*
@@ -81,8 +81,8 @@
*/
public class AppleUserImpl extends UnicastRemoteObject implements AppleUser {
- private static final Logger logger =
- Logger.getLogger("reliability.appleuser");
+ private static final Logger logger =
+ Logger.getLogger("reliability.appleuser");
private static int threadNum = 0;
private static long testDuration = 0;
private static int maxLevel = 7;
@@ -91,7 +91,7 @@
private static boolean startTestNotified = false;
private static final Random random = new Random();
private static final Object lock = new Object();
-
+
public AppleUserImpl() throws RemoteException {
}
@@ -100,7 +100,7 @@
* to start "juicing".
*/
public synchronized void startTest() throws RemoteException {
- startTestNotified = true;
+ startTestNotified = true;
this.notifyAll();
}
@@ -109,9 +109,9 @@
* process and thereby terminate the test.
*/
public void reportException(Exception status) throws RemoteException {
- synchronized (lock) {
- this.status = status;
- lock.notifyAll();
+ synchronized (lock) {
+ this.status = status;
+ lock.notifyAll();
}
}
@@ -120,136 +120,136 @@
* stress it out.
*/
public synchronized void useApple(Apple apple) throws RemoteException {
- String threadName = Thread.currentThread().getName();
- logger.log(Level.FINEST,
- threadName + ": AppleUserImpl.useApple(): BEGIN");
+ String threadName = Thread.currentThread().getName();
+ logger.log(Level.FINEST,
+ threadName + ": AppleUserImpl.useApple(): BEGIN");
- AppleUserThread t =
- new AppleUserThread("AppleUserThread-" + (++threadNum), apple);
- t.start();
+ AppleUserThread t =
+ new AppleUserThread("AppleUserThread-" + (++threadNum), apple);
+ t.start();
- logger.log(Level.FINEST,
- threadName + ": AppleUserImpl.useApple(): END");
+ logger.log(Level.FINEST,
+ threadName + ": AppleUserImpl.useApple(): END");
}
-
+
/**
* The AppleUserThread class repeatedly invokes calls on its associated
* Apple object to stress the RMI system.
*/
class AppleUserThread extends Thread {
- final Apple apple;
+ final Apple apple;
- public AppleUserThread(String name, Apple apple) {
- super(name);
- this.apple = apple;
- }
+ public AppleUserThread(String name, Apple apple) {
+ super(name);
+ this.apple = apple;
+ }
- public void run() {
- int orangeNum = 0;
+ public void run() {
+ int orangeNum = 0;
long stopTime = System.currentTimeMillis() + testDuration;
Logger logger = Logger.getLogger("reliability.appleuserthread");
-
- try {
- do { // loop until stopTime is reached
- /*
- * Notify apple with some apple events. This tests
+ try {
+ do { // loop until stopTime is reached
+
+ /*
+ * Notify apple with some apple events. This tests
* serialization of arrays.
- */
- int numEvents = Math.abs(random.nextInt() % 5);
- AppleEvent[] events = new AppleEvent[numEvents];
- for (int i = 0; i < events.length; i++) {
- events[i] = new AppleEvent(orangeNum % 3);
- }
- apple.notify(events);
+ */
+ int numEvents = Math.abs(random.nextInt() % 5);
+ AppleEvent[] events = new AppleEvent[numEvents];
+ for (int i = 0; i < events.length; i++) {
+ events[i] = new AppleEvent(orangeNum % 3);
+ }
+ apple.notify(events);
- /*
- * Request a new orange object be created in
+ /*
+ * Request a new orange object be created in
* the application server.
- */
- Orange orange = apple.newOrange(
- "Orange(" + getName() + ")-" + (++orangeNum));
+ */
+ Orange orange = apple.newOrange(
+ "Orange(" + getName() + ")-" + (++orangeNum));
- /*
- * Create a large message of random ints to pass to orange.
- */
+ /*
+ * Create a large message of random ints to pass to orange.
+ */
int msgLength = 1000 + Math.abs(random.nextInt() % 3000);
- int[] message = new int[msgLength];
- for (int i = 0; i < message.length; i++) {
- message[i] = random.nextInt();
- }
+ int[] message = new int[msgLength];
+ for (int i = 0; i < message.length; i++) {
+ message[i] = random.nextInt();
+ }
- /*
- * Invoke recursive call on the orange. Base case
+ /*
+ * Invoke recursive call on the orange. Base case
* of recursion inverts messgage.
- */
- OrangeEchoImpl echo = new OrangeEchoImpl(
- "OrangeEcho(" + getName() + ")-" + orangeNum);
- int[] response = orange.recurse(echo, message,
- 2 + Math.abs(random.nextInt() % (maxLevel + 1)));
+ */
+ OrangeEchoImpl echo = new OrangeEchoImpl(
+ "OrangeEcho(" + getName() + ")-" + orangeNum);
+ int[] response = orange.recurse(echo, message,
+ 2 + Math.abs(random.nextInt() % (maxLevel + 1)));
- /*
- * Verify message was properly inverted and not corrupted
- * through all the recursive method invocations.
- */
- if (response.length != message.length) {
- throw new RuntimeException(
- "ERROR: CORRUPTED RESPONSE: " +
- "wrong length of returned array " + "(should be " +
- message.length + ", is " + response.length + ")");
- }
- for (int i = 0; i < message.length; i++) {
- if (~message[i] != response[i]) {
- throw new RuntimeException(
- "ERROR: CORRUPTED RESPONSE: " +
- "at element " + i + "/" + message.length +
- " of returned array (should be " +
- Integer.toHexString(~message[i]) + ", is " +
- Integer.toHexString(response[i]) + ")");
- }
- }
+ /*
+ * Verify message was properly inverted and not corrupted
+ * through all the recursive method invocations.
+ */
+ if (response.length != message.length) {
+ throw new RuntimeException(
+ "ERROR: CORRUPTED RESPONSE: " +
+ "wrong length of returned array " + "(should be " +
+ message.length + ", is " + response.length + ")");
+ }
+ for (int i = 0; i < message.length; i++) {
+ if (~message[i] != response[i]) {
+ throw new RuntimeException(
+ "ERROR: CORRUPTED RESPONSE: " +
+ "at element " + i + "/" + message.length +
+ " of returned array (should be " +
+ Integer.toHexString(~message[i]) + ", is " +
+ Integer.toHexString(response[i]) + ")");
+ }
+ }
- try {
- Thread.sleep(Math.abs(random.nextInt() % 10) * 1000);
- } catch (InterruptedException e) {
- }
+ try {
+ Thread.sleep(Math.abs(random.nextInt() % 10) * 1000);
+ } catch (InterruptedException e) {
+ }
- } while (System.currentTimeMillis() < stopTime);
+ } while (System.currentTimeMillis() < stopTime);
- } catch (Exception e) {
- status = e;
- }
- finished = true;
- synchronized (lock) {
- lock.notifyAll();
- }
- }
+ } catch (Exception e) {
+ status = e;
+ }
+ finished = true;
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
}
private static void usage() {
- System.err.println("Usage: AppleUserImpl [-hours <hours> | " +
- "-seconds <seconds>]");
- System.err.println(" [-maxLevel <maxLevel>]");
- System.err.println(" [-othervm]");
- System.err.println(" [-exit]");
- System.err.println(" hours The number of hours to run the juicer.");
- System.err.println(" The default is 0 hours.");
- System.err.println(" seconds The number of seconds to run the juicer.");
- System.err.println(" The default is 0 seconds.");
- System.err.println(" maxLevel The maximum number of levels to ");
- System.err.println(" recurse on each call.");
- System.err.println(" The default is 7 levels.");
- System.err.println(" othervm If present, the VM will wait for the");
- System.err.println(" ApplicationServer to start in");
- System.err.println(" another process.");
- System.err.println(" The default is to run everything in");
- System.err.println(" a single VM.");
- System.err.println(" exit If present, the VM will call");
- System.err.println(" System.exit() when main() finishes.");
- System.err.println(" The default is to not call");
- System.err.println(" System.exit().");
- System.err.println();
+ System.err.println("Usage: AppleUserImpl [-hours <hours> | " +
+ "-seconds <seconds>]");
+ System.err.println(" [-maxLevel <maxLevel>]");
+ System.err.println(" [-othervm]");
+ System.err.println(" [-exit]");
+ System.err.println(" hours The number of hours to run the juicer.");
+ System.err.println(" The default is 0 hours.");
+ System.err.println(" seconds The number of seconds to run the juicer.");
+ System.err.println(" The default is 0 seconds.");
+ System.err.println(" maxLevel The maximum number of levels to ");
+ System.err.println(" recurse on each call.");
+ System.err.println(" The default is 7 levels.");
+ System.err.println(" othervm If present, the VM will wait for the");
+ System.err.println(" ApplicationServer to start in");
+ System.err.println(" another process.");
+ System.err.println(" The default is to run everything in");
+ System.err.println(" a single VM.");
+ System.err.println(" exit If present, the VM will call");
+ System.err.println(" System.exit() when main() finishes.");
+ System.err.println(" The default is to not call");
+ System.err.println(" System.exit().");
+ System.err.println();
}
/**
@@ -257,122 +257,122 @@
* an apple user implementation in an rmiregistry running on localhost.
*/
public static void main(String[] args) {
- String durationString = null;
+ String durationString = null;
boolean othervm = false;
boolean exit = false;
- try {
- // parse command line args
- for (int i = 0; i < args.length ; i++ ) {
+ try {
+ // parse command line args
+ for (int i = 0; i < args.length ; i++ ) {
String arg = args[i];
if (arg.equals("-hours")) {
- if (durationString != null) {
- usage();
- }
- i++;
- int hours = Integer.parseInt(args[i]);
- durationString = hours + " hours";
- testDuration = hours * 60 * 60 * 1000;
+ if (durationString != null) {
+ usage();
+ }
+ i++;
+ int hours = Integer.parseInt(args[i]);
+ durationString = hours + " hours";
+ testDuration = hours * 60 * 60 * 1000;
} else if (arg.equals("-seconds")) {
- if (durationString != null) {
- usage();
- }
- i++;
- long seconds = Long.parseLong(args[i]);
- durationString = seconds + " seconds";
- testDuration = seconds * 1000;
+ if (durationString != null) {
+ usage();
+ }
+ i++;
+ long seconds = Long.parseLong(args[i]);
+ durationString = seconds + " seconds";
+ testDuration = seconds * 1000;
} else if (arg.equals("-maxLevel")) {
- i++;
- maxLevel = Integer.parseInt(args[i]);
+ i++;
+ maxLevel = Integer.parseInt(args[i]);
} else if (arg.equals("-othervm")) {
- othervm = true;
+ othervm = true;
} else if (arg.equals("-exit")) {
- exit = true;
+ exit = true;
} else {
- usage();
+ usage();
}
}
if (durationString == null) {
durationString = testDuration + " milliseconds";
}
- } catch (Throwable t) {
- usage();
- throw new RuntimeException("TEST FAILED: Bad argument");
- }
+ } catch (Throwable t) {
+ usage();
+ throw new RuntimeException("TEST FAILED: Bad argument");
+ }
- AppleUserImpl user = null;
- long startTime = 0;
- Thread server = null;
- int exitValue = 0;
- try {
- user = new AppleUserImpl();
+ AppleUserImpl user = null;
+ long startTime = 0;
+ Thread server = null;
+ int exitValue = 0;
+ try {
+ user = new AppleUserImpl();
- synchronized (user) {
- // create new registry and bind new AppleUserImpl in registry
+ synchronized (user) {
+ // create new registry and bind new AppleUserImpl in registry
LocateRegistry.createRegistry(2006);
LocateRegistry.getRegistry(2006).rebind("AppleUser",user);
-
- // start the other server if applicable
- if (othervm) {
- // the other server must be running in a separate process
- logger.log(Level.INFO, "Application server must be " +
- "started in separate process");
- } else {
- Class app = Class.forName("ApplicationServer");
- server = new Thread((Runnable) app.newInstance());
- logger.log(Level.INFO, "Starting application server " +
+
+ // start the other server if applicable
+ if (othervm) {
+ // the other server must be running in a separate process
+ logger.log(Level.INFO, "Application server must be " +
+ "started in separate process");
+ } else {
+ Class app = Class.forName("ApplicationServer");
+ server = new Thread((Runnable) app.newInstance());
+ logger.log(Level.INFO, "Starting application server " +
"in same process");
- server.start();
- }
+ server.start();
+ }
- // wait for other server to call startTest method
- logger.log(Level.INFO, "Waiting for application server " +
+ // wait for other server to call startTest method
+ logger.log(Level.INFO, "Waiting for application server " +
"process to start");
- while (!startTestNotified) {
- user.wait();
- }
- }
+ while (!startTestNotified) {
+ user.wait();
+ }
+ }
- startTime = System.currentTimeMillis();
- logger.log(Level.INFO, "Test starting");
+ startTime = System.currentTimeMillis();
+ logger.log(Level.INFO, "Test starting");
- // wait for exception to be reported or first thread to complete
- logger.log(Level.INFO, "Waiting " + durationString + " for " +
- "test to complete or exception to be thrown");
+ // wait for exception to be reported or first thread to complete
+ logger.log(Level.INFO, "Waiting " + durationString + " for " +
+ "test to complete or exception to be thrown");
- synchronized (lock) {
- while (status == null && !finished) {
- lock.wait();
- }
- }
+ synchronized (lock) {
+ while (status == null && !finished) {
+ lock.wait();
+ }
+ }
- if (status != null) {
- throw new RuntimeException("TEST FAILED: "
- + "juicer server reported an exception", status);
- } else {
- logger.log(Level.INFO, "TEST PASSED");
+ if (status != null) {
+ throw new RuntimeException("TEST FAILED: "
+ + "juicer server reported an exception", status);
+ } else {
+ logger.log(Level.INFO, "TEST PASSED");
}
- } catch (Exception e) {
- logger.log(Level.INFO, "TEST FAILED");
- exitValue = 1;
- if (exit) {
- e.printStackTrace();
- }
- throw new RuntimeException("TEST FAILED: "
- + "unexpected exception", e);
- } finally {
- long actualDuration = System.currentTimeMillis() - startTime;
- logger.log(Level.INFO, "Test finished");
- try {
- UnicastRemoteObject.unexportObject(user, true);
+ } catch (Exception e) {
+ logger.log(Level.INFO, "TEST FAILED");
+ exitValue = 1;
+ if (exit) {
+ e.printStackTrace();
+ }
+ throw new RuntimeException("TEST FAILED: "
+ + "unexpected exception", e);
+ } finally {
+ long actualDuration = System.currentTimeMillis() - startTime;
+ logger.log(Level.INFO, "Test finished");
+ try {
+ UnicastRemoteObject.unexportObject(user, true);
} catch (NoSuchObjectException ignore) {
- }
- logger.log(Level.INFO, "Test duration was " +
- (actualDuration/1000) + " seconds " +
- "(" + (actualDuration/3600000) + " hours)");
- System.gc(); System.gc();
- if (exit) {
- System.exit(exitValue);
- }
+ }
+ logger.log(Level.INFO, "Test duration was " +
+ (actualDuration/1000) + " seconds " +
+ "(" + (actualDuration/3600000) + " hours)");
+ System.gc(); System.gc();
+ if (exit) {
+ System.exit(exitValue);
+ }
}
}
}
--- a/jdk/test/java/rmi/reliability/juicer/ApplicationServer.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/ApplicationServer.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,7 +32,7 @@
* stress test of RMI.
*/
public class ApplicationServer implements Runnable {
-
+
/** number of remote Apple objects to export */
private static final Logger logger = Logger.getLogger("reliability.orange");
private static final int LOOKUP_ATTEMPTS = 5;
@@ -58,102 +58,102 @@
* them with server.
*/
public void run() {
- try {
- int i = 0;
+ try {
+ int i = 0;
- /*
- * Locate apple user object in registry. The lookup will
- * occur until it is successful or fails LOOKUP_ATTEMPTS times.
- * These repeated attempts allow the ApplicationServer
- * to be started before the AppleUserImpl.
- */
- Exception exc = null;
- for (i = 0; i < LOOKUP_ATTEMPTS; i++) {
- try {
- Registry registry = LocateRegistry.getRegistry(
- registryHost, 2006);
- user = (AppleUser) registry.lookup("AppleUser");
- user.startTest();
- break; //successfully obtained AppleUser
- } catch (Exception e) {
- exc = e;
- Thread.sleep(10000); //sleep 10 seconds and try again
- }
- }
- if (user == null) {
- logger.log(Level.SEVERE, "Failed to lookup AppleUser:", exc);
- return;
- }
+ /*
+ * Locate apple user object in registry. The lookup will
+ * occur until it is successful or fails LOOKUP_ATTEMPTS times.
+ * These repeated attempts allow the ApplicationServer
+ * to be started before the AppleUserImpl.
+ */
+ Exception exc = null;
+ for (i = 0; i < LOOKUP_ATTEMPTS; i++) {
+ try {
+ Registry registry = LocateRegistry.getRegistry(
+ registryHost, 2006);
+ user = (AppleUser) registry.lookup("AppleUser");
+ user.startTest();
+ break; //successfully obtained AppleUser
+ } catch (Exception e) {
+ exc = e;
+ Thread.sleep(10000); //sleep 10 seconds and try again
+ }
+ }
+ if (user == null) {
+ logger.log(Level.SEVERE, "Failed to lookup AppleUser:", exc);
+ return;
+ }
- /*
- * Create and export apple implementations.
- */
- try {
- for (i = 0; i < numApples; i++) {
- apples[i] = new AppleImpl("AppleImpl #" + (i + 1));
- }
- } catch (RemoteException e) {
- logger.log(Level.SEVERE,
- "Failed to create AppleImpl #" + (i + 1) + ":", e);
- user.reportException(e);
- return;
- }
+ /*
+ * Create and export apple implementations.
+ */
+ try {
+ for (i = 0; i < numApples; i++) {
+ apples[i] = new AppleImpl("AppleImpl #" + (i + 1));
+ }
+ } catch (RemoteException e) {
+ logger.log(Level.SEVERE,
+ "Failed to create AppleImpl #" + (i + 1) + ":", e);
+ user.reportException(e);
+ return;
+ }
- /*
- * Hand apple objects to apple user.
- */
- try {
- for (i = 0; i < numApples; i++) {
- user.useApple(apples[i]);
+ /*
+ * Hand apple objects to apple user.
+ */
+ try {
+ for (i = 0; i < numApples; i++) {
+ user.useApple(apples[i]);
}
- } catch (RemoteException e) {
- logger.log(Level.SEVERE,
- "Failed to register callbacks for " + apples[i] + ":", e);
- user.reportException(e);
- return;
- }
- } catch (Exception e) {
- logger.log(Level.SEVERE, "Unexpected exception:", e);
- }
+ } catch (RemoteException e) {
+ logger.log(Level.SEVERE,
+ "Failed to register callbacks for " + apples[i] + ":", e);
+ user.reportException(e);
+ return;
+ }
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Unexpected exception:", e);
+ }
}
private static void usage() {
- System.err.println("Usage: ApplicationServer [-numApples <numApples>]");
- System.err.println(" [-registryHost <host>]");
- System.err.println(" numApples The number of apples (threads) to use.");
- System.err.println(" The default is 10 apples.");
- System.err.println(" host The host running rmiregistry " +
- "which contains AppleUser.");
- System.err.println(" The default is \"localhost\".");
- System.err.println();
+ System.err.println("Usage: ApplicationServer [-numApples <numApples>]");
+ System.err.println(" [-registryHost <host>]");
+ System.err.println(" numApples The number of apples (threads) to use.");
+ System.err.println(" The default is 10 apples.");
+ System.err.println(" host The host running rmiregistry " +
+ "which contains AppleUser.");
+ System.err.println(" The default is \"localhost\".");
+ System.err.println();
}
public static void main(String[] args) {
int num = DEFAULT_NUMAPPLES;
String host = DEFAULT_REGISTRYHOST;
- // parse command line args
- try {
+ // parse command line args
+ try {
for (int i = 0; i < args.length ; i++ ) {
- String arg = args[i];
- if (arg.equals("-numApples")) {
+ String arg = args[i];
+ if (arg.equals("-numApples")) {
i++;
num = Integer.parseInt(args[i]);
- } else if (arg.equals("-registryHost")) {
+ } else if (arg.equals("-registryHost")) {
i++;
host = args[i];
- } else {
+ } else {
usage();
- }
+ }
}
- } catch (Throwable t) {
+ } catch (Throwable t) {
usage();
- throw new RuntimeException("TEST FAILED: Bad argument");
- }
+ throw new RuntimeException("TEST FAILED: Bad argument");
+ }
- // start the client server
- Thread server = new Thread(new ApplicationServer(num,host));
- server.start();
- // main should exit once all exported remote objects are gc'd
+ // start the client server
+ Thread server = new Thread(new ApplicationServer(num,host));
+ server.start();
+ // main should exit once all exported remote objects are gc'd
}
}
--- a/jdk/test/java/rmi/reliability/juicer/Orange.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/Orange.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,11 +26,11 @@
/**
* Represents one remote party of the deep 2-party recursion implemented by
- * this RMI reliability test. An Orange instance recursively calls back
+ * this RMI reliability test. An Orange instance recursively calls back
* to it's caller, typically an OrangeEcho instance.
* The recursion stops when it reaches a given 'level'.
*/
public interface Orange extends Remote {
- int[] recurse(OrangeEcho echo, int[] message, int level)
- throws RemoteException;
+ int[] recurse(OrangeEcho echo, int[] message, int level)
+ throws RemoteException;
}
--- a/jdk/test/java/rmi/reliability/juicer/OrangeEcho.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/OrangeEcho.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,11 +26,11 @@
/**
* Represents one remote party of the deep 2-party recursion implemented by
- * this RMI reliability test. An OrangeEcho instance recursively calls back
+ * this RMI reliability test. An OrangeEcho instance recursively calls back
* to it's caller, an Orange instance.
* The recursion stops when it reaches a given 'level'.
*/
public interface OrangeEcho extends Remote {
int[] recurse(Orange orange, int[] message, int level)
- throws RemoteException;
+ throws RemoteException;
}
--- a/jdk/test/java/rmi/reliability/juicer/OrangeEchoImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/OrangeEchoImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -33,12 +33,12 @@
*/
public class OrangeEchoImpl extends UnicastRemoteObject implements OrangeEcho {
- private static final Logger logger =
- Logger.getLogger("reliability.orangeecho");
+ private static final Logger logger =
+ Logger.getLogger("reliability.orangeecho");
private final String name;
public OrangeEchoImpl(String name) throws RemoteException {
- this.name = name;
+ this.name = name;
}
/**
@@ -46,24 +46,24 @@
* with the same message data and a decremented recursion level.
*/
public int[] recurse(Orange orange, int[] message, int level)
- throws RemoteException
+ throws RemoteException
{
- String threadName = Thread.currentThread().getName();
+ String threadName = Thread.currentThread().getName();
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".recurse(message["
- + message.length + "], " + level + "): BEGIN");
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".recurse(message["
+ + message.length + "], " + level + "): BEGIN");
- int[] response = orange.recurse(this, message, level - 1);
+ int[] response = orange.recurse(this, message, level - 1);
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".recurse(message["
- + message.length + "], " + level + "): END");
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".recurse(message["
+ + message.length + "], " + level + "): END");
- return response;
+ return response;
}
public String toString() {
- return name;
+ return name;
}
}
--- a/jdk/test/java/rmi/reliability/juicer/OrangeImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/OrangeImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,7 +36,7 @@
private final String name;
public OrangeImpl(String name) throws RemoteException {
- this.name = name;
+ this.name = name;
}
/**
@@ -44,31 +44,31 @@
* object if not at recursion level zero.
*/
public int[] recurse(OrangeEcho echo, int[] message, int level)
- throws RemoteException
+ throws RemoteException
{
- String threadName = Thread.currentThread().getName();
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".recurse(message["
- + message.length + "], " + level + "): BEGIN");
+ String threadName = Thread.currentThread().getName();
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".recurse(message["
+ + message.length + "], " + level + "): BEGIN");
- int[] response;
- if (level > 0) {
- response = echo.recurse(this, message, level);
- } else {
- for (int i = 0; i < message.length; i++) {
- message[i] = ~message[i];
- }
- response = message;
- }
+ int[] response;
+ if (level > 0) {
+ response = echo.recurse(this, message, level);
+ } else {
+ for (int i = 0; i < message.length; i++) {
+ message[i] = ~message[i];
+ }
+ response = message;
+ }
- logger.log(Level.FINEST,
- threadName + ": " + toString() + ".recurse(message["
- + message.length + "], " + level + "): END");
+ logger.log(Level.FINEST,
+ threadName + ": " + toString() + ".recurse(message["
+ + message.length + "], " + level + "): END");
- return response;
+ return response;
}
public String toString() {
- return name;
+ return name;
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressConstants.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressConstants.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,9 +27,9 @@
interface CompressConstants {
// constants for 6-bit code values
- static final int NOP = 0; // no operation: used to pad words on flush()
- static final int RAW = 1; // introduces raw byte format
- static final int BASE = 2; // base for codes found in lookup table
+ static final int NOP = 0; // no operation: used to pad words on flush()
+ static final int RAW = 1; // introduces raw byte format
+ static final int BASE = 2; // base for codes found in lookup table
static final String codeTable =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()";
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()";
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressInputStream.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressInputStream.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,7 +31,7 @@
{
public CompressInputStream(InputStream in) {
- super(in);
+ super(in);
}
// buffer of unpacked 6-bit codes from last 32-word read
@@ -41,70 +41,70 @@
int bufPos = 5;
public int read() throws IOException {
- try {
- int code;
- do {
- code = readCode();
- } while (code == NOP); // ignore NOP codes
+ try {
+ int code;
+ do {
+ code = readCode();
+ } while (code == NOP); // ignore NOP codes
- if (code >= BASE)
- return codeTable.charAt(code - BASE);
- else if (code == RAW) {
- int high = readCode();
- int low = readCode();
- return (high << 4) | low;
- } else
- throw new IOException("unknown compression code: " + code);
- } catch (EOFException e) {
- return -1;
- }
+ if (code >= BASE)
+ return codeTable.charAt(code - BASE);
+ else if (code == RAW) {
+ int high = readCode();
+ int low = readCode();
+ return (high << 4) | low;
+ } else
+ throw new IOException("unknown compression code: " + code);
+ } catch (EOFException e) {
+ return -1;
+ }
}
public int read(byte b[], int off, int len) throws IOException {
- if (len <= 0) {
- return 0;
- }
+ if (len <= 0) {
+ return 0;
+ }
- int c = read();
- if (c == -1) {
- return -1;
- }
- b[off] = (byte)c;
+ int c = read();
+ if (c == -1) {
+ return -1;
+ }
+ b[off] = (byte)c;
- int i = 1;
+ int i = 1;
/*****
- try {
- for (; i < len ; i++) {
- c = read();
- if (c == -1) {
- break;
- }
- if (b != null) {
- b[off + i] = (byte)c;
- }
- }
- } catch (IOException ee) {
- }
+ try {
+ for (; i < len ; i++) {
+ c = read();
+ if (c == -1) {
+ break;
+ }
+ if (b != null) {
+ b[off + i] = (byte)c;
+ }
+ }
+ } catch (IOException ee) {
+ }
*****/
- return i;
+ return i;
}
private int readCode() throws IOException {
- if (bufPos == 5) {
- int b1 = in.read();
- int b2 = in.read();
- int b3 = in.read();
- int b4 = in.read();
- if ((b1 | b2 | b3 | b4) < 0)
- throw new EOFException();
- int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
- buf[0] = (pack >>> 24) & 0x3F;
- buf[1] = (pack >>> 18) & 0x3F;
- buf[2] = (pack >>> 12) & 0x3F;
- buf[3] = (pack >>> 6) & 0x3F;
- buf[4] = (pack >>> 0) & 0x3F;
- bufPos = 0;
- }
- return buf[bufPos++];
+ if (bufPos == 5) {
+ int b1 = in.read();
+ int b2 = in.read();
+ int b3 = in.read();
+ int b4 = in.read();
+ if ((b1 | b2 | b3 | b4) < 0)
+ throw new EOFException();
+ int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+ buf[0] = (pack >>> 24) & 0x3F;
+ buf[1] = (pack >>> 18) & 0x3F;
+ buf[2] = (pack >>> 12) & 0x3F;
+ buf[3] = (pack >>> 6) & 0x3F;
+ buf[4] = (pack >>> 0) & 0x3F;
+ bufPos = 0;
+ }
+ return buf[bufPos++];
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressOutputStream.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/CompressOutputStream.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,7 +31,7 @@
{
public CompressOutputStream(OutputStream out) {
- super(out);
+ super(out);
}
// buffer of 6-bit codes to pack into next 32-bit word
@@ -41,44 +41,44 @@
int bufPos = 0;
public void write(int b) throws IOException {
- b &= 0xFF; // force argument to a byte
+ b &= 0xFF; // force argument to a byte
- int pos = codeTable.indexOf((char)b);
- if (pos != -1)
- writeCode(BASE + pos);
- else {
- writeCode(RAW);
- writeCode(b >> 4);
- writeCode(b & 0xF);
- }
+ int pos = codeTable.indexOf((char)b);
+ if (pos != -1)
+ writeCode(BASE + pos);
+ else {
+ writeCode(RAW);
+ writeCode(b >> 4);
+ writeCode(b & 0xF);
+ }
}
public void write(byte b[], int off, int len) throws IOException {
- /*
- * This is quite an inefficient implementation, because it has to
- * call the other write method for every byte in the array. It
+ /*
+ * This is quite an inefficient implementation, because it has to
+ * call the other write method for every byte in the array. It
* could be optimized for performance by doing all the processing
- * in this method.
- */
- for (int i = 0; i < len; i++)
- write(b[off + i]);
+ * in this method.
+ */
+ for (int i = 0; i < len; i++)
+ write(b[off + i]);
}
public void flush() throws IOException {
- while (bufPos > 0)
- writeCode(NOP);
+ while (bufPos > 0)
+ writeCode(NOP);
}
private void writeCode(int c) throws IOException {
- buf[bufPos++] = c;
- if (bufPos == 5) { // write next word when we have 5 codes
- int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) |
- (buf[3] << 6) | buf[4];
- out.write((pack >>> 24) & 0xFF);
- out.write((pack >>> 16) & 0xFF);
- out.write((pack >>> 8) & 0xFF);
- out.write((pack >>> 0) & 0xFF);
- bufPos = 0;
- }
+ buf[bufPos++] = c;
+ if (bufPos == 5) { // write next word when we have 5 codes
+ int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) |
+ (buf[3] << 6) | buf[4];
+ out.write((pack >>> 24) & 0xFF);
+ out.write((pack >>> 16) & 0xFF);
+ out.write((pack >>> 8) & 0xFF);
+ out.write((pack >>> 0) & 0xFF);
+ bufPos = 0;
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/Echo.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/Echo.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -39,49 +39,49 @@
* Initialization constructor.
*/
public EchoImpl(String protocol)
- throws ActivationException, RemoteException
+ throws ActivationException, RemoteException
{
- super(null, makeMarshalledObject(protocol), false, 0,
- new MultiSocketFactory.ClientFactory(protocol, pattern),
- new MultiSocketFactory.ServerFactory(protocol, pattern));
+ super(null, makeMarshalledObject(protocol), false, 0,
+ new MultiSocketFactory.ClientFactory(protocol, pattern),
+ new MultiSocketFactory.ServerFactory(protocol, pattern));
}
/**
* Activation constructor.
*/
public EchoImpl(ActivationID id, MarshalledObject obj)
- throws RemoteException
+ throws RemoteException
{
- super(id, 0,
- new MultiSocketFactory.ClientFactory(getProtocol(obj), pattern),
- new MultiSocketFactory.ServerFactory(getProtocol(obj), pattern));
+ super(id, 0,
+ new MultiSocketFactory.ClientFactory(getProtocol(obj), pattern),
+ new MultiSocketFactory.ServerFactory(getProtocol(obj), pattern));
}
private static MarshalledObject makeMarshalledObject(String protocol) {
- MarshalledObject obj = null;
- try {
- obj = new MarshalledObject(protocol);
- } catch (Exception willNotHappen) {
- }
+ MarshalledObject obj = null;
+ try {
+ obj = new MarshalledObject(protocol);
+ } catch (Exception willNotHappen) {
+ }
- return obj;
+ return obj;
}
private static String getProtocol(MarshalledObject obj) {
- String protocol = "";
- try {
- protocol = (String) obj.get();
- } catch (Exception willNotHappen) {
- }
+ String protocol = "";
+ try {
+ protocol = (String) obj.get();
+ } catch (Exception willNotHappen) {
+ }
- return protocol;
+ return protocol;
}
-
+
public byte[] echoNot(byte[] data) {
- byte[] result = new byte[data.length];
- for (int i = 0; i < data.length; i++)
- result[i] = (byte) ~data[i];
- return result;
+ byte[] result = new byte[data.length];
+ for (int i = 0; i < data.length; i++)
+ result[i] = (byte) ~data[i];
+ return result;
}
/**
@@ -89,7 +89,7 @@
*/
public void shutdown() throws Exception
{
- (new Thread(this,"Echo.shutdown")).start();
+ (new Thread(this,"Echo.shutdown")).start();
}
/**
@@ -98,43 +98,43 @@
* object may still have pending/executing calls), then
* unexport the object forcibly.
*/
- public void run()
+ public void run()
{
- ActivationLibrary.deactivate(this, getID());
+ ActivationLibrary.deactivate(this, getID());
}
public static void main(String[] args) {
- /*
- * The following line is required with the JDK 1.2 VM so that the
- * VM can exit gracefully when this test completes. Otherwise, the
- * conservative garbage collector will find a handle to the server
- * object on the native stack and not clear the weak reference to
- * it in the RMI runtime's object table.
- */
- Object dummy = new Object();
-
- System.setSecurityManager(new RMISecurityManager());
-
- try {
- String protocol = "";
- if (args.length >= 1)
- protocol = args[0];
+ /*
+ * The following line is required with the JDK 1.2 VM so that the
+ * VM can exit gracefully when this test completes. Otherwise, the
+ * conservative garbage collector will find a handle to the server
+ * object on the native stack and not clear the weak reference to
+ * it in the RMI runtime's object table.
+ */
+ Object dummy = new Object();
+
+ System.setSecurityManager(new RMISecurityManager());
+
+ try {
+ String protocol = "";
+ if (args.length >= 1)
+ protocol = args[0];
- System.out.println("EchoServer: creating remote object");
- ActivationGroupDesc groupDesc =
- new ActivationGroupDesc(null, null);
- ActivationSystem system = ActivationGroup.getSystem();
- ActivationGroupID groupID = system.registerGroup(groupDesc);
- ActivationGroup.createGroup(groupID, groupDesc, 0);
-
- EchoImpl impl = new EchoImpl(protocol);
- System.out.println("EchoServer: binding in registry");
- Naming.rebind("//:" + UseCustomSocketFactory.REGISTRY_PORT +
- "/EchoServer", impl);
- System.out.println("EchoServer ready.");
- } catch (Exception e) {
- System.err.println("EXCEPTION OCCURRED:");
- e.printStackTrace();
- }
+ System.out.println("EchoServer: creating remote object");
+ ActivationGroupDesc groupDesc =
+ new ActivationGroupDesc(null, null);
+ ActivationSystem system = ActivationGroup.getSystem();
+ ActivationGroupID groupID = system.registerGroup(groupDesc);
+ ActivationGroup.createGroup(groupID, groupDesc, 0);
+
+ EchoImpl impl = new EchoImpl(protocol);
+ System.out.println("EchoServer: binding in registry");
+ Naming.rebind("//:" + UseCustomSocketFactory.REGISTRY_PORT +
+ "/EchoServer", impl);
+ System.out.println("EchoServer ready.");
+ } catch (Exception e) {
+ System.err.println("EXCEPTION OCCURRED:");
+ e.printStackTrace();
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/EchoImpl_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,47 +29,47 @@
implements Echo, java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_echoNot_0;
private static java.lang.reflect.Method $method_shutdown_1;
-
+
static {
- try {
- $method_echoNot_0 = Echo.class.getMethod("echoNot", new java.lang.Class[] {byte[].class});
- $method_shutdown_1 = Echo.class.getMethod("shutdown", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_echoNot_0 = Echo.class.getMethod("echoNot", new java.lang.Class[] {byte[].class});
+ $method_shutdown_1 = Echo.class.getMethod("shutdown", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public EchoImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of echoNot(byte[])
public byte[] echoNot(byte[] $param_arrayOf_byte_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- Object $result = ref.invoke(this, $method_echoNot_0, new java.lang.Object[] {$param_arrayOf_byte_1}, -4295721514897591756L);
- return ((byte[]) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_echoNot_0, new java.lang.Object[] {$param_arrayOf_byte_1}, -4295721514897591756L);
+ return ((byte[]) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of shutdown()
public void shutdown()
- throws java.lang.Exception
+ throws java.lang.Exception
{
- ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L);
+ ref.invoke(this, $method_shutdown_1, null, -7207851917985848402L);
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/MultiSocketFactory.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/MultiSocketFactory.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,194 +34,193 @@
public class MultiSocketFactory {
private static RMISocketFactory def =
- RMISocketFactory.getDefaultSocketFactory();
+ RMISocketFactory.getDefaultSocketFactory();
+
-
public static class ServerFactory
- implements RMIServerSocketFactory, Serializable
+ implements RMIServerSocketFactory, Serializable
{
- private String protocol;
- private byte[] data;
+ private String protocol;
+ private byte[] data;
- public ServerFactory(String protocol, byte[] data) {
- this.protocol = protocol;
- this.data = data;
- }
+ public ServerFactory(String protocol, byte[] data) {
+ this.protocol = protocol;
+ this.data = data;
+ }
- public ServerSocket createServerSocket(int port) throws IOException
- {
- if (protocol.equals("compress")) {
- return new CompressServerSocket(port);
-
- } else if (protocol.equals("xor")) {
- if (data == null || data.length != 1)
- throw new IOException("invalid argument for XOR protocol");
- return new XorServerSocket(port, data[0]);
+ public ServerSocket createServerSocket(int port) throws IOException
+ {
+ if (protocol.equals("compress")) {
+ return new CompressServerSocket(port);
- }
-
- return def.createServerSocket(port);
- }
+ } else if (protocol.equals("xor")) {
+ if (data == null || data.length != 1)
+ throw new IOException("invalid argument for XOR protocol");
+ return new XorServerSocket(port, data[0]);
+
+ }
+
+ return def.createServerSocket(port);
+ }
}
public static class ClientFactory
- implements RMIClientSocketFactory, Serializable
+ implements RMIClientSocketFactory, Serializable
{
- private String protocol;
- private byte[] data;
+ private String protocol;
+ private byte[] data;
+
+ public ClientFactory(String protocol, byte[] data) {
+ this.protocol = protocol;
+ this.data = data;
+ }
- public ClientFactory(String protocol, byte[] data) {
- this.protocol = protocol;
- this.data = data;
- }
-
- public Socket createSocket(String host, int port)
- throws IOException
- {
- if (protocol.equals("compress")) {
- return new CompressSocket(host, port);
-
- } else if (protocol.equals("xor")) {
- if (data == null || data.length != 1)
- throw new IOException("invalid argument for XOR protocol");
- return new XorSocket(host, port, data[0]);
+ public Socket createSocket(String host, int port)
+ throws IOException
+ {
+ if (protocol.equals("compress")) {
+ return new CompressSocket(host, port);
- }
+ } else if (protocol.equals("xor")) {
+ if (data == null || data.length != 1)
+ throw new IOException("invalid argument for XOR protocol");
+ return new XorSocket(host, port, data[0]);
- return def.createSocket(host, port);
- }
+ }
+
+ return def.createSocket(host, port);
+ }
}
static class CompressSocket extends Socket {
- private InputStream in;
- private OutputStream out;
- public CompressSocket() { super(); }
- public CompressSocket(String host, int port) throws IOException {
- super(host, port);
- }
- public InputStream getInputStream() throws IOException {
- if (in == null) {
- in = new CompressInputStream(super.getInputStream());
- }
- return in;
+ private InputStream in;
+ private OutputStream out;
+ public CompressSocket() { super(); }
+ public CompressSocket(String host, int port) throws IOException {
+ super(host, port);
}
- public OutputStream getOutputStream() throws IOException {
- if (out == null) {
- out = new CompressOutputStream(super.getOutputStream());
- }
- return out;
- }
+ public InputStream getInputStream() throws IOException {
+ if (in == null) {
+ in = new CompressInputStream(super.getInputStream());
+ }
+ return in;
+ }
+ public OutputStream getOutputStream() throws IOException {
+ if (out == null) {
+ out = new CompressOutputStream(super.getOutputStream());
+ }
+ return out;
+ }
}
static class CompressServerSocket extends ServerSocket {
- public CompressServerSocket(int port) throws IOException {
- super(port);
- }
- public Socket accept() throws IOException {
- Socket s = new CompressSocket();
- implAccept(s);
- return s;
- }
+ public CompressServerSocket(int port) throws IOException {
+ super(port);
+ }
+ public Socket accept() throws IOException {
+ Socket s = new CompressSocket();
+ implAccept(s);
+ return s;
+ }
}
static class XorSocket extends Socket {
- private byte pattern;
- private InputStream in;
- private OutputStream out;
- public XorSocket(byte pattern) { super(); this.pattern = pattern; }
- public XorSocket(String host, int port, byte pattern)
- throws IOException
- {
- super(host, port);
- this.pattern = pattern;
- }
- public InputStream getInputStream() throws IOException {
- if (in == null) {
- in = new XorInputStream(super.getInputStream(), pattern);
- }
- return in;
+ private byte pattern;
+ private InputStream in;
+ private OutputStream out;
+ public XorSocket(byte pattern) { super(); this.pattern = pattern; }
+ public XorSocket(String host, int port, byte pattern)
+ throws IOException
+ {
+ super(host, port);
+ this.pattern = pattern;
}
- public OutputStream getOutputStream() throws IOException {
- if (out == null) {
- out = new XorOutputStream(super.getOutputStream(), pattern);
- }
- return out;
- }
+ public InputStream getInputStream() throws IOException {
+ if (in == null) {
+ in = new XorInputStream(super.getInputStream(), pattern);
+ }
+ return in;
+ }
+ public OutputStream getOutputStream() throws IOException {
+ if (out == null) {
+ out = new XorOutputStream(super.getOutputStream(), pattern);
+ }
+ return out;
+ }
}
static class XorServerSocket extends ServerSocket {
- private byte pattern;
- public XorServerSocket(int port, byte pattern) throws IOException {
- super(port);
- this.pattern = pattern;
- }
- public Socket accept() throws IOException {
- Socket s = new XorSocket(pattern);
- implAccept(s);
- return s;
- }
+ private byte pattern;
+ public XorServerSocket(int port, byte pattern) throws IOException {
+ super(port);
+ this.pattern = pattern;
+ }
+ public Socket accept() throws IOException {
+ Socket s = new XorSocket(pattern);
+ implAccept(s);
+ return s;
+ }
}
static class XorOutputStream extends FilterOutputStream {
- private byte pattern;
- public XorOutputStream(OutputStream out, byte pattern) {
- super(out);
- this.pattern = pattern;
- }
- public void write(int b) throws IOException {
- out.write(b ^ pattern);
- out.flush();
- }
- public void write(byte b[], int off, int len) throws IOException {
- for (int i = 0; i < len; i++)
- write(b[off + i]);
- }
+ private byte pattern;
+ public XorOutputStream(OutputStream out, byte pattern) {
+ super(out);
+ this.pattern = pattern;
+ }
+ public void write(int b) throws IOException {
+ out.write(b ^ pattern);
+ out.flush();
+ }
+ public void write(byte b[], int off, int len) throws IOException {
+ for (int i = 0; i < len; i++)
+ write(b[off + i]);
+ }
}
static class XorInputStream extends FilterInputStream {
- private byte pattern;
- public XorInputStream(InputStream in, byte pattern) {
- super(in);
- this.pattern = pattern;
- }
- public int read() throws IOException {
- int b = in.read();
-// System.out.print("BEFORE: " + Integer.toHexString(b));
- if (b != -1)
- b = (b ^ pattern) & 0xFF;
-// System.out.println("\tAFTER: " + Integer.toHexString(b));
- return b;
- }
- public int read(byte b[], int off, int len) throws IOException {
- if (len <= 0) {
- return 0;
- }
+ private byte pattern;
+ public XorInputStream(InputStream in, byte pattern) {
+ super(in);
+ this.pattern = pattern;
+ }
+ public int read() throws IOException {
+ int b = in.read();
+// System.out.print("BEFORE: " + Integer.toHexString(b));
+ if (b != -1)
+ b = (b ^ pattern) & 0xFF;
+// System.out.println("\tAFTER: " + Integer.toHexString(b));
+ return b;
+ }
+ public int read(byte b[], int off, int len) throws IOException {
+ if (len <= 0) {
+ return 0;
+ }
- int c = read();
- if (c == -1) {
- return -1;
- }
- b[off] = (byte)c;
+ int c = read();
+ if (c == -1) {
+ return -1;
+ }
+ b[off] = (byte)c;
- int i = 1;
+ int i = 1;
/*****
- try {
- for (; i < len ; i++) {
- c = read();
- if (c == -1) {
- break;
- }
- if (b != null) {
- b[off + i] = (byte)c;
- }
- }
- } catch (IOException ee) {
- }
+ try {
+ for (; i < len ; i++) {
+ c = read();
+ if (c == -1) {
+ break;
+ }
+ if (b != null) {
+ b[off + i] = (byte)c;
+ }
+ }
+ } catch (IOException ee) {
+ }
*****/
- return i;
- }
+ return i;
+ }
}
}
-
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,124 +45,124 @@
final static int REGISTRY_PORT = 2006;
static String[] protocol = new String[] { "", "compress", "xor" };
-
+
public static void main(String[] args) {
- System.out.println("\nRegression test for bug 4115696\n");
-
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ System.out.println("\nRegression test for bug 4115696\n");
+
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
- try {
- LocateRegistry.createRegistry(REGISTRY_PORT);
- } catch (Exception e) {
- TestLibrary.bomb("creating registry", e);
- }
+ try {
+ LocateRegistry.createRegistry(REGISTRY_PORT);
+ } catch (Exception e) {
+ TestLibrary.bomb("creating registry", e);
+ }
+
+ RMID rmid = null;
- RMID rmid = null;
-
- try {
- rmid = RMID.createRMID(true);
- rmid.addArguments(new String[] {
- "-C-Djava.security.policy=" +
- TestParams.defaultGroupPolicy +
- " -C-Djava.security.manager=java.rmi.RMISecurityManager "});
- rmid.start();
+ try {
+ rmid = RMID.createRMID(true);
+ rmid.addArguments(new String[] {
+ "-C-Djava.security.policy=" +
+ TestParams.defaultGroupPolicy +
+ " -C-Djava.security.manager=java.rmi.RMISecurityManager "});
+ rmid.start();
- Echo[] echo = spawnAndTest();
- reactivateAndTest(echo);
- } catch (IOException e) {
- TestLibrary.bomb("creating rmid", e);
- } finally {
- if (rmid != null)
- rmid.destroy();
- }
+ Echo[] echo = spawnAndTest();
+ reactivateAndTest(echo);
+ } catch (IOException e) {
+ TestLibrary.bomb("creating rmid", e);
+ } finally {
+ if (rmid != null)
+ rmid.destroy();
+ }
}
private static Echo[] spawnAndTest() {
-
- System.err.println("\nCreate Test-->");
+
+ System.err.println("\nCreate Test-->");
+
+ Echo[] echo = new Echo[protocol.length];
+
+ for (int i = 0; i < protocol.length; i++) {
- Echo[] echo = new Echo[protocol.length];
-
- for (int i = 0; i < protocol.length; i++) {
-
- JavaVM serverVM = new JavaVM("EchoImpl",
- "-Djava.security.policy=" +
- TestParams.defaultPolicy,
- protocol[i]);
+ JavaVM serverVM = new JavaVM("EchoImpl",
+ "-Djava.security.policy=" +
+ TestParams.defaultPolicy,
+ protocol[i]);
- System.err.println("\nusing protocol: " +
- (protocol[i] == "" ? "none" : protocol[i]));
-
- try {
- /* spawn VM for EchoServer */
- serverVM.start();
+ System.err.println("\nusing protocol: " +
+ (protocol[i] == "" ? "none" : protocol[i]));
+
+ try {
+ /* spawn VM for EchoServer */
+ serverVM.start();
- /* lookup server */
- int tries = 12; // need enough tries for slow machine.
- echo[i] = null;
- do {
- try {
- echo[i] = (Echo) Naming.lookup("//:" + REGISTRY_PORT +
- "/EchoServer");
- break;
- } catch (NotBoundException e) {
- try {
- Thread.sleep(2000);
- } catch (Exception ignore) {
- }
- continue;
- }
- } while (--tries > 0);
+ /* lookup server */
+ int tries = 12; // need enough tries for slow machine.
+ echo[i] = null;
+ do {
+ try {
+ echo[i] = (Echo) Naming.lookup("//:" + REGISTRY_PORT +
+ "/EchoServer");
+ break;
+ } catch (NotBoundException e) {
+ try {
+ Thread.sleep(2000);
+ } catch (Exception ignore) {
+ }
+ continue;
+ }
+ } while (--tries > 0);
- if (echo[i] == null)
- TestLibrary.bomb("server not bound in 12 tries", null);
+ if (echo[i] == null)
+ TestLibrary.bomb("server not bound in 12 tries", null);
- /* invoke remote method and print result*/
- System.err.println("Bound to " + echo[i]);
- byte[] data = ("Greetings, citizen " +
- System.getProperty("user.name") + "!"). getBytes();
- byte[] result = echo[i].echoNot(data);
- for (int j = 0; j < result.length; j++)
- result[j] = (byte) ~result[j];
- System.err.println("Result: " + new String(result));
- echo[i].shutdown();
-
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
-
- } finally {
- serverVM.destroy();
- try {
- Naming.unbind("//:" + REGISTRY_PORT + "/EchoServer");
- } catch (Exception e) {
- TestLibrary.bomb("unbinding EchoServer", e);
-
- }
- }
- }
- return echo;
+ /* invoke remote method and print result*/
+ System.err.println("Bound to " + echo[i]);
+ byte[] data = ("Greetings, citizen " +
+ System.getProperty("user.name") + "!"). getBytes();
+ byte[] result = echo[i].echoNot(data);
+ for (int j = 0; j < result.length; j++)
+ result[j] = (byte) ~result[j];
+ System.err.println("Result: " + new String(result));
+ echo[i].shutdown();
+
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
+
+ } finally {
+ serverVM.destroy();
+ try {
+ Naming.unbind("//:" + REGISTRY_PORT + "/EchoServer");
+ } catch (Exception e) {
+ TestLibrary.bomb("unbinding EchoServer", e);
+
+ }
+ }
+ }
+ return echo;
}
private static void reactivateAndTest(Echo[] echo) {
- System.err.println("\nReactivate Test-->");
+ System.err.println("\nReactivate Test-->");
- for (int i = 0; i < echo.length; i++) {
- try {
- System.err.println("\nusing protocol: " +
- (protocol[i] == "" ? "none" : protocol[i]));
- byte[] data = ("Greetings, citizen " +
- System.getProperty("user.name") + "!").getBytes();
- byte[] result = echo[i].echoNot(data);
- for (int j = 0; j < result.length; j++)
- result[j] = (byte) ~result[j];
- System.err.println("Result: " + new String(result));
- echo[i].shutdown();
- } catch (Exception e) {
- TestLibrary.bomb("activating EchoServer for protocol " + protocol[i], e);
- }
- }
+ for (int i = 0; i < echo.length; i++) {
+ try {
+ System.err.println("\nusing protocol: " +
+ (protocol[i] == "" ? "none" : protocol[i]));
+ byte[] data = ("Greetings, citizen " +
+ System.getProperty("user.name") + "!").getBytes();
+ byte[] result = echo[i].echoNot(data);
+ for (int j = 0; j < result.length; j++)
+ result[j] = (byte) ~result[j];
+ System.err.println("Result: " + new String(result));
+ echo[i].shutdown();
+ } catch (Exception e) {
+ TestLibrary.bomb("activating EchoServer for protocol " + protocol[i], e);
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/Compress.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/Compress.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,204 +31,204 @@
public class Compress {
interface CompressConstants {
- // constants for 6-bit code values
- static final int NOP = 0; // no operation: used to pad words on flush()
- static final int RAW = 1; // introduces raw byte format
- static final int BASE = 2; // base for codes found in lookup table
- static final String codeTable =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()";
+ // constants for 6-bit code values
+ static final int NOP = 0; // no operation: used to pad words on flush()
+ static final int RAW = 1; // introduces raw byte format
+ static final int BASE = 2; // base for codes found in lookup table
+ static final String codeTable =
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()";
}
-
- public static class CompressRMIClientSocketFactory
- implements java.rmi.server.RMIClientSocketFactory, Serializable {
+
+ public static class CompressRMIClientSocketFactory
+ implements java.rmi.server.RMIClientSocketFactory, Serializable {
- public Socket createSocket(String host, int port)
- throws IOException {
-
- return ((Socket) new CompressSocket(host, port));
- }
+ public Socket createSocket(String host, int port)
+ throws IOException {
+
+ return ((Socket) new CompressSocket(host, port));
+ }
}
- public static class CompressRMIServerSocketFactory
- implements RMIServerSocketFactory,
- Serializable {
-
- public ServerSocket createServerSocket(int port)
- throws IOException {
+ public static class CompressRMIServerSocketFactory
+ implements RMIServerSocketFactory,
+ Serializable {
- return ((ServerSocket) new CompressServerSocket(port));
- }
+ public ServerSocket createServerSocket(int port)
+ throws IOException {
+
+ return ((ServerSocket) new CompressServerSocket(port));
+ }
}
-
+
public static class CompressSocket extends Socket {
- private InputStream in;
- private OutputStream out;
- public CompressSocket() { super(); }
- public CompressSocket(String host, int port) throws IOException {
- super(host, port);
- }
- public InputStream getInputStream() throws IOException {
- if (in == null) {
- in = new CompressInputStream(super.getInputStream());
- }
- return in;
+ private InputStream in;
+ private OutputStream out;
+ public CompressSocket() { super(); }
+ public CompressSocket(String host, int port) throws IOException {
+ super(host, port);
}
- public OutputStream getOutputStream() throws IOException {
- if (out == null) {
- out = new CompressOutputStream(super.getOutputStream());
- }
- return out;
- }
+ public InputStream getInputStream() throws IOException {
+ if (in == null) {
+ in = new CompressInputStream(super.getInputStream());
+ }
+ return in;
+ }
+ public OutputStream getOutputStream() throws IOException {
+ if (out == null) {
+ out = new CompressOutputStream(super.getOutputStream());
+ }
+ return out;
+ }
}
public static class CompressServerSocket extends ServerSocket {
- public CompressServerSocket(int port) throws IOException {
- super(port);
- }
- public Socket accept() throws IOException {
- Socket s = new CompressSocket();
- implAccept(s);
- return s;
- }
+ public CompressServerSocket(int port) throws IOException {
+ super(port);
+ }
+ public Socket accept() throws IOException {
+ Socket s = new CompressSocket();
+ implAccept(s);
+ return s;
+ }
}
public static class CompressInputStream extends FilterInputStream
- implements CompressConstants
+ implements CompressConstants
{
-
- public CompressInputStream(InputStream in) {
- super(in);
- }
-
- // buffer of unpacked 6-bit codes from last 32-word read
- int buf[] = new int[5];
-
- // position of next code to read in buffer (5 == end of buffer)
- int bufPos = 5;
-
- public int read() throws IOException {
- try {
- int code;
- do {
- code = readCode();
- } while (code == NOP); // ignore NOP codes
-
- if (code >= BASE)
- return codeTable.charAt(code - BASE);
- else if (code == RAW) {
- int high = readCode();
- int low = readCode();
- return (high << 4) | low;
- } else
- throw new IOException("unknown compression code: " + code);
- } catch (EOFException e) {
- return -1;
- }
- }
-
- public int read(byte b[], int off, int len) throws IOException {
- if (len <= 0) {
- return 0;
- }
-
- int c = read();
- if (c == -1) {
- return -1;
- }
- b[off] = (byte)c;
-
- int i = 1;
- /*****
- try {
- for (; i < len ; i++) {
- c = read();
- if (c == -1) {
- break;
- }
- if (b != null) {
- b[off + i] = (byte)c;
- }
- }
- } catch (IOException ee) {
- }
- *****/
- return i;
- }
-
- private int readCode() throws IOException {
- if (bufPos == 5) {
- int b1 = in.read();
- int b2 = in.read();
- int b3 = in.read();
- int b4 = in.read();
- if ((b1 | b2 | b3 | b4) < 0)
- throw new EOFException();
- int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
- buf[0] = (pack >>> 24) & 0x3F;
- buf[1] = (pack >>> 18) & 0x3F;
- buf[2] = (pack >>> 12) & 0x3F;
- buf[3] = (pack >>> 6) & 0x3F;
- buf[4] = (pack >>> 0) & 0x3F;
- bufPos = 0;
- }
- return buf[bufPos++];
- }
+
+ public CompressInputStream(InputStream in) {
+ super(in);
+ }
+
+ // buffer of unpacked 6-bit codes from last 32-word read
+ int buf[] = new int[5];
+
+ // position of next code to read in buffer (5 == end of buffer)
+ int bufPos = 5;
+
+ public int read() throws IOException {
+ try {
+ int code;
+ do {
+ code = readCode();
+ } while (code == NOP); // ignore NOP codes
+
+ if (code >= BASE)
+ return codeTable.charAt(code - BASE);
+ else if (code == RAW) {
+ int high = readCode();
+ int low = readCode();
+ return (high << 4) | low;
+ } else
+ throw new IOException("unknown compression code: " + code);
+ } catch (EOFException e) {
+ return -1;
+ }
+ }
+
+ public int read(byte b[], int off, int len) throws IOException {
+ if (len <= 0) {
+ return 0;
+ }
+
+ int c = read();
+ if (c == -1) {
+ return -1;
+ }
+ b[off] = (byte)c;
+
+ int i = 1;
+ /*****
+ try {
+ for (; i < len ; i++) {
+ c = read();
+ if (c == -1) {
+ break;
+ }
+ if (b != null) {
+ b[off + i] = (byte)c;
+ }
+ }
+ } catch (IOException ee) {
+ }
+ *****/
+ return i;
+ }
+
+ private int readCode() throws IOException {
+ if (bufPos == 5) {
+ int b1 = in.read();
+ int b2 = in.read();
+ int b3 = in.read();
+ int b4 = in.read();
+ if ((b1 | b2 | b3 | b4) < 0)
+ throw new EOFException();
+ int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+ buf[0] = (pack >>> 24) & 0x3F;
+ buf[1] = (pack >>> 18) & 0x3F;
+ buf[2] = (pack >>> 12) & 0x3F;
+ buf[3] = (pack >>> 6) & 0x3F;
+ buf[4] = (pack >>> 0) & 0x3F;
+ bufPos = 0;
+ }
+ return buf[bufPos++];
+ }
}
public static class CompressOutputStream extends FilterOutputStream
- implements CompressConstants
+ implements CompressConstants
{
-
- public CompressOutputStream(OutputStream out) {
- super(out);
- }
-
- // buffer of 6-bit codes to pack into next 32-bit word
- int buf[] = new int[5];
-
- // number of valid codes pending in buffer
- int bufPos = 0;
-
- public void write(int b) throws IOException {
- b &= 0xFF; // force argument to a byte
-
- int pos = codeTable.indexOf((char)b);
- if (pos != -1)
- writeCode(BASE + pos);
- else {
- writeCode(RAW);
- writeCode(b >> 4);
- writeCode(b & 0xF);
- }
- }
-
- public void write(byte b[], int off, int len) throws IOException {
- /*
- * This is quite an inefficient implementation, because it has to
- * call the other write method for every byte in the array. It
- * could be optimized for performance by doing all the processing
- * in this method.
- */
- for (int i = 0; i < len; i++)
- write(b[off + i]);
- }
-
- public void flush() throws IOException {
- while (bufPos > 0)
- writeCode(NOP);
- }
-
- private void writeCode(int c) throws IOException {
- buf[bufPos++] = c;
- if (bufPos == 5) { // write next word when we have 5 codes
- int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) |
- (buf[3] << 6) | buf[4];
- out.write((pack >>> 24) & 0xFF);
- out.write((pack >>> 16) & 0xFF);
- out.write((pack >>> 8) & 0xFF);
- out.write((pack >>> 0) & 0xFF);
- bufPos = 0;
- }
- }
+
+ public CompressOutputStream(OutputStream out) {
+ super(out);
+ }
+
+ // buffer of 6-bit codes to pack into next 32-bit word
+ int buf[] = new int[5];
+
+ // number of valid codes pending in buffer
+ int bufPos = 0;
+
+ public void write(int b) throws IOException {
+ b &= 0xFF; // force argument to a byte
+
+ int pos = codeTable.indexOf((char)b);
+ if (pos != -1)
+ writeCode(BASE + pos);
+ else {
+ writeCode(RAW);
+ writeCode(b >> 4);
+ writeCode(b & 0xF);
+ }
+ }
+
+ public void write(byte b[], int off, int len) throws IOException {
+ /*
+ * This is quite an inefficient implementation, because it has to
+ * call the other write method for every byte in the array. It
+ * could be optimized for performance by doing all the processing
+ * in this method.
+ */
+ for (int i = 0; i < len; i++)
+ write(b[off + i]);
+ }
+
+ public void flush() throws IOException {
+ while (bufPos > 0)
+ writeCode(NOP);
+ }
+
+ private void writeCode(int c) throws IOException {
+ buf[bufPos++] = c;
+ if (bufPos == 5) { // write next word when we have 5 codes
+ int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) |
+ (buf[3] << 6) | buf[4];
+ out.write((pack >>> 24) & 0xFF);
+ out.write((pack >>> 16) & 0xFF);
+ out.write((pack >>> 8) & 0xFF);
+ out.write((pack >>> 0) & 0xFF);
+ bufPos = 0;
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/Hello.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/Hello.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/HelloImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/HelloImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -36,49 +36,49 @@
public static boolean clientCalledSuccessfully = false;
public HelloImpl() throws RemoteException {
- super(0);
+ super(0);
}
-
+
public synchronized String sayHello() {
- HelloImpl.clientCalledSuccessfully = true;
- System.out.println("hello method called");
- this.notifyAll();
- return "hello";
+ HelloImpl.clientCalledSuccessfully = true;
+ System.out.println("hello method called");
+ this.notifyAll();
+ return "hello";
}
public static void main(String[] args) {
- /*
- * The following line is required with the JDK 1.2 VM so that the
- * VM can exit gracefully when this test completes. Otherwise, the
- * conservative garbage collector will find a handle to the server
- * object on the native stack and not clear the weak reference to
- * it in the RMI runtime's object table.
- */
- Object dummy = new Object();
- Hello hello = null;
- Registry registry = null;
+ /*
+ * The following line is required with the JDK 1.2 VM so that the
+ * VM can exit gracefully when this test completes. Otherwise, the
+ * conservative garbage collector will find a handle to the server
+ * object on the native stack and not clear the weak reference to
+ * it in the RMI runtime's object table.
+ */
+ Object dummy = new Object();
+ Hello hello = null;
+ Registry registry = null;
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
- try {
- String protocol = "";
- if (args.length >= 1)
- protocol = args[0];
+ try {
+ String protocol = "";
+ if (args.length >= 1)
+ protocol = args[0];
- registry = java.rmi.registry.LocateRegistry.
- getRegistry("localhost", TestLibrary.REGISTRY_PORT,
- new Compress.CompressRMIClientSocketFactory());
- UseCustomSocketFactory.checkStub(registry, "RMIClientSocket");
- hello = (Hello) registry.lookup("/HelloServer");
+ registry = java.rmi.registry.LocateRegistry.
+ getRegistry("localhost", TestLibrary.REGISTRY_PORT,
+ new Compress.CompressRMIClientSocketFactory());
+ UseCustomSocketFactory.checkStub(registry, "RMIClientSocket");
+ hello = (Hello) registry.lookup("/HelloServer");
- /* lookup server */
- System.err.println(hello.sayHello() +
- ", remote greeting.");
- } catch (Exception e) {
- System.err.println("EXCEPTION OCCURRED:");
- e.printStackTrace();
- } finally {
- hello = null;
- }
+ /* lookup server */
+ System.err.println(hello.sayHello() +
+ ", remote greeting.");
+ } catch (Exception e) {
+ System.err.println("EXCEPTION OCCURRED:");
+ e.printStackTrace();
+ } finally {
+ hello = null;
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/HelloImpl_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/HelloImpl_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,72 +29,72 @@
implements Hello, java.rmi.Remote
{
private static java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("java.lang.String sayHello()")
+ new java.rmi.server.Operation("java.lang.String sayHello()")
};
-
+
private static final long interfaceHash = 6486744599627128933L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_sayHello_0;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_sayHello_0 = Hello.class.getMethod("sayHello", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_sayHello_0 = Hello.class.getMethod("sayHello", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public HelloImpl_Stub() {
- super();
+ super();
}
public HelloImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of sayHello()
public java.lang.String sayHello()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_sayHello_0, null, 6043973830760146143L);
- return ((java.lang.String) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- java.lang.String $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_sayHello_0, null, 6043973830760146143L);
+ return ((java.lang.String) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ java.lang.String $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.String) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -47,86 +47,86 @@
* (i.e. compression) client and server socket factories.
*/
public class UseCustomSocketFactory {
-
+
Hello hello = null;
-
+
public static void main(String[] args) {
-
- Registry registry = null;
- HelloImpl impl = null;
+
+ Registry registry = null;
+ HelloImpl impl = null;
- System.out.println("\nRegression test for bug 4148850\n");
-
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ System.out.println("\nRegression test for bug 4148850\n");
- try {
- impl = new HelloImpl();
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+
+ try {
+ impl = new HelloImpl();
- /* Make sure that the rmiregistry can communicate over a
- * custom socket. Ensure that the functionality exists to
- * allow the rmiregistry to be secure.
- */
- registry = LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT,
- new Compress.CompressRMIClientSocketFactory(),
- new Compress.CompressRMIServerSocketFactory());
- registry.rebind("/HelloServer", impl);
- checkStub(registry, "RMIServerSocket");
-
- } catch (Exception e) {
- TestLibrary.bomb("creating registry", e);
- }
-
- JavaVM serverVM = new JavaVM("HelloImpl", "-Djava.security.policy=" +
- TestParams.defaultPolicy, "");
+ /* Make sure that the rmiregistry can communicate over a
+ * custom socket. Ensure that the functionality exists to
+ * allow the rmiregistry to be secure.
+ */
+ registry = LocateRegistry.
+ createRegistry(TestLibrary.REGISTRY_PORT,
+ new Compress.CompressRMIClientSocketFactory(),
+ new Compress.CompressRMIServerSocketFactory());
+ registry.rebind("/HelloServer", impl);
+ checkStub(registry, "RMIServerSocket");
- try {
+ } catch (Exception e) {
+ TestLibrary.bomb("creating registry", e);
+ }
+
+ JavaVM serverVM = new JavaVM("HelloImpl", "-Djava.security.policy=" +
+ TestParams.defaultPolicy, "");
+
+ try {
- /*
- * spawn VM for HelloServer which will download a client socket
- * factory
- */
- serverVM.start();
+ /*
+ * spawn VM for HelloServer which will download a client socket
+ * factory
+ */
+ serverVM.start();
- synchronized (impl) {
+ synchronized (impl) {
+
+ System.out.println("waiting for remote notification");
+
+ if (!HelloImpl.clientCalledSuccessfully) {
+ impl.wait(75 * 1000);
+ }
- System.out.println("waiting for remote notification");
-
- if (!HelloImpl.clientCalledSuccessfully) {
- impl.wait(75 * 1000);
- }
-
- if (!HelloImpl.clientCalledSuccessfully) {
- throw new RuntimeException("Client did not execute call in time...");
- }
- }
+ if (!HelloImpl.clientCalledSuccessfully) {
+ throw new RuntimeException("Client did not execute call in time...");
+ }
+ }
- System.err.println("\nRegression test for bug 4148850 passed.\n ");
+ System.err.println("\nRegression test for bug 4148850 passed.\n ");
+
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
-
- } finally {
- serverVM.destroy();
- try {
- registry.unbind("/HelloServer");
- } catch (Exception e) {
- TestLibrary.bomb("unbinding HelloServer", e);
- }
- TestLibrary.unexport(registry);
- TestLibrary.unexport(impl);
- impl = null;
- registry = null;
- }
+ } finally {
+ serverVM.destroy();
+ try {
+ registry.unbind("/HelloServer");
+ } catch (Exception e) {
+ TestLibrary.bomb("unbinding HelloServer", e);
+ }
+ TestLibrary.unexport(registry);
+ TestLibrary.unexport(impl);
+ impl = null;
+ registry = null;
+ }
}
static void checkStub(Object stub, String toCheck) throws RemoteException {
- System.err.println("Ensuring that the stub contains a socket factory string: " +
- toCheck);
- System.err.println(stub);
- if (stub.toString().indexOf(toCheck) < 0) {
- throw new RemoteException("RemoteStub.toString() did not contain instance of "
- + toCheck);
- }
+ System.err.println("Ensuring that the stub contains a socket factory string: " +
+ toCheck);
+ System.err.println(stub);
+ if (stub.toString().indexOf(toCheck) < 0) {
+ throw new RemoteException("RemoteStub.toString() did not contain instance of "
+ + toCheck);
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/CompressConstants.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/CompressConstants.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,9 +27,9 @@
interface CompressConstants {
// constants for 6-bit code values
- static final int NOP = 0; // no operation: used to pad words on flush()
- static final int RAW = 1; // introduces raw byte format
- static final int BASE = 2; // base for codes found in lookup table
+ static final int NOP = 0; // no operation: used to pad words on flush()
+ static final int RAW = 1; // introduces raw byte format
+ static final int BASE = 2; // base for codes found in lookup table
static final String codeTable =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()";
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.!?\"'()";
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/CompressInputStream.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/CompressInputStream.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,7 +31,7 @@
{
public CompressInputStream(InputStream in) {
- super(in);
+ super(in);
}
// buffer of unpacked 6-bit codes from last 32-word read
@@ -41,70 +41,70 @@
int bufPos = 5;
public int read() throws IOException {
- try {
- int code;
- do {
- code = readCode();
- } while (code == NOP); // ignore NOP codes
+ try {
+ int code;
+ do {
+ code = readCode();
+ } while (code == NOP); // ignore NOP codes
- if (code >= BASE)
- return codeTable.charAt(code - BASE);
- else if (code == RAW) {
- int high = readCode();
- int low = readCode();
- return (high << 4) | low;
- } else
- throw new IOException("unknown compression code: " + code);
- } catch (EOFException e) {
- return -1;
- }
+ if (code >= BASE)
+ return codeTable.charAt(code - BASE);
+ else if (code == RAW) {
+ int high = readCode();
+ int low = readCode();
+ return (high << 4) | low;
+ } else
+ throw new IOException("unknown compression code: " + code);
+ } catch (EOFException e) {
+ return -1;
+ }
}
public int read(byte b[], int off, int len) throws IOException {
- if (len <= 0) {
- return 0;
- }
+ if (len <= 0) {
+ return 0;
+ }
- int c = read();
- if (c == -1) {
- return -1;
- }
- b[off] = (byte)c;
+ int c = read();
+ if (c == -1) {
+ return -1;
+ }
+ b[off] = (byte)c;
- int i = 1;
+ int i = 1;
/*****
- try {
- for (; i < len ; i++) {
- c = read();
- if (c == -1) {
- break;
- }
- if (b != null) {
- b[off + i] = (byte)c;
- }
- }
- } catch (IOException ee) {
- }
+ try {
+ for (; i < len ; i++) {
+ c = read();
+ if (c == -1) {
+ break;
+ }
+ if (b != null) {
+ b[off + i] = (byte)c;
+ }
+ }
+ } catch (IOException ee) {
+ }
*****/
- return i;
+ return i;
}
private int readCode() throws IOException {
- if (bufPos == 5) {
- int b1 = in.read();
- int b2 = in.read();
- int b3 = in.read();
- int b4 = in.read();
- if ((b1 | b2 | b3 | b4) < 0)
- throw new EOFException();
- int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
- buf[0] = (pack >>> 24) & 0x3F;
- buf[1] = (pack >>> 18) & 0x3F;
- buf[2] = (pack >>> 12) & 0x3F;
- buf[3] = (pack >>> 6) & 0x3F;
- buf[4] = (pack >>> 0) & 0x3F;
- bufPos = 0;
- }
- return buf[bufPos++];
+ if (bufPos == 5) {
+ int b1 = in.read();
+ int b2 = in.read();
+ int b3 = in.read();
+ int b4 = in.read();
+ if ((b1 | b2 | b3 | b4) < 0)
+ throw new EOFException();
+ int pack = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+ buf[0] = (pack >>> 24) & 0x3F;
+ buf[1] = (pack >>> 18) & 0x3F;
+ buf[2] = (pack >>> 12) & 0x3F;
+ buf[3] = (pack >>> 6) & 0x3F;
+ buf[4] = (pack >>> 0) & 0x3F;
+ bufPos = 0;
+ }
+ return buf[bufPos++];
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/CompressOutputStream.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/CompressOutputStream.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,7 +31,7 @@
{
public CompressOutputStream(OutputStream out) {
- super(out);
+ super(out);
}
// buffer of 6-bit codes to pack into next 32-bit word
@@ -41,44 +41,44 @@
int bufPos = 0;
public void write(int b) throws IOException {
- b &= 0xFF; // force argument to a byte
+ b &= 0xFF; // force argument to a byte
- int pos = codeTable.indexOf((char)b);
- if (pos != -1)
- writeCode(BASE + pos);
- else {
- writeCode(RAW);
- writeCode(b >> 4);
- writeCode(b & 0xF);
- }
+ int pos = codeTable.indexOf((char)b);
+ if (pos != -1)
+ writeCode(BASE + pos);
+ else {
+ writeCode(RAW);
+ writeCode(b >> 4);
+ writeCode(b & 0xF);
+ }
}
public void write(byte b[], int off, int len) throws IOException {
- /*
- * This is quite an inefficient implementation, because it has to
- * call the other write method for every byte in the array. It
+ /*
+ * This is quite an inefficient implementation, because it has to
+ * call the other write method for every byte in the array. It
* could be optimized for performance by doing all the processing
- * in this method.
- */
- for (int i = 0; i < len; i++)
- write(b[off + i]);
+ * in this method.
+ */
+ for (int i = 0; i < len; i++)
+ write(b[off + i]);
}
public void flush() throws IOException {
- while (bufPos > 0)
- writeCode(NOP);
+ while (bufPos > 0)
+ writeCode(NOP);
}
private void writeCode(int c) throws IOException {
- buf[bufPos++] = c;
- if (bufPos == 5) { // write next word when we have 5 codes
- int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) |
- (buf[3] << 6) | buf[4];
- out.write((pack >>> 24) & 0xFF);
- out.write((pack >>> 16) & 0xFF);
- out.write((pack >>> 8) & 0xFF);
- out.write((pack >>> 0) & 0xFF);
- bufPos = 0;
- }
+ buf[bufPos++] = c;
+ if (bufPos == 5) { // write next word when we have 5 codes
+ int pack = (buf[0] << 24) | (buf[1] << 18) | (buf[2] << 12) |
+ (buf[3] << 6) | buf[4];
+ out.write((pack >>> 24) & 0xFF);
+ out.write((pack >>> 16) & 0xFF);
+ out.write((pack >>> 8) & 0xFF);
+ out.write((pack >>> 0) & 0xFF);
+ bufPos = 0;
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/Echo.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/Echo.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/EchoImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/EchoImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -33,44 +33,44 @@
private static final byte[] pattern = { (byte) 'A' };
public EchoImpl(String protocol) throws RemoteException {
- super(0,
- new MultiSocketFactory.ClientFactory(protocol, pattern),
- new MultiSocketFactory.ServerFactory(protocol, pattern));
+ super(0,
+ new MultiSocketFactory.ClientFactory(protocol, pattern),
+ new MultiSocketFactory.ServerFactory(protocol, pattern));
}
-
+
public byte[] echoNot(byte[] data) {
- byte[] result = new byte[data.length];
- for (int i = 0; i < data.length; i++)
- result[i] = (byte) ~data[i];
- return result;
+ byte[] result = new byte[data.length];
+ for (int i = 0; i < data.length; i++)
+ result[i] = (byte) ~data[i];
+ return result;
}
public static void main(String[] args) {
- /*
- * The following line is required with the JDK 1.2 VM so that the
- * VM can exit gracefully when this test completes. Otherwise, the
- * conservative garbage collector will find a handle to the server
- * object on the native stack and not clear the weak reference to
- * it in the RMI runtime's object table.
- */
- Object dummy = new Object();
-
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
-
- try {
- String protocol = "";
- if (args.length >= 1)
- protocol = args[0];
+ /*
+ * The following line is required with the JDK 1.2 VM so that the
+ * VM can exit gracefully when this test completes. Otherwise, the
+ * conservative garbage collector will find a handle to the server
+ * object on the native stack and not clear the weak reference to
+ * it in the RMI runtime's object table.
+ */
+ Object dummy = new Object();
+
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
- System.out.println("EchoServer: creating remote object");
- EchoImpl impl = new EchoImpl(protocol);
- System.out.println("EchoServer: binding in registry");
- Naming.rebind("//:" + TestLibrary.REGISTRY_PORT +
- "/EchoServer", impl);
- System.out.println("EchoServer ready.");
- } catch (Exception e) {
- System.err.println("EXCEPTION OCCURRED:");
- e.printStackTrace();
- }
+ try {
+ String protocol = "";
+ if (args.length >= 1)
+ protocol = args[0];
+
+ System.out.println("EchoServer: creating remote object");
+ EchoImpl impl = new EchoImpl(protocol);
+ System.out.println("EchoServer: binding in registry");
+ Naming.rebind("//:" + TestLibrary.REGISTRY_PORT +
+ "/EchoServer", impl);
+ System.out.println("EchoServer ready.");
+ } catch (Exception e) {
+ System.err.println("EXCEPTION OCCURRED:");
+ e.printStackTrace();
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/EchoImpl_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/EchoImpl_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,38 +29,38 @@
implements Echo, java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_echoNot_0;
-
+
static {
- try {
- $method_echoNot_0 = Echo.class.getMethod("echoNot", new java.lang.Class[] {byte[].class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_echoNot_0 = Echo.class.getMethod("echoNot", new java.lang.Class[] {byte[].class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public EchoImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of echoNot(byte[])
public byte[] echoNot(byte[] $param_arrayOf_byte_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- Object $result = ref.invoke(this, $method_echoNot_0, new java.lang.Object[] {$param_arrayOf_byte_1}, -4295721514897591756L);
- return ((byte[]) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_echoNot_0, new java.lang.Object[] {$param_arrayOf_byte_1}, -4295721514897591756L);
+ return ((byte[]) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/MultiSocketFactory.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/MultiSocketFactory.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,194 +34,193 @@
public class MultiSocketFactory {
private static RMISocketFactory def =
- RMISocketFactory.getDefaultSocketFactory();
+ RMISocketFactory.getDefaultSocketFactory();
+
-
public static class ServerFactory
- implements RMIServerSocketFactory, Serializable
+ implements RMIServerSocketFactory, Serializable
{
- private String protocol;
- private byte[] data;
+ private String protocol;
+ private byte[] data;
- public ServerFactory(String protocol, byte[] data) {
- this.protocol = protocol;
- this.data = data;
- }
+ public ServerFactory(String protocol, byte[] data) {
+ this.protocol = protocol;
+ this.data = data;
+ }
- public ServerSocket createServerSocket(int port) throws IOException
- {
- if (protocol.equals("compress")) {
- return new CompressServerSocket(port);
-
- } else if (protocol.equals("xor")) {
- if (data == null || data.length != 1)
- throw new IOException("invalid argument for XOR protocol");
- return new XorServerSocket(port, data[0]);
+ public ServerSocket createServerSocket(int port) throws IOException
+ {
+ if (protocol.equals("compress")) {
+ return new CompressServerSocket(port);
- }
-
- return def.createServerSocket(port);
- }
+ } else if (protocol.equals("xor")) {
+ if (data == null || data.length != 1)
+ throw new IOException("invalid argument for XOR protocol");
+ return new XorServerSocket(port, data[0]);
+
+ }
+
+ return def.createServerSocket(port);
+ }
}
public static class ClientFactory
- implements RMIClientSocketFactory, Serializable
+ implements RMIClientSocketFactory, Serializable
{
- private String protocol;
- private byte[] data;
+ private String protocol;
+ private byte[] data;
+
+ public ClientFactory(String protocol, byte[] data) {
+ this.protocol = protocol;
+ this.data = data;
+ }
- public ClientFactory(String protocol, byte[] data) {
- this.protocol = protocol;
- this.data = data;
- }
-
- public Socket createSocket(String host, int port)
- throws IOException
- {
- if (protocol.equals("compress")) {
- return new CompressSocket(host, port);
-
- } else if (protocol.equals("xor")) {
- if (data == null || data.length != 1)
- throw new IOException("invalid argument for XOR protocol");
- return new XorSocket(host, port, data[0]);
+ public Socket createSocket(String host, int port)
+ throws IOException
+ {
+ if (protocol.equals("compress")) {
+ return new CompressSocket(host, port);
- }
+ } else if (protocol.equals("xor")) {
+ if (data == null || data.length != 1)
+ throw new IOException("invalid argument for XOR protocol");
+ return new XorSocket(host, port, data[0]);
- return def.createSocket(host, port);
- }
+ }
+
+ return def.createSocket(host, port);
+ }
}
static class CompressSocket extends Socket {
- private InputStream in;
- private OutputStream out;
- public CompressSocket() { super(); }
- public CompressSocket(String host, int port) throws IOException {
- super(host, port);
- }
- public InputStream getInputStream() throws IOException {
- if (in == null) {
- in = new CompressInputStream(super.getInputStream());
- }
- return in;
+ private InputStream in;
+ private OutputStream out;
+ public CompressSocket() { super(); }
+ public CompressSocket(String host, int port) throws IOException {
+ super(host, port);
}
- public OutputStream getOutputStream() throws IOException {
- if (out == null) {
- out = new CompressOutputStream(super.getOutputStream());
- }
- return out;
- }
+ public InputStream getInputStream() throws IOException {
+ if (in == null) {
+ in = new CompressInputStream(super.getInputStream());
+ }
+ return in;
+ }
+ public OutputStream getOutputStream() throws IOException {
+ if (out == null) {
+ out = new CompressOutputStream(super.getOutputStream());
+ }
+ return out;
+ }
}
static class CompressServerSocket extends ServerSocket {
- public CompressServerSocket(int port) throws IOException {
- super(port);
- }
- public Socket accept() throws IOException {
- Socket s = new CompressSocket();
- implAccept(s);
- return s;
- }
+ public CompressServerSocket(int port) throws IOException {
+ super(port);
+ }
+ public Socket accept() throws IOException {
+ Socket s = new CompressSocket();
+ implAccept(s);
+ return s;
+ }
}
static class XorSocket extends Socket {
- private byte pattern;
- private InputStream in;
- private OutputStream out;
- public XorSocket(byte pattern) { super(); this.pattern = pattern; }
- public XorSocket(String host, int port, byte pattern)
- throws IOException
- {
- super(host, port);
- this.pattern = pattern;
- }
- public InputStream getInputStream() throws IOException {
- if (in == null) {
- in = new XorInputStream(super.getInputStream(), pattern);
- }
- return in;
+ private byte pattern;
+ private InputStream in;
+ private OutputStream out;
+ public XorSocket(byte pattern) { super(); this.pattern = pattern; }
+ public XorSocket(String host, int port, byte pattern)
+ throws IOException
+ {
+ super(host, port);
+ this.pattern = pattern;
}
- public OutputStream getOutputStream() throws IOException {
- if (out == null) {
- out = new XorOutputStream(super.getOutputStream(), pattern);
- }
- return out;
- }
+ public InputStream getInputStream() throws IOException {
+ if (in == null) {
+ in = new XorInputStream(super.getInputStream(), pattern);
+ }
+ return in;
+ }
+ public OutputStream getOutputStream() throws IOException {
+ if (out == null) {
+ out = new XorOutputStream(super.getOutputStream(), pattern);
+ }
+ return out;
+ }
}
static class XorServerSocket extends ServerSocket {
- private byte pattern;
- public XorServerSocket(int port, byte pattern) throws IOException {
- super(port);
- this.pattern = pattern;
- }
- public Socket accept() throws IOException {
- Socket s = new XorSocket(pattern);
- implAccept(s);
- return s;
- }
+ private byte pattern;
+ public XorServerSocket(int port, byte pattern) throws IOException {
+ super(port);
+ this.pattern = pattern;
+ }
+ public Socket accept() throws IOException {
+ Socket s = new XorSocket(pattern);
+ implAccept(s);
+ return s;
+ }
}
static class XorOutputStream extends FilterOutputStream {
- private byte pattern;
- public XorOutputStream(OutputStream out, byte pattern) {
- super(out);
- this.pattern = pattern;
- }
- public void write(int b) throws IOException {
- out.write(b ^ pattern);
- out.flush();
- }
- public void write(byte b[], int off, int len) throws IOException {
- for (int i = 0; i < len; i++)
- write(b[off + i]);
- }
+ private byte pattern;
+ public XorOutputStream(OutputStream out, byte pattern) {
+ super(out);
+ this.pattern = pattern;
+ }
+ public void write(int b) throws IOException {
+ out.write(b ^ pattern);
+ out.flush();
+ }
+ public void write(byte b[], int off, int len) throws IOException {
+ for (int i = 0; i < len; i++)
+ write(b[off + i]);
+ }
}
static class XorInputStream extends FilterInputStream {
- private byte pattern;
- public XorInputStream(InputStream in, byte pattern) {
- super(in);
- this.pattern = pattern;
- }
- public int read() throws IOException {
- int b = in.read();
-// System.out.print("BEFORE: " + Integer.toHexString(b));
- if (b != -1)
- b = (b ^ pattern) & 0xFF;
-// System.out.println("\tAFTER: " + Integer.toHexString(b));
- return b;
- }
- public int read(byte b[], int off, int len) throws IOException {
- if (len <= 0) {
- return 0;
- }
+ private byte pattern;
+ public XorInputStream(InputStream in, byte pattern) {
+ super(in);
+ this.pattern = pattern;
+ }
+ public int read() throws IOException {
+ int b = in.read();
+// System.out.print("BEFORE: " + Integer.toHexString(b));
+ if (b != -1)
+ b = (b ^ pattern) & 0xFF;
+// System.out.println("\tAFTER: " + Integer.toHexString(b));
+ return b;
+ }
+ public int read(byte b[], int off, int len) throws IOException {
+ if (len <= 0) {
+ return 0;
+ }
- int c = read();
- if (c == -1) {
- return -1;
- }
- b[off] = (byte)c;
+ int c = read();
+ if (c == -1) {
+ return -1;
+ }
+ b[off] = (byte)c;
- int i = 1;
+ int i = 1;
/*****
- try {
- for (; i < len ; i++) {
- c = read();
- if (c == -1) {
- break;
- }
- if (b != null) {
- b[off + i] = (byte)c;
- }
- }
- } catch (IOException ee) {
- }
+ try {
+ for (; i < len ; i++) {
+ c = read();
+ if (c == -1) {
+ break;
+ }
+ if (b != null) {
+ b[off + i] = (byte)c;
+ }
+ }
+ } catch (IOException ee) {
+ }
*****/
- return i;
- }
+ return i;
+ }
}
}
-
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,7 @@
* @bug 4127826
*
* @summary synopsis: need to download factories for use with custom socket
- * types
+ * types
* @author Ann Wollrath
*
* @library ../../../../testlibrary
@@ -45,77 +45,77 @@
public class UseCustomSocketFactory {
public static void main(String[] args) {
-
- String[] protocol = new String[] { "", "compress", "xor" };
+
+ String[] protocol = new String[] { "", "compress", "xor" };
+
+ System.out.println("\nRegression test for bug 4127826\n");
- System.out.println("\nRegression test for bug 4127826\n");
-
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
- try {
- LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
- } catch (Exception e) {
- TestLibrary.bomb("creating registry", e);
- }
+ try {
+ LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
+ } catch (Exception e) {
+ TestLibrary.bomb("creating registry", e);
+ }
- for (int i = 0; i < protocol.length; i++) {
+ for (int i = 0; i < protocol.length; i++) {
- System.err.println("test policy: " +
- TestParams.defaultPolicy);
+ System.err.println("test policy: " +
+ TestParams.defaultPolicy);
- JavaVM serverVM = new JavaVM("EchoImpl",
- "-Djava.security.policy=" +
- TestParams.defaultPolicy,
- protocol[i]);
- System.err.println("\nusing protocol: " +
- (protocol[i] == "" ? "none" : protocol[i]));
-
- try {
- /* spawn VM for EchoServer */
- serverVM.start();
+ JavaVM serverVM = new JavaVM("EchoImpl",
+ "-Djava.security.policy=" +
+ TestParams.defaultPolicy,
+ protocol[i]);
+ System.err.println("\nusing protocol: " +
+ (protocol[i] == "" ? "none" : protocol[i]));
+
+ try {
+ /* spawn VM for EchoServer */
+ serverVM.start();
- /* lookup server */
- int tries = 8;
- Echo obj = null;
- do {
- try {
- obj = (Echo) Naming.lookup("//:" + TestLibrary.REGISTRY_PORT +
- "/EchoServer");
- break;
- } catch (NotBoundException e) {
- try {
- Thread.sleep(2000);
- } catch (Exception ignore) {
- }
- continue;
- }
- } while (--tries > 0);
+ /* lookup server */
+ int tries = 8;
+ Echo obj = null;
+ do {
+ try {
+ obj = (Echo) Naming.lookup("//:" + TestLibrary.REGISTRY_PORT +
+ "/EchoServer");
+ break;
+ } catch (NotBoundException e) {
+ try {
+ Thread.sleep(2000);
+ } catch (Exception ignore) {
+ }
+ continue;
+ }
+ } while (--tries > 0);
- if (obj == null)
- TestLibrary.bomb("server not bound in 8 tries", null);
+ if (obj == null)
+ TestLibrary.bomb("server not bound in 8 tries", null);
- /* invoke remote method and print result*/
- System.err.println("Bound to " + obj);
- byte[] data = ("Greetings, citizen " +
- System.getProperty("user.name") + "!"). getBytes();
- byte[] result = obj.echoNot(data);
- for (int j = 0; j < result.length; j++)
- result[j] = (byte) ~result[j];
- System.err.println("Result: " + new String(result));
-
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
-
- } finally {
- serverVM.destroy();
- try {
- Naming.unbind("//:" + TestLibrary.REGISTRY_PORT +
- "/EchoServer");
- } catch (Exception e) {
- TestLibrary.bomb("unbinding EchoServer", e);
-
- }
- }
- }
+ /* invoke remote method and print result*/
+ System.err.println("Bound to " + obj);
+ byte[] data = ("Greetings, citizen " +
+ System.getProperty("user.name") + "!"). getBytes();
+ byte[] result = obj.echoNot(data);
+ for (int j = 0; j < result.length; j++)
+ result[j] = (byte) ~result[j];
+ System.err.println("Result: " + new String(result));
+
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
+
+ } finally {
+ serverVM.destroy();
+ try {
+ Naming.unbind("//:" + TestLibrary.REGISTRY_PORT +
+ "/EchoServer");
+ } catch (Exception e) {
+ TestLibrary.bomb("unbinding EchoServer", e);
+
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,7 @@
* @bug 4533390
* @summary SecurityException can be obtained but is not specified.
* The RemoteServer.setLog method requires
- * java.util.log.LoggingPermission("control").
+ * java.util.log.LoggingPermission("control").
* @author Ann Wollrath
* @run main/othervm/policy=java.policy SetLogPermission
*/
@@ -40,42 +40,42 @@
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4533390\n");
+ System.err.println("\nRegression test for bug 4533390\n");
+
+ if (System.getSecurityManager() == null) {
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ CodeSource codesource = new CodeSource(null, (Certificate[]) null);
+ Permissions perms = null;
+ ProtectionDomain pd = new ProtectionDomain(codesource, perms);
+ AccessControlContext acc =
+ new AccessControlContext(new ProtectionDomain[] { pd });
- if (System.getSecurityManager() == null) {
- System.setSecurityManager(new SecurityManager());
- }
-
- CodeSource codesource = new CodeSource(null, (Certificate[]) null);
- Permissions perms = null;
- ProtectionDomain pd = new ProtectionDomain(codesource, perms);
- AccessControlContext acc =
- new AccessControlContext(new ProtectionDomain[] { pd });
-
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- try {
- System.err.println(
- "Attempt to set log without permission");
- RemoteServer.setLog(new ByteArrayOutputStream());
- throw new RuntimeException(
- "TEST FAILED: set log without permission");
- } catch (SecurityException e) {
- System.err.println(
- "TEST PASSED: unable to set log without permission");
- }
- return null;
- }}, acc);
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ try {
+ System.err.println(
+ "Attempt to set log without permission");
+ RemoteServer.setLog(new ByteArrayOutputStream());
+ throw new RuntimeException(
+ "TEST FAILED: set log without permission");
+ } catch (SecurityException e) {
+ System.err.println(
+ "TEST PASSED: unable to set log without permission");
+ }
+ return null;
+ }}, acc);
- try {
- System.err.println("Attempt to set log with permission");
- RemoteServer.setLog(new ByteArrayOutputStream());
- System.err.println(
- "TEST PASSED: sufficient permission to set log");
- } catch (SecurityException e) {
- System.err.println("TEST FAILED: unable to set log");
- throw e;
- }
+ try {
+ System.err.println("Attempt to set log with permission");
+ RemoteServer.setLog(new ByteArrayOutputStream());
+ System.err.println(
+ "TEST PASSED: sufficient permission to set log");
+ } catch (SecurityException e) {
+ System.err.println("TEST FAILED: unable to set log");
+ throw e;
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -50,40 +50,40 @@
}
public void receive(Remote obj) {
- System.err.println("received: " + obj.toString());
+ System.err.println("received: " + obj.toString());
}
public static void main(String[] args) throws Exception {
- InetAddress localAddress = InetAddress.getLocalHost();
- String[] hostlist = new String[] {
- localAddress.getHostAddress(), localAddress.getHostName() };
+ InetAddress localAddress = InetAddress.getLocalHost();
+ String[] hostlist = new String[] {
+ localAddress.getHostAddress(), localAddress.getHostName() };
+
+ for (int i = 0; i < hostlist.length; i++) {
- for (int i = 0; i < hostlist.length; i++) {
-
- System.setProperty("java.rmi.server.hostname", hostlist[i]);
- Remote impl = new ChangeHostName();
- System.err.println("\ncreated impl extending URO: " + impl);
-
- Receiver stub = (Receiver) RemoteObject.toStub(impl);
- System.err.println("stub for impl: " + stub);
+ System.setProperty("java.rmi.server.hostname", hostlist[i]);
+ Remote impl = new ChangeHostName();
+ System.err.println("\ncreated impl extending URO: " + impl);
+
+ Receiver stub = (Receiver) RemoteObject.toStub(impl);
+ System.err.println("stub for impl: " + stub);
- System.err.println("invoking method on stub");
- stub.receive(stub);
+ System.err.println("invoking method on stub");
+ stub.receive(stub);
- UnicastRemoteObject.unexportObject(impl, true);
- System.err.println("unexported impl");
+ UnicastRemoteObject.unexportObject(impl, true);
+ System.err.println("unexported impl");
- if (stub.toString().indexOf(hostlist[i]) >= 0) {
- System.err.println("stub's ref contains hostname: " +
- hostlist[i]);
- } else {
- throw new RuntimeException(
- "TEST FAILED: stub's ref doesn't contain hostname: " +
- hostlist[i]);
- }
- }
- System.err.println("TEST PASSED");
+ if (stub.toString().indexOf(hostlist[i]) >= 0) {
+ System.err.println("stub's ref contains hostname: " +
+ hostlist[i]);
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: stub's ref doesn't contain hostname: " +
+ hostlist[i]);
+ }
+ }
+ System.err.println("TEST PASSED");
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/changeHostName/ChangeHostName_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,37 +29,37 @@
implements Receiver, java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_receive_0;
-
+
static {
- try {
- $method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public ChangeHostName_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of receive(Remote)
public void receive(java.rmi.Remote $param_Remote_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -59,83 +59,83 @@
private boolean stillAlive = false;
public void submitShutdown(Shutdown shutdown) {
- synchronized (lock) {
- this.shutdown = shutdown;
- lock.notifyAll();
- }
+ synchronized (lock) {
+ this.shutdown = shutdown;
+ lock.notifyAll();
+ }
}
public void declareStillAlive() {
- synchronized (lock) {
- stillAlive = true;
- lock.notifyAll();
- }
+ synchronized (lock) {
+ stillAlive = true;
+ lock.notifyAll();
+ }
}
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4308492\n");
+ System.err.println("\nRegression test for bug 4308492\n");
- KeepAliveDuringCall obj = new KeepAliveDuringCall();
+ KeepAliveDuringCall obj = new KeepAliveDuringCall();
- try {
- UnicastRemoteObject.exportObject(obj);
- System.err.println("exported shutdown monitor");
+ try {
+ UnicastRemoteObject.exportObject(obj);
+ System.err.println("exported shutdown monitor");
- Registry localRegistry =
- LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
- System.err.println("created local registry");
+ Registry localRegistry =
+ LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
+ System.err.println("created local registry");
- localRegistry.bind(BINDING, obj);
- System.err.println("bound shutdown monitor in local registry");
+ localRegistry.bind(BINDING, obj);
+ System.err.println("bound shutdown monitor in local registry");
- System.err.println("starting remote ShutdownImpl VM...");
- (new JavaVM("ShutdownImpl")).start();
+ System.err.println("starting remote ShutdownImpl VM...");
+ (new JavaVM("ShutdownImpl")).start();
- Shutdown s;
- synchronized (obj.lock) {
- System.err.println(
- "waiting for submission of object to shutdown...");
- while ((s = obj.shutdown) == null) {
- obj.lock.wait(TIMEOUT);
- }
- if (s == null) {
- throw new RuntimeException(
- "TEST FAILED: timeout waiting for shutdown object " +
- "to make initial contact");
- }
- System.err.println("shutdown object submitted: " + s);
- }
+ Shutdown s;
+ synchronized (obj.lock) {
+ System.err.println(
+ "waiting for submission of object to shutdown...");
+ while ((s = obj.shutdown) == null) {
+ obj.lock.wait(TIMEOUT);
+ }
+ if (s == null) {
+ throw new RuntimeException(
+ "TEST FAILED: timeout waiting for shutdown object " +
+ "to make initial contact");
+ }
+ System.err.println("shutdown object submitted: " + s);
+ }
- try {
- s.shutdown();
- } catch (RemoteException e) {
- throw new RuntimeException(
- "TEST FAILED: shutdown method threw remote exception", e);
- }
+ try {
+ s.shutdown();
+ } catch (RemoteException e) {
+ throw new RuntimeException(
+ "TEST FAILED: shutdown method threw remote exception", e);
+ }
- synchronized (obj.lock) {
- if (!obj.stillAlive) {
- throw new RuntimeException("TEST FAILED: " +
- "shutdown object not detected alive after unexport");
- }
- }
+ synchronized (obj.lock) {
+ if (!obj.stillAlive) {
+ throw new RuntimeException("TEST FAILED: " +
+ "shutdown object not detected alive after unexport");
+ }
+ }
- System.err.println("TEST PASSED: " +
- "shutdown object detected still alive after unexport");
+ System.err.println("TEST PASSED: " +
+ "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 {
- UnicastRemoteObject.unexportObject(obj, true);
- } catch (RemoteException e) {
- }
- }
+ } catch (Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected exception", e);
+ }
+ } finally {
+ try {
+ UnicastRemoteObject.unexportObject(obj, true);
+ } catch (RemoteException e) {
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,54 +29,54 @@
implements ShutdownMonitor
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_declareStillAlive_0;
private static java.lang.reflect.Method $method_submitShutdown_1;
-
+
static {
- try {
- $method_declareStillAlive_0 = ShutdownMonitor.class.getMethod("declareStillAlive", new java.lang.Class[] {});
- $method_submitShutdown_1 = ShutdownMonitor.class.getMethod("submitShutdown", new java.lang.Class[] {Shutdown.class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_declareStillAlive_0 = ShutdownMonitor.class.getMethod("declareStillAlive", new java.lang.Class[] {});
+ $method_submitShutdown_1 = ShutdownMonitor.class.getMethod("submitShutdown", new java.lang.Class[] {Shutdown.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public KeepAliveDuringCall_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of declareStillAlive()
public void declareStillAlive()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_declareStillAlive_0, null, -1562228924246272634L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_declareStillAlive_0, null, -1562228924246272634L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of submitShutdown(Shutdown)
public void submitShutdown(Shutdown $param_Shutdown_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_submitShutdown_1, new java.lang.Object[] {$param_Shutdown_1}, 7574258166120515108L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_submitShutdown_1, new java.lang.Object[] {$param_Shutdown_1}, 7574258166120515108L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/Shutdown.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/Shutdown.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,58 +32,58 @@
public class ShutdownImpl implements Shutdown {
- private static Remote impl; // rooted here to prevent GC
+ private static Remote impl; // rooted here to prevent GC
private final ShutdownMonitor monitor;
private ShutdownImpl(ShutdownMonitor monitor) {
- this.monitor = monitor;
+ this.monitor = monitor;
}
public void shutdown() {
- try {
- System.err.println(
- "(ShutdownImpl.shutdown) shutdown method invoked:");
+ try {
+ System.err.println(
+ "(ShutdownImpl.shutdown) shutdown method invoked:");
- UnicastRemoteObject.unexportObject(this, true);
- System.err.println(
- "(ShutdownImpl.shutdown) shutdown object unexported");
+ UnicastRemoteObject.unexportObject(this, true);
+ System.err.println(
+ "(ShutdownImpl.shutdown) shutdown object unexported");
- Thread.sleep(500);
- System.err.println("(ShutDownImpl.shutdown) FEE");
- Thread.sleep(500);
- System.err.println("(ShutDownImpl.shutdown) FIE");
- Thread.sleep(500);
- System.err.println("(ShutDownImpl.shutdown) FOE");
- Thread.sleep(500);
- System.err.println("(ShutDownImpl.shutdown) FOO");
+ Thread.sleep(500);
+ System.err.println("(ShutDownImpl.shutdown) FEE");
+ Thread.sleep(500);
+ System.err.println("(ShutDownImpl.shutdown) FIE");
+ Thread.sleep(500);
+ System.err.println("(ShutDownImpl.shutdown) FOE");
+ Thread.sleep(500);
+ System.err.println("(ShutDownImpl.shutdown) FOO");
- monitor.declareStillAlive();
- System.err.println("(ShutDownImpl.shutdown) still alive!");
- } catch (Exception e) {
- throw new RuntimeException(
- "unexpected exception occurred in shutdown method", e);
- }
+ monitor.declareStillAlive();
+ System.err.println("(ShutDownImpl.shutdown) still alive!");
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "unexpected exception occurred in shutdown method", e);
+ }
}
public static void main(String[] args) {
- try {
- Registry registry =
- LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
- ShutdownMonitor monitor = (ShutdownMonitor)
- registry.lookup(KeepAliveDuringCall.BINDING);
- System.err.println("(ShutdownImpl) retrieved shutdown monitor");
+ try {
+ Registry registry =
+ LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
+ ShutdownMonitor monitor = (ShutdownMonitor)
+ registry.lookup(KeepAliveDuringCall.BINDING);
+ System.err.println("(ShutdownImpl) retrieved shutdown monitor");
- impl = new ShutdownImpl(monitor);
- Shutdown stub = (Shutdown) UnicastRemoteObject.exportObject(impl);
- System.err.println("(ShutdownImpl) exported shutdown object");
+ impl = new ShutdownImpl(monitor);
+ Shutdown stub = (Shutdown) UnicastRemoteObject.exportObject(impl);
+ System.err.println("(ShutdownImpl) exported shutdown object");
- monitor.submitShutdown(stub);
- System.err.println("(ShutdownImpl) submitted shutdown object");
+ monitor.submitShutdown(stub);
+ System.err.println("(ShutdownImpl) submitted shutdown object");
- } catch (Exception e) {
- System.err.println("(ShutdownImpl) TEST SUBPROCESS FAILURE:");
- e.printStackTrace();
- }
+ } catch (Exception e) {
+ System.err.println("(ShutdownImpl) TEST SUBPROCESS FAILURE:");
+ e.printStackTrace();
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownImpl_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownImpl_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,37 +29,37 @@
implements Shutdown
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_shutdown_0;
-
+
static {
- try {
- $method_shutdown_0 = Shutdown.class.getMethod("shutdown", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_shutdown_0 = Shutdown.class.getMethod("shutdown", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public ShutdownImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of shutdown()
public void shutdown()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_shutdown_0, null, -7207851917985848402L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_shutdown_0, null, -7207851917985848402L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownMonitor.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownMonitor.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -53,35 +53,35 @@
}
public static void main(String[] args) throws Exception {
- Remote impl2 = null;
- try {
- Remote impl = new MarshalAfterUnexport();
- System.err.println("created impl extending URO: " + impl);
+ Remote impl2 = null;
+ try {
+ Remote impl = new MarshalAfterUnexport();
+ System.err.println("created impl extending URO: " + impl);
- Receiver stub = (Receiver) RemoteObject.toStub(impl);
- System.err.println("stub for impl: " + stub);
+ Receiver stub = (Receiver) RemoteObject.toStub(impl);
+ System.err.println("stub for impl: " + stub);
- UnicastRemoteObject.unexportObject(impl, true);
- System.err.println("unexported impl");
+ UnicastRemoteObject.unexportObject(impl, true);
+ System.err.println("unexported impl");
- impl2 = new MarshalAfterUnexport();
- Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
+ impl2 = new MarshalAfterUnexport();
+ Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
- System.err.println("marshalling unexported object:");
- MarshalledObject mobj = new MarshalledObject(impl);
+ System.err.println("marshalling unexported object:");
+ MarshalledObject mobj = new MarshalledObject(impl);
- System.err.println("passing unexported object via RMI-JRMP:");
- stub2.receive(stub);
+ System.err.println("passing unexported object via RMI-JRMP:");
+ stub2.receive(stub);
- System.err.println("TEST PASSED");
- } finally {
- if (impl2 != null) {
- try {
- UnicastRemoteObject.unexportObject(impl2, true);
- } catch (Throwable t) {
- }
- }
- }
+ System.err.println("TEST PASSED");
+ } finally {
+ if (impl2 != null) {
+ try {
+ UnicastRemoteObject.unexportObject(impl2, true);
+ } catch (Throwable t) {
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -49,47 +49,47 @@
implements Receiver
{
public MarshalAfterUnexport2() throws RemoteException {
- super(0, null, null);
+ super(0, null, null);
}
public void receive(Remote obj) {
}
public static void main(String[] args) throws Exception {
-
- System.err.println("\nRegression test for bug 4513223\n");
-
- Remote impl2 = null;
- try {
- Remote impl = new MarshalAfterUnexport2();
- System.err.println(
- "created impl extending URO (with a UnicastServerRef2): " +
- impl);
+
+ System.err.println("\nRegression test for bug 4513223\n");
- Receiver stub = (Receiver) RemoteObject.toStub(impl);
- System.err.println("stub for impl: " + stub);
+ Remote impl2 = null;
+ try {
+ Remote impl = new MarshalAfterUnexport2();
+ System.err.println(
+ "created impl extending URO (with a UnicastServerRef2): " +
+ impl);
- UnicastRemoteObject.unexportObject(impl, true);
- System.err.println("unexported impl");
+ Receiver stub = (Receiver) RemoteObject.toStub(impl);
+ System.err.println("stub for impl: " + stub);
+
+ UnicastRemoteObject.unexportObject(impl, true);
+ System.err.println("unexported impl");
- impl2 = new MarshalAfterUnexport2();
- Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
+ impl2 = new MarshalAfterUnexport2();
+ Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
- System.err.println("marshalling unexported object:");
- MarshalledObject mobj = new MarshalledObject(impl);
+ System.err.println("marshalling unexported object:");
+ MarshalledObject mobj = new MarshalledObject(impl);
- System.err.println("passing unexported object via RMI-JRMP:");
- stub2.receive(stub);
+ System.err.println("passing unexported object via RMI-JRMP:");
+ stub2.receive(stub);
- System.err.println("TEST PASSED");
- } finally {
- if (impl2 != null) {
- try {
- UnicastRemoteObject.unexportObject(impl2, true);
- } catch (Throwable t) {
- }
- }
- }
+ System.err.println("TEST PASSED");
+ } finally {
+ if (impl2 != null) {
+ try {
+ UnicastRemoteObject.unexportObject(impl2, true);
+ } catch (Throwable t) {
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport2_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,37 +29,37 @@
implements Receiver, java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_receive_0;
-
+
static {
- try {
- $method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public MarshalAfterUnexport2_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of receive(Remote)
public void receive(java.rmi.Remote $param_Remote_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/marshalAfterUnexport/MarshalAfterUnexport_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,37 +29,37 @@
implements Receiver, java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_receive_0;
-
+
static {
- try {
- $method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public MarshalAfterUnexport_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of receive(Remote)
public void receive(java.rmi.Remote $param_Remote_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/Ping.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/Ping.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -26,4 +26,3 @@
public interface Ping extends Remote {
public void ping() throws RemoteException;
}
-
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -24,7 +24,7 @@
/* @test
* @bug 4331349
* @summary synopsis: unexporting doesn't guarantee that DGC will
- * let go of remote object
+ * let go of remote object
*
* @author Ann Wollrath
*
@@ -40,36 +40,36 @@
import java.rmi.registry.*;
public class UnexportLeak implements Ping {
-
+
private static int PORT = 2006;
public void ping() {
}
public static void main(String[] args) {
- try {
- System.err.println("\nRegression test for bug 4331349\n");
- LocateRegistry.createRegistry(PORT);
- Remote obj = new UnexportLeak();
- WeakReference wr = new WeakReference(obj);
- UnicastRemoteObject.exportObject(obj);
- LocateRegistry.getRegistry(PORT).rebind("UnexportLeak", obj);
- UnicastRemoteObject.unexportObject(obj, true);
- obj = null;
- flushRefs();
- if (wr.get() != null) {
- System.err.println("FAILED: unexported object not collected");
- throw new RuntimeException(
- "FAILED: unexported object not collected");
- } else {
- System.err.println("PASSED: unexported object collected");
- }
- } catch (RemoteException e) {
- System.err.println(
- "FAILED: RemoteException encountered: " + e.getMessage());
- e.printStackTrace();
- throw new RuntimeException("FAILED: RemoteException encountered");
- }
+ try {
+ System.err.println("\nRegression test for bug 4331349\n");
+ LocateRegistry.createRegistry(PORT);
+ Remote obj = new UnexportLeak();
+ WeakReference wr = new WeakReference(obj);
+ UnicastRemoteObject.exportObject(obj);
+ LocateRegistry.getRegistry(PORT).rebind("UnexportLeak", obj);
+ UnicastRemoteObject.unexportObject(obj, true);
+ obj = null;
+ flushRefs();
+ if (wr.get() != null) {
+ System.err.println("FAILED: unexported object not collected");
+ throw new RuntimeException(
+ "FAILED: unexported object not collected");
+ } else {
+ System.err.println("PASSED: unexported object collected");
+ }
+ } catch (RemoteException e) {
+ System.err.println(
+ "FAILED: RemoteException encountered: " + e.getMessage());
+ e.printStackTrace();
+ throw new RuntimeException("FAILED: RemoteException encountered");
+ }
}
/**
@@ -77,15 +77,13 @@
* will be cleared.
*/
private static void flushRefs() {
- java.util.Vector chain = new java.util.Vector();
- try {
- while (true) {
- int[] hungry = new int[65536];
- chain.addElement(hungry);
- }
- } catch (OutOfMemoryError e) {
- }
+ java.util.Vector chain = new java.util.Vector();
+ try {
+ while (true) {
+ int[] hungry = new int[65536];
+ chain.addElement(hungry);
+ }
+ } catch (OutOfMemoryError e) {
+ }
}
}
-
-
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,37 +29,37 @@
implements Ping
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_ping_0;
-
+
static {
- try {
- $method_ping_0 = Ping.class.getMethod("ping", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_ping_0 = Ping.class.getMethod("ping", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public UnexportLeak_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of ping()
public void ping()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/useDynamicProxies/UseDynamicProxies.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/useDynamicProxies/UseDynamicProxies.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -43,75 +43,75 @@
public Object passObject(Object obj) {
- return obj;
+ return obj;
}
public int passInt(int x) {
- return x;
+ return x;
}
public String passString(String string) {
- return string;
+ return string;
}
public static void main(String[] args) throws Exception {
-
- RemoteInterface server = null;
- RemoteInterface proxy = null;
-
- try {
- System.setProperty("java.rmi.server.ignoreStubClasses", args[0]);
- boolean ignoreStubClasses = Boolean.parseBoolean(args[0]);
+
+ RemoteInterface server = null;
+ RemoteInterface proxy = null;
+
+ try {
+ System.setProperty("java.rmi.server.ignoreStubClasses", args[0]);
+ boolean ignoreStubClasses = Boolean.parseBoolean(args[0]);
+
+ if (System.getSecurityManager() == null) {
+ System.setSecurityManager(new SecurityManager());
+ }
- if (System.getSecurityManager() == null) {
- System.setSecurityManager(new SecurityManager());
- }
+ System.err.println("export object");
+ server = new UseDynamicProxies();
+ proxy =
+ (RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
- System.err.println("export object");
- server = new UseDynamicProxies();
- proxy =
- (RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
+ System.err.println("proxy = " + proxy);
+ if (ignoreStubClasses) {
+ if (!Proxy.isProxyClass(proxy.getClass())) {
+ throw new RuntimeException(
+ "server proxy is not a dynamic proxy");
+ }
+ if (!(Proxy.getInvocationHandler(proxy) instanceof
+ RemoteObjectInvocationHandler))
+ {
+ throw new RuntimeException("invalid invocation handler");
+ }
- System.err.println("proxy = " + proxy);
- if (ignoreStubClasses) {
- if (!Proxy.isProxyClass(proxy.getClass())) {
- throw new RuntimeException(
- "server proxy is not a dynamic proxy");
- }
- if (!(Proxy.getInvocationHandler(proxy) instanceof
- RemoteObjectInvocationHandler))
- {
- throw new RuntimeException("invalid invocation handler");
- }
-
- } else if (!(proxy instanceof RemoteStub)) {
- throw new RuntimeException(
- "server proxy is not a RemoteStub");
- }
+ } else if (!(proxy instanceof RemoteStub)) {
+ throw new RuntimeException(
+ "server proxy is not a RemoteStub");
+ }
+
+ System.err.println("invoke methods");
+ Object obj = proxy.passObject(proxy);
+ if (!proxy.equals(obj)) {
+ throw new RuntimeException("returned proxy not equal");
+ }
- System.err.println("invoke methods");
- Object obj = proxy.passObject(proxy);
- if (!proxy.equals(obj)) {
- throw new RuntimeException("returned proxy not equal");
- }
-
- int x = proxy.passInt(53);
- if (x != 53) {
- throw new RuntimeException("returned int not equal");
- }
+ int x = proxy.passInt(53);
+ if (x != 53) {
+ throw new RuntimeException("returned int not equal");
+ }
- String string = proxy.passString("test");
- if (!string.equals("test")) {
- throw new RuntimeException("returned string not equal");
- }
-
- System.err.println("TEST PASSED");
-
- } finally {
- if (proxy != null) {
- UnicastRemoteObject.unexportObject(server, true);
- }
- }
+ String string = proxy.passString("test");
+ if (!string.equals("test")) {
+ throw new RuntimeException("returned string not equal");
+ }
+
+ System.err.println("TEST PASSED");
+
+ } finally {
+ if (proxy != null) {
+ UnicastRemoteObject.unexportObject(server, true);
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/useDynamicProxies/UseDynamicProxies_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/useDynamicProxies/UseDynamicProxies_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,74 +29,74 @@
implements RemoteInterface
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_passInt_0;
private static java.lang.reflect.Method $method_passObject_1;
private static java.lang.reflect.Method $method_passString_2;
-
+
static {
- try {
- $method_passInt_0 = RemoteInterface.class.getMethod("passInt", new java.lang.Class[] {int.class});
- $method_passObject_1 = RemoteInterface.class.getMethod("passObject", new java.lang.Class[] {java.lang.Object.class});
- $method_passString_2 = RemoteInterface.class.getMethod("passString", new java.lang.Class[] {java.lang.String.class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_passInt_0 = RemoteInterface.class.getMethod("passInt", new java.lang.Class[] {int.class});
+ $method_passObject_1 = RemoteInterface.class.getMethod("passObject", new java.lang.Class[] {java.lang.Object.class});
+ $method_passString_2 = RemoteInterface.class.getMethod("passString", new java.lang.Class[] {java.lang.String.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public UseDynamicProxies_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of passInt(int)
public int passInt(int $param_int_1)
- throws java.io.IOException
+ throws java.io.IOException
{
- try {
- Object $result = ref.invoke(this, $method_passInt_0, new java.lang.Object[] {new java.lang.Integer($param_int_1)}, 8655249712495061761L);
- return ((java.lang.Integer) $result).intValue();
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.io.IOException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_passInt_0, new java.lang.Object[] {new java.lang.Integer($param_int_1)}, 8655249712495061761L);
+ return ((java.lang.Integer) $result).intValue();
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.io.IOException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of passObject(Object)
public java.lang.Object passObject(java.lang.Object $param_Object_1)
- throws java.io.IOException
+ throws java.io.IOException
{
- try {
- Object $result = ref.invoke(this, $method_passObject_1, new java.lang.Object[] {$param_Object_1}, 3074202549763602823L);
- return ((java.lang.Object) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.io.IOException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_passObject_1, new java.lang.Object[] {$param_Object_1}, 3074202549763602823L);
+ return ((java.lang.Object) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.io.IOException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of passString(String)
public java.lang.String passString(java.lang.String $param_String_1)
- throws java.io.IOException
+ throws java.io.IOException
{
- try {
- Object $result = ref.invoke(this, $method_passString_2, new java.lang.Object[] {$param_String_1}, 6627880292288702000L);
- return ((java.lang.String) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.io.IOException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_passString_2, new java.lang.Object[] {$param_String_1}, 6627880292288702000L);
+ return ((java.lang.String) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.io.IOException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 4118600
+ * @bug 4118600
* @summary RMI UnmarshallException, interaction on stopping a thread.
*
* @bug 4177704
@@ -35,7 +35,7 @@
* @build CheckUnmarshall PoisonPill RuntimeExceptionParameter
* @build CheckUnmarshalOnStopThread
* @build CheckUnmarshalOnStopThread_Stub
- * @run main/othervm/timeout=480 CheckUnmarshalOnStopThread
+ * @run main/othervm/timeout=480 CheckUnmarshalOnStopThread
*/
import java.rmi.*;
@@ -44,7 +44,7 @@
import java.rmi.registry.*;
/**
- * Description for 4118600:
+ * Description for 4118600:
*
* If an rmi call thread is stopped while unmarshalling a return
* value), java.lang.ThreadDeath will be thrown during
@@ -77,8 +77,8 @@
* occur. This test is only written to track UnmarshalExceptions;
* success/failure does not depend on other types of problems.
*
- * Description for 4177704:
- *
+ * Description for 4177704:
+ *
* Similar situation as for 4177704 except that instead of just
* ensuring that RMI properly handles Errors, the second part of the
* test ensures that RMI deals with RuntimeExceptions correctly.
@@ -88,110 +88,110 @@
* parameters. An object that throws a RuntimeException in its
* writeObject method helps to carry out this part of the test.
*/
-public class CheckUnmarshalOnStopThread
- extends UnicastRemoteObject
- implements CheckUnmarshal
+public class CheckUnmarshalOnStopThread
+ extends UnicastRemoteObject
+ implements CheckUnmarshal
{
final static int RUNTIME_PILL = 1;
public static int typeToThrow = 0;
/*
- * remote object implementation
+ * remote object implementation
*/
CheckUnmarshalOnStopThread() throws RemoteException { }
public PoisonPill getPoisonPill() throws RemoteException {
- return new PoisonPill(new Integer(0));
+ return new PoisonPill(new Integer(0));
}
public Object ping() throws RemoteException {
- return (Object) new Integer(0);
+ return (Object) new Integer(0);
}
public void passRuntimeExceptionParameter(
- RuntimeExceptionParameter rep) throws RemoteException
+ RuntimeExceptionParameter rep) throws RemoteException
{
- // will never be called
+ // will never be called
}
public static void main(String [] args) {
- Object dummy = new Object();
- CheckUnmarshal cu = null;
- CheckUnmarshalOnStopThread cuonst = null;
+ Object dummy = new Object();
+ CheckUnmarshal cu = null;
+ CheckUnmarshalOnStopThread cuonst = null;
- System.err.println("\nregression test for bugs: " +
- "4118600 and 4177704\n");
+ System.err.println("\nregression test for bugs: " +
+ "4118600 and 4177704\n");
- try {
- cuonst = new CheckUnmarshalOnStopThread();
- cu = (CheckUnmarshal) UnicastRemoteObject.toStub(cuonst);
+ try {
+ cuonst = new CheckUnmarshalOnStopThread();
+ cu = (CheckUnmarshal) UnicastRemoteObject.toStub(cuonst);
- // make sure that RMI will free connections appropriately
- // under several situations:
+ // make sure that RMI will free connections appropriately
+ // under several situations:
- // when Errors are thrown during parameter unmarshalling
- System.err.println("testing to see if RMI will handle errors");
- ensureConnectionsAreFreed(cu, true);
+ // when Errors are thrown during parameter unmarshalling
+ System.err.println("testing to see if RMI will handle errors");
+ ensureConnectionsAreFreed(cu, true);
- // when RuntimeExceptions are thrown during parameter unmarshalling
- System.err.println("testing to see if RMI will handle " +
- "runtime exceptions");
- typeToThrow = RUNTIME_PILL;
- ensureConnectionsAreFreed(cu, true);
+ // when RuntimeExceptions are thrown during parameter unmarshalling
+ System.err.println("testing to see if RMI will handle " +
+ "runtime exceptions");
+ typeToThrow = RUNTIME_PILL;
+ ensureConnectionsAreFreed(cu, true);
- // when RuntimeExceptions are thrown during parameter marshalling
- System.err.println("testing to see if RMI will handle " +
- "runtime exceptions thrown during " +
- "parameter marshalling");
- ensureConnectionsAreFreed(cu, false);
+ // when RuntimeExceptions are thrown during parameter marshalling
+ System.err.println("testing to see if RMI will handle " +
+ "runtime exceptions thrown during " +
+ "parameter marshalling");
+ ensureConnectionsAreFreed(cu, false);
- System.err.println
- ("\nsuccess: CheckUnmarshalOnStopThread test passed ");
+ System.err.println
+ ("\nsuccess: CheckUnmarshalOnStopThread test passed ");
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- cu = null;
- deactivate(cuonst);
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ cu = null;
+ deactivate(cuonst);
+ }
}
-
- static void ensureConnectionsAreFreed(CheckUnmarshal cu, boolean getPill)
- throws Exception
+
+ static void ensureConnectionsAreFreed(CheckUnmarshal cu, boolean getPill)
+ throws Exception
{
- // invoke a remote call that will corrupt a call connection
- // that will not be freed (if the bug is not fixed)
+ // invoke a remote call that will corrupt a call connection
+ // that will not be freed (if the bug is not fixed)
- for (int i = 0 ; i < 250 ; i++) {
- try {
- Object test = cu.ping();
- if (getPill) {
- cu.getPoisonPill();
- } else {
- cu.passRuntimeExceptionParameter(
- new RuntimeExceptionParameter());
- }
- } catch (Error e) {
- // expect an Error from call unmarshalling, ignore it
- } catch (RuntimeException e) {
- // " RuntimeException "
- }
- }
+ for (int i = 0 ; i < 250 ; i++) {
+ try {
+ Object test = cu.ping();
+ if (getPill) {
+ cu.getPoisonPill();
+ } else {
+ cu.passRuntimeExceptionParameter(
+ new RuntimeExceptionParameter());
+ }
+ } catch (Error e) {
+ // expect an Error from call unmarshalling, ignore it
+ } catch (RuntimeException e) {
+ // " RuntimeException "
+ }
+ }
- System.err.println("remote calls passed, received no " +
- "unmarshal exceptions\n\n");
+ System.err.println("remote calls passed, received no " +
+ "unmarshal exceptions\n\n");
}
static void deactivate(RemoteServer r) {
- // make sure that the object goes away
- try {
- System.err.println("deactivating object.");
- UnicastRemoteObject.unexportObject(r, true);
- } catch (Exception e) {
- e.getMessage();
- e.printStackTrace();
- }
+ // make sure that the object goes away
+ try {
+ System.err.println("deactivating object.");
+ UnicastRemoteObject.unexportObject(r, true);
+ } catch (Exception e) {
+ e.getMessage();
+ e.printStackTrace();
+ }
}
}
--- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,138 +29,138 @@
implements CheckUnmarshal, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("PoisonPill getPoisonPill()"),
- new java.rmi.server.Operation("void passRuntimeExceptionParameter(RuntimeExceptionParameter)"),
- new java.rmi.server.Operation("java.lang.Object ping()")
+ new java.rmi.server.Operation("PoisonPill getPoisonPill()"),
+ new java.rmi.server.Operation("void passRuntimeExceptionParameter(RuntimeExceptionParameter)"),
+ new java.rmi.server.Operation("java.lang.Object ping()")
};
-
+
private static final long interfaceHash = -5923540687975666490L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_getPoisonPill_0;
private static java.lang.reflect.Method $method_passRuntimeExceptionParameter_1;
private static java.lang.reflect.Method $method_ping_2;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_getPoisonPill_0 = CheckUnmarshal.class.getMethod("getPoisonPill", new java.lang.Class[] {});
- $method_passRuntimeExceptionParameter_1 = CheckUnmarshal.class.getMethod("passRuntimeExceptionParameter", new java.lang.Class[] {RuntimeExceptionParameter.class});
- $method_ping_2 = CheckUnmarshal.class.getMethod("ping", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_getPoisonPill_0 = CheckUnmarshal.class.getMethod("getPoisonPill", new java.lang.Class[] {});
+ $method_passRuntimeExceptionParameter_1 = CheckUnmarshal.class.getMethod("passRuntimeExceptionParameter", new java.lang.Class[] {RuntimeExceptionParameter.class});
+ $method_ping_2 = CheckUnmarshal.class.getMethod("ping", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public CheckUnmarshalOnStopThread_Stub() {
- super();
+ super();
}
public CheckUnmarshalOnStopThread_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of getPoisonPill()
public PoisonPill getPoisonPill()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getPoisonPill_0, null, 5776441251039617360L);
- return ((PoisonPill) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- PoisonPill $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (PoisonPill) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getPoisonPill_0, null, 5776441251039617360L);
+ return ((PoisonPill) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ PoisonPill $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (PoisonPill) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of passRuntimeExceptionParameter(RuntimeExceptionParameter)
public void passRuntimeExceptionParameter(RuntimeExceptionParameter $param_RuntimeExceptionParameter_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_passRuntimeExceptionParameter_1, new java.lang.Object[] {$param_RuntimeExceptionParameter_1}, -4427599990679364365L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_RuntimeExceptionParameter_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_passRuntimeExceptionParameter_1, new java.lang.Object[] {$param_RuntimeExceptionParameter_1}, -4427599990679364365L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_RuntimeExceptionParameter_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of ping()
public java.lang.Object ping()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_ping_2, null, 7635508643486276040L);
- return ((java.lang.Object) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
- ref.invoke(call);
- java.lang.Object $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.Object) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_ping_2, null, 7635508643486276040L);
+ return ((java.lang.Object) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);
+ ref.invoke(call);
+ java.lang.Object $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.Object) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshall.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -20,7 +20,7 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
-
+
/**
*
*/
@@ -37,4 +37,3 @@
RuntimeExceptionParameter rep)
throws RemoteException;
}
-
--- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/PoisonPill.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/PoisonPill.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,7 +45,7 @@
throws IOException
{
if (CheckUnmarshalOnStopThread.typeToThrow !=
- CheckUnmarshalOnStopThread.RUNTIME_PILL) {
+ CheckUnmarshalOnStopThread.RUNTIME_PILL) {
throw new Error("Wrote a test object whos readObject " +
"method always throws an Error");
--- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/RuntimeExceptionParameter.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/RuntimeExceptionParameter.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,7 +38,6 @@
{
throw new RuntimeException("wrote a parameter whos writeObject " +
"method always throws a RuntimeException"
- );
+ );
}
}
-
--- a/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -54,69 +54,69 @@
private boolean unreferencedInvoked = false;
public void unreferenced() {
- System.err.println("unreferenced() method invoked");
- synchronized (lock) {
- unreferencedInvoked = true;
- lock.notify();
- }
+ System.err.println("unreferenced() method invoked");
+ synchronized (lock) {
+ unreferencedInvoked = true;
+ lock.notify();
+ }
}
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4164696\n");
+ System.err.println("\nRegression test for bug 4164696\n");
- /*
- * Set the interval that RMI will request for GC latency (before RMI
- * gets initialized and this property is read) to an unrealistically
- * small value, so that this test shouldn't have to wait too long.
- */
- System.setProperty("sun.rmi.dgc.client.gcInterval",
- String.valueOf(GC_INTERVAL));
+ /*
+ * Set the interval that RMI will request for GC latency (before RMI
+ * gets initialized and this property is read) to an unrealistically
+ * small value, so that this test shouldn't have to wait too long.
+ */
+ System.setProperty("sun.rmi.dgc.client.gcInterval",
+ String.valueOf(GC_INTERVAL));
- FiniteGCLatency obj = new FiniteGCLatency();
+ FiniteGCLatency obj = new FiniteGCLatency();
- try {
- UnicastRemoteObject.exportObject(obj);
- System.err.println("exported remote object");
+ try {
+ UnicastRemoteObject.exportObject(obj);
+ System.err.println("exported remote object");
- LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
- System.err.println("created registry");
+ LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
+ System.err.println("created registry");
- Registry registry = LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
- registry.bind(BINDING, obj);
- System.err.println("bound remote object in registry");
+ Registry registry = LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
+ registry.bind(BINDING, obj);
+ System.err.println("bound remote object in registry");
- synchronized (obj.lock) {
- registry.unbind(BINDING);
- System.err.println("unbound remote object from registry; " +
- "waiting for unreferenced() callback...");
- obj.lock.wait(TIMEOUT);
+ synchronized (obj.lock) {
+ registry.unbind(BINDING);
+ System.err.println("unbound remote object from registry; " +
+ "waiting for unreferenced() callback...");
+ obj.lock.wait(TIMEOUT);
- if (obj.unreferencedInvoked) {
- System.err.println("TEST PASSED: unreferenced() invoked");
- } else {
- throw new RuntimeException(
- "TEST FAILED: unrefereced() not invoked after " +
- ((double) TIMEOUT / 1000.0) + " seconds");
- }
- }
+ if (obj.unreferencedInvoked) {
+ System.err.println("TEST PASSED: unreferenced() invoked");
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unrefereced() not invoked after " +
+ ((double) TIMEOUT / 1000.0) + " seconds");
+ }
+ }
- } catch (Exception e) {
- if (e instanceof RuntimeException) {
- throw (RuntimeException) e;
- } else {
- throw new RuntimeException(
- "TEST FAILED: unexpected exception: " + e.toString());
- }
- } finally {
- /*
- * When all is said and done, try to unexport the remote object
- * so that the VM has a chance to exit.
- */
- try {
- UnicastRemoteObject.unexportObject(obj, true);
- } catch (RemoteException e) {
- }
- }
+ } catch (Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected exception: " + e.toString());
+ }
+ } finally {
+ /*
+ * When all is said and done, try to unexport the remote object
+ * so that the VM has a chance to exit.
+ */
+ try {
+ UnicastRemoteObject.unexportObject(obj, true);
+ } catch (RemoteException e) {
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,10 +29,10 @@
implements java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
// constructors
public FiniteGCLatency_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
}
--- a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -62,71 +62,71 @@
private boolean unreferencedInvoked = false;
public void unreferenced() {
- System.err.println("unreferenced() method invoked");
- synchronized (lock) {
- unreferencedInvoked = true;
- lock.notify();
- }
+ System.err.println("unreferenced() method invoked");
+ synchronized (lock) {
+ unreferencedInvoked = true;
+ lock.notify();
+ }
}
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4285878\n");
+ System.err.println("\nRegression test for bug 4285878\n");
- /*
- * Set the duration of leases granted to a very small value, so that
- * we can test if expirations are detected in a roughly comparable
- * time.
- */
- System.setProperty("java.rmi.dgc.leaseValue",
- String.valueOf(LEASE_VALUE));
+ /*
+ * Set the duration of leases granted to a very small value, so that
+ * we can test if expirations are detected in a roughly comparable
+ * time.
+ */
+ System.setProperty("java.rmi.dgc.leaseValue",
+ String.valueOf(LEASE_VALUE));
- LeaseCheckInterval obj = new LeaseCheckInterval();
+ LeaseCheckInterval obj = new LeaseCheckInterval();
- try {
- UnicastRemoteObject.exportObject(obj);
- System.err.println("exported remote object");
+ try {
+ UnicastRemoteObject.exportObject(obj);
+ System.err.println("exported remote object");
- Registry localRegistry =
- LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
- System.err.println("created local registry");
+ Registry localRegistry =
+ LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
+ System.err.println("created local registry");
- localRegistry.bind(BINDING, obj);
- System.err.println("bound remote object in local registry");
+ localRegistry.bind(BINDING, obj);
+ System.err.println("bound remote object in local registry");
- synchronized (obj.lock) {
- System.err.println("starting remote client VM...");
- (new JavaVM("SelfTerminator")).start();
+ synchronized (obj.lock) {
+ System.err.println("starting remote client VM...");
+ (new JavaVM("SelfTerminator")).start();
- System.err.println("waiting for unreferenced() callback...");
- obj.lock.wait(TIMEOUT);
+ System.err.println("waiting for unreferenced() callback...");
+ obj.lock.wait(TIMEOUT);
- if (obj.unreferencedInvoked) {
- System.err.println("TEST PASSED: " +
- "unreferenced() invoked in timely fashion");
- } else {
- throw new RuntimeException(
- "TEST FAILED: unreferenced() not invoked after " +
- ((double) TIMEOUT / 1000.0) + " seconds");
- }
- }
+ if (obj.unreferencedInvoked) {
+ System.err.println("TEST PASSED: " +
+ "unreferenced() invoked in timely fashion");
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unreferenced() not invoked after " +
+ ((double) TIMEOUT / 1000.0) + " seconds");
+ }
+ }
- } catch (Exception e) {
- if (e instanceof RuntimeException) {
- throw (RuntimeException) e;
- } else {
- throw new RuntimeException(
- "TEST FAILED: unexpected exception: " + e.toString());
- }
- } finally {
- /*
- * When all is said and done, try to unexport the remote object
- * so that the VM has a chance to exit.
- */
- try {
- UnicastRemoteObject.unexportObject(obj, true);
- } catch (RemoteException e) {
- }
- }
+ } catch (Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected exception: " + e.toString());
+ }
+ } finally {
+ /*
+ * When all is said and done, try to unexport the remote object
+ * so that the VM has a chance to exit.
+ */
+ try {
+ UnicastRemoteObject.unexportObject(obj, true);
+ } catch (RemoteException e) {
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,10 +29,10 @@
implements java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
// constructors
public LeaseCheckInterval_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
}
--- a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/SelfTerminator.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/SelfTerminator.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,13 +32,13 @@
public class SelfTerminator {
public static void main(String[] args) {
- try {
- Registry registry =
- LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
- Remote stub = registry.lookup(LeaseCheckInterval.BINDING);
- Runtime.getRuntime().halt(0);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ try {
+ Registry registry =
+ LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
+ Remote stub = registry.lookup(LeaseCheckInterval.BINDING);
+ Runtime.getRuntime().halt(0);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
--- a/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -51,72 +51,72 @@
private boolean unreferencedInvoked;
public void unreferenced() {
- System.err.println("unreferenced() method invoked");
- synchronized (lock) {
- unreferencedInvoked = true;
- lock.notify();
- }
+ System.err.println("unreferenced() method invoked");
+ synchronized (lock) {
+ unreferencedInvoked = true;
+ lock.notify();
+ }
}
public static void main(String[] args) {
- System.err.println(
- "\nTest to verify correction interaction of " +
- "MarshalledObject.get and DGC registration\n");
+ System.err.println(
+ "\nTest to verify correction interaction of " +
+ "MarshalledObject.get and DGC registration\n");
- /*
- * Set the interval that RMI will request for GC latency (before RMI
- * gets initialized and this property is read) to an unrealistically
- * small value, so that this test shouldn't have to wait too long.
- */
- System.setProperty("sun.rmi.dgc.client.gcInterval",
- String.valueOf(GC_INTERVAL));
+ /*
+ * Set the interval that RMI will request for GC latency (before RMI
+ * gets initialized and this property is read) to an unrealistically
+ * small value, so that this test shouldn't have to wait too long.
+ */
+ System.setProperty("sun.rmi.dgc.client.gcInterval",
+ String.valueOf(GC_INTERVAL));
- MarshalledObjectGet obj = new MarshalledObjectGet();
+ MarshalledObjectGet obj = new MarshalledObjectGet();
- try {
- Remote stub = UnicastRemoteObject.exportObject(obj);
- System.err.println("exported remote object");
+ try {
+ Remote stub = UnicastRemoteObject.exportObject(obj);
+ System.err.println("exported remote object");
- MarshalledObject mobj = new MarshalledObject(stub);
- Remote unmarshalledStub = (Remote) mobj.get();
- System.err.println("unmarshalled stub from marshalled object");
+ MarshalledObject mobj = new MarshalledObject(stub);
+ Remote unmarshalledStub = (Remote) mobj.get();
+ System.err.println("unmarshalled stub from marshalled object");
- synchronized (obj.lock) {
- obj.unreferencedInvoked = false;
+ synchronized (obj.lock) {
+ obj.unreferencedInvoked = false;
- unmarshalledStub = null;
- System.gc();
- System.err.println("cleared unmarshalled stub");
- System.err.println("waiting for unreferenced() callback " +
- "(SHOULD happen)...");
- obj.lock.wait(TIMEOUT);
+ unmarshalledStub = null;
+ System.gc();
+ System.err.println("cleared unmarshalled stub");
+ System.err.println("waiting for unreferenced() callback " +
+ "(SHOULD happen)...");
+ obj.lock.wait(TIMEOUT);
- if (obj.unreferencedInvoked) {
- // TEST PASSED
- } else {
- throw new RuntimeException(
- "TEST FAILED: unrefereced() not invoked after " +
- ((double) TIMEOUT / 1000.0) + " seconds");
- }
- }
+ if (obj.unreferencedInvoked) {
+ // TEST PASSED
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unrefereced() not invoked after " +
+ ((double) TIMEOUT / 1000.0) + " seconds");
+ }
+ }
- System.err.println("TEST PASSED");
+ System.err.println("TEST PASSED");
- } catch (Exception e) {
- if (e instanceof RuntimeException) {
- throw (RuntimeException) e;
- } else {
- throw new RuntimeException(
- "TEST FAILED: unexpected exception: " + e.toString());
- }
- } finally {
- if (obj != null) {
- try {
- UnicastRemoteObject.unexportObject(obj, true);
- } catch (Exception e) {
- }
- }
- }
+ } catch (Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected exception: " + e.toString());
+ }
+ } finally {
+ if (obj != null) {
+ try {
+ UnicastRemoteObject.unexportObject(obj, true);
+ } catch (Exception e) {
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/marshalledObjectGet/MarshalledObjectGet_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,10 +29,10 @@
implements java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
// constructors
public MarshalledObjectGet_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
}
--- a/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,12 +32,12 @@
*
* @bug 4214123
* @summary Unreferenced.unreferenced(...) threads should run in the nonSystem group.
- * To complete the fix for, 4182104, RMI unreferenced threads should also
+ * To complete the fix for, 4182104, RMI unreferenced threads should also
* run in the nonSystem so that they do not need permissions to modify the
* system thread group.
*
* @author Laird Dornin
- *
+ *
* @library ../../../testlibrary
* @build UnreferencedContext
* @build UnreferencedContext_Stub
@@ -60,127 +60,127 @@
private ClassLoader unreferencedContext;
public void run() {
- System.err.println("unreferenced method created thread succesfully");
+ System.err.println("unreferenced method created thread succesfully");
}
public void unreferenced() {
- // turn on security to ensure that the action below will not
- // require extra permissions
- System.setSecurityManager(new java.rmi.RMISecurityManager());
+ // turn on security to ensure that the action below will not
+ // require extra permissions
+ System.setSecurityManager(new java.rmi.RMISecurityManager());
- // exercise functionality prohibited by 4214123
- (new Thread(this)).start();
+ // exercise functionality prohibited by 4214123
+ (new Thread(this)).start();
- System.err.println("unreferenced() method invoked");
- synchronized (lock) {
- unreferencedInvoked = true;
- unreferencedContext =
- Thread.currentThread().getContextClassLoader();
- lock.notify();
- }
+ System.err.println("unreferenced() method invoked");
+ synchronized (lock) {
+ unreferencedInvoked = true;
+ unreferencedContext =
+ Thread.currentThread().getContextClassLoader();
+ lock.notify();
+ }
}
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4171278\n");
+ System.err.println("\nRegression test for bug 4171278\n");
- /*
- * Set the interval that RMI will request for GC latency (before RMI
- * gets initialized and this property is read) to an unrealistically
- * small value, so that this test shouldn't have to wait too long.
- */
- System.setProperty("sun.rmi.dgc.client.gcInterval",
- String.valueOf(GC_INTERVAL));
+ /*
+ * Set the interval that RMI will request for GC latency (before RMI
+ * gets initialized and this property is read) to an unrealistically
+ * small value, so that this test shouldn't have to wait too long.
+ */
+ System.setProperty("sun.rmi.dgc.client.gcInterval",
+ String.valueOf(GC_INTERVAL));
- UnreferencedContext obj = new UnreferencedContext();
+ UnreferencedContext obj = new UnreferencedContext();
- try {
- /*
- * This little trick is necessary to make sure that the RMI server
- * threads for objects created on the default port get created
- * before we set our special context class loader, so that they
- * don't *accidentally* inherit it when making the unreferenced()
- * callback.
- */
- UnicastRemoteObject.exportObject(obj);
- UnicastRemoteObject.unexportObject(obj, true);
+ try {
+ /*
+ * This little trick is necessary to make sure that the RMI server
+ * threads for objects created on the default port get created
+ * before we set our special context class loader, so that they
+ * don't *accidentally* inherit it when making the unreferenced()
+ * callback.
+ */
+ UnicastRemoteObject.exportObject(obj);
+ UnicastRemoteObject.unexportObject(obj, true);
- /*
- * Now create special context class loader before exporting the
- * remote object for real, so that it should be set when the
- * object's unreferenced() method is called.
- */
- ClassLoader intendedContext = new URLClassLoader(new URL[0]);
- Thread.currentThread().setContextClassLoader(intendedContext);
- System.err.println(
- "created and set intended context class loader: " +
- intendedContext);
+ /*
+ * Now create special context class loader before exporting the
+ * remote object for real, so that it should be set when the
+ * object's unreferenced() method is called.
+ */
+ ClassLoader intendedContext = new URLClassLoader(new URL[0]);
+ Thread.currentThread().setContextClassLoader(intendedContext);
+ System.err.println(
+ "created and set intended context class loader: " +
+ intendedContext);
- UnicastRemoteObject.exportObject(obj);
- System.err.println("exported remote object");
+ UnicastRemoteObject.exportObject(obj);
+ System.err.println("exported remote object");
- LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
- System.err.println("created registry");
+ LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
+ System.err.println("created registry");
- Registry registry = LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
- registry.bind(BINDING, obj);
- System.err.println("bound remote object in registry");
+ Registry registry = LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
+ registry.bind(BINDING, obj);
+ System.err.println("bound remote object in registry");
- synchronized (obj.lock) {
- registry.unbind(BINDING);
- System.err.println("unbound remote object from registry; " +
- "waiting for unreferenced() callback...");
- /*
- * This incantation seems sufficient to work around the
- * ramifications of 4164696, so that this test will actually
- * prove something useful about 1.2Beta4 or 1.2FCS before
- * 4171278 was fixed.
- */
- for (int i = 0; i < 10; i++) {
- System.gc();
- obj.lock.wait(TIMEOUT / 10);
- if (obj.unreferencedInvoked) {
- break;
- }
- }
+ synchronized (obj.lock) {
+ registry.unbind(BINDING);
+ System.err.println("unbound remote object from registry; " +
+ "waiting for unreferenced() callback...");
+ /*
+ * This incantation seems sufficient to work around the
+ * ramifications of 4164696, so that this test will actually
+ * prove something useful about 1.2Beta4 or 1.2FCS before
+ * 4171278 was fixed.
+ */
+ for (int i = 0; i < 10; i++) {
+ System.gc();
+ obj.lock.wait(TIMEOUT / 10);
+ if (obj.unreferencedInvoked) {
+ break;
+ }
+ }
- if (obj.unreferencedInvoked) {
- System.err.println(
- "invoked with context class loader: " +
- obj.unreferencedContext);
+ if (obj.unreferencedInvoked) {
+ System.err.println(
+ "invoked with context class loader: " +
+ obj.unreferencedContext);
- if (obj.unreferencedContext == intendedContext) {
- System.err.println(
- "TEST PASSED: unreferenced() invoked" +
- " with intended context class loader");
- } else {
- throw new RuntimeException(
- "TEST FAILED: unreferenced() invoked" +
- " with incorrect context class loader");
- }
- } else {
- throw new RuntimeException(
- "TEST FAILED: unreferenced() not invoked after " +
- ((double) TIMEOUT / 1000.0) + " seconds or unreferenced failed to create a thread");
- }
- }
+ if (obj.unreferencedContext == intendedContext) {
+ System.err.println(
+ "TEST PASSED: unreferenced() invoked" +
+ " with intended context class loader");
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unreferenced() invoked" +
+ " with incorrect context class loader");
+ }
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unreferenced() not invoked after " +
+ ((double) TIMEOUT / 1000.0) + " seconds or unreferenced failed to create a thread");
+ }
+ }
- } catch (Exception e) {
- if (e instanceof RuntimeException) {
- throw (RuntimeException) e;
- } else {
- throw new RuntimeException(
- "TEST FAILED: unexpected exception: " + e.toString());
- }
- } finally {
- /*
- * When all is said and done, try to unexport the remote object
- * so that the VM has a chance to exit.
- */
- try {
- UnicastRemoteObject.unexportObject(obj, true);
- } catch (RemoteException e) {
- }
- }
+ } catch (Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected exception: " + e.toString());
+ }
+ } finally {
+ /*
+ * When all is said and done, try to unexport the remote object
+ * so that the VM has a chance to exit.
+ */
+ try {
+ UnicastRemoteObject.unexportObject(obj, true);
+ } catch (RemoteException e) {
+ }
+ }
}
}
--- a/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,10 +29,10 @@
implements java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
// constructors
public UnreferencedContext_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
}
--- a/jdk/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/acceptLoop/CloseServerSocketOnTermination.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -51,75 +51,75 @@
private static long TIMEOUT = 5000;
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4924577\n");
+ System.err.println("\nRegression test for bug 4924577\n");
- RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
- public boolean failure(Exception e) { return false; }
- });
+ RMISocketFactory.setFailureHandler(new RMIFailureHandler() {
+ public boolean failure(Exception e) { return false; }
+ });
- tryWith(new IOException());
- tryWith(new NullPointerException());
- tryWith(new OutOfMemoryError());
- tryWith(new NoClassDefFoundError());
- tryWith(new InternalError());
- tryWith(new Throwable());
+ tryWith(new IOException());
+ tryWith(new NullPointerException());
+ tryWith(new OutOfMemoryError());
+ tryWith(new NoClassDefFoundError());
+ tryWith(new InternalError());
+ tryWith(new Throwable());
- System.err.println("TEST PASSED");
+ System.err.println("TEST PASSED");
}
private static void tryWith(Throwable t) throws Exception {
- Remote impl = new Remote() { };
- try {
- CountDownLatch latch = new CountDownLatch(1);
- UnicastRemoteObject.exportObject(impl, 0, null, new SSF(t, latch));
- if (!latch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
- throw new Error("server socket not closed");
- }
- } finally {
- UnicastRemoteObject.unexportObject(impl, true);
- }
+ Remote impl = new Remote() { };
+ try {
+ CountDownLatch latch = new CountDownLatch(1);
+ UnicastRemoteObject.exportObject(impl, 0, null, new SSF(t, latch));
+ if (!latch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
+ throw new Error("server socket not closed");
+ }
+ } finally {
+ UnicastRemoteObject.unexportObject(impl, true);
+ }
}
private static class SSF implements RMIServerSocketFactory {
- private final Throwable acceptFailure;
- private final CountDownLatch closedLatch;
- SSF(Throwable acceptFailure, CountDownLatch closedLatch) {
- this.acceptFailure = acceptFailure;
- this.closedLatch = closedLatch;
- }
- public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port) {
- private int acceptInvocations = 0;
- public synchronized Socket accept() throws IOException {
- if (acceptInvocations++ == 0) {
- throwException(acceptFailure);
- }
- return super.accept();
- }
- public void close() throws IOException {
- closedLatch.countDown();
- super.close();
- }
- };
- }
+ private final Throwable acceptFailure;
+ private final CountDownLatch closedLatch;
+ SSF(Throwable acceptFailure, CountDownLatch closedLatch) {
+ this.acceptFailure = acceptFailure;
+ this.closedLatch = closedLatch;
+ }
+ public ServerSocket createServerSocket(int port) throws IOException {
+ return new ServerSocket(port) {
+ private int acceptInvocations = 0;
+ public synchronized Socket accept() throws IOException {
+ if (acceptInvocations++ == 0) {
+ throwException(acceptFailure);
+ }
+ return super.accept();
+ }
+ public void close() throws IOException {
+ closedLatch.countDown();
+ super.close();
+ }
+ };
+ }
- // hack to throw an arbitrary (possibly checked) Throwable
- private static void throwException(Throwable t) {
- try {
- toThrow.set(t);
- Thrower.class.newInstance();
- } catch (IllegalAccessException e) {
- throw new AssertionError();
- } catch (InstantiationException e) {
- throw new AssertionError();
- } finally {
- toThrow.remove();
- }
- }
- private static ThreadLocal<Throwable> toThrow =
- new ThreadLocal<Throwable>();
- private static class Thrower {
- Thrower() throws Throwable { throw toThrow.get(); }
- }
+ // hack to throw an arbitrary (possibly checked) Throwable
+ private static void throwException(Throwable t) {
+ try {
+ toThrow.set(t);
+ Thrower.class.newInstance();
+ } catch (IllegalAccessException e) {
+ throw new AssertionError();
+ } catch (InstantiationException e) {
+ throw new AssertionError();
+ } finally {
+ toThrow.remove();
+ }
+ }
+ private static ThreadLocal<Throwable> toThrow =
+ new ThreadLocal<Throwable>();
+ private static class Thrower {
+ Thrower() throws Throwable { throw toThrow.get(); }
+ }
}
}
--- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,15 +34,15 @@
*
* @library ../../testlibrary
* @build CheckFQDN CheckFQDNClient CheckFQDN_Stub TellServerName
- * @run main/othervm/timeout=120 CheckFQDN
+ * @run main/othervm/timeout=120 CheckFQDN
*/
-/**
+/**
* Get the hostname used by rmi using different rmi properities:
*
* if set java.rmi.server.hostname, hostname should equal this
* property.
- *
+ *
* if set java.rmi.server.useLocalHostname, hostname must contain a '.'
*
* if set no properties hostname should be an ipaddress.
@@ -58,118 +58,118 @@
import java.io.*;
/**
- * Export a remote object through which the exec'ed client vm can
+ * Export a remote object through which the exec'ed client vm can
* inform the main test what its host name is.
*/
-public class CheckFQDN extends UnicastRemoteObject
+public class CheckFQDN extends UnicastRemoteObject
implements TellServerName {
-
+
static String propertyBeingTested = null;
static String propertyBeingTestedValue = null;
public static void main(String args[]) {
- Object dummy = new Object();
- CheckFQDN checkFQDN = null;
- try {
- checkFQDN = new CheckFQDN();
+ Object dummy = new Object();
+ CheckFQDN checkFQDN = null;
+ try {
+ checkFQDN = new CheckFQDN();
+
+ System.err.println
+ ("\nRegression test for bug/rfe 4115683\n");
+
+ Registry registry = java.rmi.registry.LocateRegistry.
+ createRegistry(TestLibrary.REGISTRY_PORT);
+ registry.bind("CheckFQDN", checkFQDN);
- System.err.println
- ("\nRegression test for bug/rfe 4115683\n");
-
- Registry registry = java.rmi.registry.LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT);
- registry.bind("CheckFQDN", checkFQDN);
-
- /* test the host name scheme in different environments.*/
- testProperty("java.rmi.server.useLocalHostname", "true", "");
- testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");
- testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest",
- " -Djava.rmi.server.useLocalHostname=true ");
- testProperty("", "", "");
+ /* test the host name scheme in different environments.*/
+ testProperty("java.rmi.server.useLocalHostname", "true", "");
+ testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");
+ testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest",
+ " -Djava.rmi.server.useLocalHostname=true ");
+ testProperty("", "", "");
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- if (checkFQDN != null) {
- TestLibrary.unexport(checkFQDN);
- }
- }
- System.err.println("\nTest for bug/ref 4115683 passed.\n");
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ if (checkFQDN != null) {
+ TestLibrary.unexport(checkFQDN);
+ }
+ }
+ System.err.println("\nTest for bug/ref 4115683 passed.\n");
}
- /**
+ /**
* Spawn a vm and feed it a property which sets the client's rmi
* hostname.
*/
- public static void testProperty(String property,
- String propertyValue,
- String extraProp)
+ public static void testProperty(String property,
+ String propertyValue,
+ String extraProp)
{
- try {
- String propOption = "";
- String equal = "";
- if (!property.equals("")) {
- propOption = " -D";
- equal = "=";
- }
+ try {
+ String propOption = "";
+ String equal = "";
+ if (!property.equals("")) {
+ propOption = " -D";
+ equal = "=";
+ }
- JavaVM jvm = new JavaVM("CheckFQDNClient",
- propOption + property +
- equal +
- propertyValue + extraProp,
- "");
-
- propertyBeingTested=property;
- propertyBeingTestedValue=propertyValue;
+ JavaVM jvm = new JavaVM("CheckFQDNClient",
+ propOption + property +
+ equal +
+ propertyValue + extraProp,
+ "");
+
+ propertyBeingTested=property;
+ propertyBeingTestedValue=propertyValue;
- // create a client to tell checkFQDN what its rmi name is. */
- jvm.start();
+ // create a client to tell checkFQDN what its rmi name is. */
+ jvm.start();
- if (jvm.getVM().waitFor() != 0 ) {
- TestLibrary.bomb("Test failed, error in client.");
- }
-
- } catch (Exception e) {
- TestLibrary.bomb(e);
- }
+ if (jvm.getVM().waitFor() != 0 ) {
+ TestLibrary.bomb("Test failed, error in client.");
+ }
+
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ }
}
CheckFQDN() throws RemoteException { }
- /**
- * Remote method to allow client vm to tell the main test what its
+ /**
+ * Remote method to allow client vm to tell the main test what its
* host name is .
*/
- public void tellServerName(String serverName)
- throws RemoteException {
+ public void tellServerName(String serverName)
+ throws RemoteException {
- if (propertyBeingTested.equals("java.rmi.server.hostname")) {
- if ( !propertyBeingTestedValue.equals(serverName)) {
- TestLibrary.bomb(propertyBeingTested +
- ":\n Client rmi server name does " +
- "not equal the one specified " +
- "by java.rmi.server.hostname: " +
- serverName +" != " +
- propertyBeingTestedValue);
- }
+ if (propertyBeingTested.equals("java.rmi.server.hostname")) {
+ if ( !propertyBeingTestedValue.equals(serverName)) {
+ TestLibrary.bomb(propertyBeingTested +
+ ":\n Client rmi server name does " +
+ "not equal the one specified " +
+ "by java.rmi.server.hostname: " +
+ serverName +" != " +
+ propertyBeingTestedValue);
+ }
- /** use local host name, must contain a '.' */
- } else if (propertyBeingTested.equals
- ("java.rmi.server.useLocalHostname")) {
- if (serverName.indexOf('.') < 0) {
- TestLibrary.bomb(propertyBeingTested +
- ":\nThe client servername contains no '.'");
- }
- } else {
- // no propety set, must be ip address
- if ((serverName.indexOf('.') < 0) ||
- (!Character.isDigit(serverName.charAt(0)))) {
- TestLibrary.bomb("Default name scheme:\n"+
- " The client servername contains no '.'"+
- "or is not an ip address");
- }
- }
- System.err.println("Servername used: " + serverName);
+ /** use local host name, must contain a '.' */
+ } else if (propertyBeingTested.equals
+ ("java.rmi.server.useLocalHostname")) {
+ if (serverName.indexOf('.') < 0) {
+ TestLibrary.bomb(propertyBeingTested +
+ ":\nThe client servername contains no '.'");
+ }
+ } else {
+ // no propety set, must be ip address
+ if ((serverName.indexOf('.') < 0) ||
+ (!Character.isDigit(serverName.charAt(0)))) {
+ TestLibrary.bomb("Default name scheme:\n"+
+ " The client servername contains no '.'"+
+ "or is not an ip address");
+ }
+ }
+ System.err.println("Servername used: " + serverName);
}
}
--- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDNClient.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDNClient.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,7 @@
*
*
* Client that will run in its own vm and tell the main CheckFQDN test
- * program what its rmi host name is, name obtained from TCPEndpoint.
+ * program what its rmi host name is, name obtained from TCPEndpoint.
*/
import java.rmi.*;
@@ -40,72 +40,72 @@
public class CheckFQDNClient implements Runnable {
final static int NAME_SERVICE_TIME_OUT = 12000;
-
+
static TCPEndpoint ep = null;
- /**
+ /**
* main, lookup remote object and tell it the rmi
* hostname of this client vm.
*/
public static void main (String args[]) {
-
- // start a registry and register a copy of this in it.
- TellServerName tell;
- String hostname = null;
-
- try {
- hostname = retrieveServerName();
- System.err.println("Client host name: " +
- hostname);
+
+ // start a registry and register a copy of this in it.
+ TellServerName tell;
+ String hostname = null;
+
+ try {
+ hostname = retrieveServerName();
+ System.err.println("Client host name: " +
+ hostname);
- tell = (TellServerName) Naming.lookup("rmi://:" +
- TestLibrary.REGISTRY_PORT
- + "/CheckFQDN");
- tell.tellServerName(hostname);
- System.err.println("client has exited");
+ tell = (TellServerName) Naming.lookup("rmi://:" +
+ TestLibrary.REGISTRY_PORT
+ + "/CheckFQDN");
+ tell.tellServerName(hostname);
+ System.err.println("client has exited");
- } catch (Exception e ) {
- throw new RuntimeException(e.getMessage());
- }
- System.exit(0);
+ } catch (Exception e ) {
+ throw new RuntimeException(e.getMessage());
+ }
+ System.exit(0);
}
-
+
/* what is the rmi hostname for this vm? */
public static String retrieveServerName () {
- try {
+ try {
+
+ CheckFQDNClient chk = new CheckFQDNClient();
+
+ synchronized(chk) {
+ (new Thread (chk)).start();
+ chk.wait(NAME_SERVICE_TIME_OUT);
+ }
- CheckFQDNClient chk = new CheckFQDNClient();
-
- synchronized(chk) {
- (new Thread (chk)).start();
- chk.wait(NAME_SERVICE_TIME_OUT);
- }
-
- if (ep == null) {
- throw new RuntimeException
- ("Timeout getting the local endpoint.");
- }
-
- // this is the name used by rmi for the client hostname
- return ep.getHost();
-
- }catch (Exception e){
- throw new RuntimeException (e.getMessage());
- }
+ if (ep == null) {
+ throw new RuntimeException
+ ("Timeout getting the local endpoint.");
+ }
+
+ // this is the name used by rmi for the client hostname
+ return ep.getHost();
+
+ }catch (Exception e){
+ throw new RuntimeException (e.getMessage());
+ }
}
/* thread to geth the rmi hostname of this vm */
public void run () {
- try {
- synchronized(this) {
- ep = TCPEndpoint.getLocalEndpoint(0);
- }
- } catch (Exception e) {
- throw new RuntimeException();
- } finally {
- synchronized(this) {
- this.notify();
- }
- }
+ try {
+ synchronized(this) {
+ ep = TCPEndpoint.getLocalEndpoint(0);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException();
+ } finally {
+ synchronized(this) {
+ this.notify();
+ }
+ }
}
}
--- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,66 +29,66 @@
implements TellServerName, java.rmi.Remote
{
private static java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void tellServerName(java.lang.String)")
+ new java.rmi.server.Operation("void tellServerName(java.lang.String)")
};
-
+
private static final long interfaceHash = 4509625981775855367L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_tellServerName_0;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_tellServerName_0 = TellServerName.class.getMethod("tellServerName", new java.lang.Class[] {java.lang.String.class});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_tellServerName_0 = TellServerName.class.getMethod("tellServerName", new java.lang.Class[] {java.lang.String.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public CheckFQDN_Stub() {
- super();
+ super();
}
public CheckFQDN_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of tellServerName(String)
public void tellServerName(java.lang.String $param_String_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_tellServerName_0, new java.lang.Object[] {$param_String_1}, -5180633734615762942L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_tellServerName_0, new java.lang.Object[] {$param_String_1}, -5180633734615762942L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/transport/checkFQDN/TellServerName.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkFQDN/TellServerName.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -24,7 +24,7 @@
import java.rmi.*;
import java.rmi.server.*;
-/**
+/**
* interface to get server name from an execed vm
* I am using an execed vm because I need to set
* rmi's hostname serveral times with different properties.
@@ -32,4 +32,3 @@
interface TellServerName extends Remote {
void tellServerName (String serverName) throws RemoteException;
}
-
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -44,7 +44,7 @@
* the remote object. Each vmid needs a seperate LeaseInfo object in
* the object table target DGCImpl.leaseTable. If the leak is fixed,
* the leaseTable field will contain no objects. We use reflection to
- * find the number of objects contained in this table.
+ * find the number of objects contained in this table.
*/
import java.rmi.*;
@@ -57,13 +57,13 @@
import java.rmi.registry.*;
public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
-
+
public CheckLeaseLeak() throws RemoteException { }
public void ping () throws RemoteException { }
/**
* Id to fake the DGC_ID, so we can later get a reference to the
- * DGCImpl in the object table.
+ * DGCImpl in the object table.
*/
private final static int DGC_ID = 2;
@@ -71,148 +71,148 @@
private final static int numberPingCalls = 0;
private final static int CHECK_INTERVAL = 400;
private final static int LEASE_VALUE = 20;
-
+
public static void main (String[] args) {
- CheckLeaseLeak leakServer = null;
- int numLeft =0;
+ CheckLeaseLeak leakServer = null;
+ int numLeft =0;
- /*
- * we want DGC to collect leases *quickly*
- * decrease the lease check interval
- */
- TestLibrary.setInteger("sun.rmi.dgc.checkInterval",
- CHECK_INTERVAL);
- TestLibrary.setInteger("java.rmi.dgc.leaseValue",
- LEASE_VALUE);
+ /*
+ * we want DGC to collect leases *quickly*
+ * decrease the lease check interval
+ */
+ TestLibrary.setInteger("sun.rmi.dgc.checkInterval",
+ CHECK_INTERVAL);
+ TestLibrary.setInteger("java.rmi.dgc.leaseValue",
+ LEASE_VALUE);
- try {
- Registry registry =
- java.rmi.registry.LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT);
+ try {
+ Registry registry =
+ java.rmi.registry.LocateRegistry.
+ createRegistry(TestLibrary.REGISTRY_PORT);
- leakServer = new CheckLeaseLeak();
- registry.rebind("/LeaseLeak", leakServer);
+ leakServer = new CheckLeaseLeak();
+ registry.rebind("/LeaseLeak", leakServer);
+
+ /* create a bunch of clients in a *different* vm */
+ for (int i = 0 ; i < ITERATIONS ; i ++ ) {
+ System.err.println("Created client: " + i);
- /* create a bunch of clients in a *different* vm */
- for (int i = 0 ; i < ITERATIONS ; i ++ ) {
- System.err.println("Created client: " + i);
-
- JavaVM jvm = new JavaVM("LeaseLeakClient",
- " -Djava.security.policy=" +
- TestParams.defaultPolicy, "");
- jvm.start();
+ JavaVM jvm = new JavaVM("LeaseLeakClient",
+ " -Djava.security.policy=" +
+ TestParams.defaultPolicy, "");
+ jvm.start();
+
+ if (jvm.getVM().waitFor() == 1 ) {
+ TestLibrary.bomb("Client process failed");
+ }
+ }
+ numLeft = getDGCLeaseTableSize();
+ Thread.sleep(3000);
- if (jvm.getVM().waitFor() == 1 ) {
- TestLibrary.bomb("Client process failed");
- }
- }
- numLeft = getDGCLeaseTableSize();
- Thread.sleep(3000);
-
- } catch(Exception e) {
- TestLibrary.bomb("CheckLeaseLeak Error: ", e);
- } finally {
- if (leakServer != null) {
- TestLibrary.unexport(leakServer);
- leakServer = null;
- }
- }
+ } catch(Exception e) {
+ TestLibrary.bomb("CheckLeaseLeak Error: ", e);
+ } finally {
+ if (leakServer != null) {
+ TestLibrary.unexport(leakServer);
+ leakServer = null;
+ }
+ }
- /* numLeft should be 2 - if 11 there is a problem. */
- if (numLeft > 2) {
- TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+
- numLeft);
- } else {
- System.err.println("Check leaseInfo leak passed with " +
- numLeft
- + " object(s) in the leaseTable");
- }
+ /* numLeft should be 2 - if 11 there is a problem. */
+ if (numLeft > 2) {
+ TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+
+ numLeft);
+ } else {
+ System.err.println("Check leaseInfo leak passed with " +
+ numLeft
+ + " object(s) in the leaseTable");
+ }
}
/**
* Obtain a reference to the main DGCImpl via reflection. Extract
* the DGCImpl using the ObjectTable and the well known ID of the
- * DGCImpl.
+ * DGCImpl.
*/
private static int getDGCLeaseTableSize () {
- int numLeaseInfosLeft = 0;
+ int numLeaseInfosLeft = 0;
+
+ /**
+ * Will eventually be set to point at the leaseTable inside
+ * DGCImpl.
+ */
+ Map leaseTable = null;
+ final Remote[] dgcImpl = new Remote[1];
+ Field f;
+
+ try {
+ f = (Field) java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedExceptionAction() {
+ public Object run() throws Exception {
- /**
- * Will eventually be set to point at the leaseTable inside
- * DGCImpl.
- */
- Map leaseTable = null;
- final Remote[] dgcImpl = new Remote[1];
- Field f;
+ ObjID dgcID = new ObjID(DGC_ID);
- try {
- f = (Field) java.security.AccessController.doPrivileged
- (new java.security.PrivilegedExceptionAction() {
- public Object run() throws Exception {
+ /*
+ * Construct an ObjectEndpoint containing DGC's
+ * ObjID.
+ */
+ Class oeClass =
+ Class.forName("sun.rmi.transport.ObjectEndpoint");
+ Class[] constrParams =
+ new Class[]{ ObjID.class, Transport.class };
+ Constructor oeConstructor =
+ oeClass.getDeclaredConstructor(constrParams);
+ oeConstructor.setAccessible(true);
+ Object oe =
+ oeConstructor.newInstance(
+ new Object[]{ dgcID, null });
- ObjID dgcID = new ObjID(DGC_ID);
-
- /*
- * Construct an ObjectEndpoint containing DGC's
- * ObjID.
- */
- Class oeClass =
- Class.forName("sun.rmi.transport.ObjectEndpoint");
- Class[] constrParams =
- new Class[]{ ObjID.class, Transport.class };
- Constructor oeConstructor =
- oeClass.getDeclaredConstructor(constrParams);
- oeConstructor.setAccessible(true);
- Object oe =
- oeConstructor.newInstance(
- new Object[]{ dgcID, null });
-
- /*
- * Get Target that contains DGCImpl in ObjectTable
- */
- Class objTableClass =
- Class.forName("sun.rmi.transport.ObjectTable");
- Class getTargetParams[] = new Class[] { oeClass };
- Method objTableGetTarget =
- objTableClass.getDeclaredMethod("getTarget",
- getTargetParams);
- objTableGetTarget.setAccessible(true);
- Target dgcTarget = (Target)
- objTableGetTarget.invoke(null, new Object[]{ oe });
-
- /* get the DGCImpl from its Target */
- Method targetGetImpl =
- dgcTarget.getClass().getDeclaredMethod
- ("getImpl", null);
- targetGetImpl.setAccessible(true);
- dgcImpl[0] =
- (Remote) targetGetImpl.invoke(dgcTarget, null);
+ /*
+ * Get Target that contains DGCImpl in ObjectTable
+ */
+ Class objTableClass =
+ Class.forName("sun.rmi.transport.ObjectTable");
+ Class getTargetParams[] = new Class[] { oeClass };
+ Method objTableGetTarget =
+ objTableClass.getDeclaredMethod("getTarget",
+ getTargetParams);
+ objTableGetTarget.setAccessible(true);
+ Target dgcTarget = (Target)
+ objTableGetTarget.invoke(null, new Object[]{ oe });
+
+ /* get the DGCImpl from its Target */
+ Method targetGetImpl =
+ dgcTarget.getClass().getDeclaredMethod
+ ("getImpl", null);
+ targetGetImpl.setAccessible(true);
+ dgcImpl[0] =
+ (Remote) targetGetImpl.invoke(dgcTarget, null);
- /* Get the lease table from the DGCImpl. */
- Field reflectedLeaseTable =
- dgcImpl[0].getClass().getDeclaredField
- ("leaseTable");
- reflectedLeaseTable.setAccessible(true);
+ /* Get the lease table from the DGCImpl. */
+ Field reflectedLeaseTable =
+ dgcImpl[0].getClass().getDeclaredField
+ ("leaseTable");
+ reflectedLeaseTable.setAccessible(true);
- return reflectedLeaseTable;
- }
- });
+ return reflectedLeaseTable;
+ }
+ });
- /**
- * This is the leaseTable that will fill up with LeaseInfo
- * objects if the LeaseInfo memory leak is not fixed.
- */
- leaseTable = (Map) f.get(dgcImpl[0]);
+ /**
+ * This is the leaseTable that will fill up with LeaseInfo
+ * objects if the LeaseInfo memory leak is not fixed.
+ */
+ leaseTable = (Map) f.get(dgcImpl[0]);
- numLeaseInfosLeft = leaseTable.size();
+ numLeaseInfosLeft = leaseTable.size();
- } catch(Exception e) {
- if (e instanceof java.security.PrivilegedActionException)
- e = ((java.security.PrivilegedActionException) e).
- getException();
- TestLibrary.bomb(e);
- }
+ } catch(Exception e) {
+ if (e instanceof java.security.PrivilegedActionException)
+ e = ((java.security.PrivilegedActionException) e).
+ getException();
+ TestLibrary.bomb(e);
+ }
- return numLeaseInfosLeft;
+ return numLeaseInfosLeft;
}
}
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,60 +29,60 @@
implements LeaseLeak, java.rmi.Remote
{
private static java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void ping()")
+ new java.rmi.server.Operation("void ping()")
};
-
+
private static final long interfaceHash = -8409781791984809394L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_ping_0;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_ping_0 = LeaseLeak.class.getMethod("ping", new java.lang.Class[] {});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_ping_0 = LeaseLeak.class.getMethod("ping", new java.lang.Class[] {});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public CheckLeaseLeak_Stub() {
- super();
+ super();
}
public CheckLeaseLeak_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of ping()
public void ping()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/LeaseLeak.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/LeaseLeak.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/LeaseLeakClient.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/LeaseLeakClient.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,24 +25,24 @@
import java.rmi.server.*;
import java.rmi.registry.*;
-public class LeaseLeakClient {
+public class LeaseLeakClient {
public static void main(String args[]) {
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
-
- try {
- LeaseLeak leaseLeak = null;
-
- // put a reference on a remote object.
- Registry registry =
- java.rmi.registry.LocateRegistry.getRegistry(
- TestLibrary.REGISTRY_PORT);
- leaseLeak = (LeaseLeak) registry.lookup("/LeaseLeak");
- leaseLeak.ping();
-
- } catch(Exception e) {
- System.err.println("LeaseLeakClient Error: "+e.getMessage());
- e.printStackTrace();
- throw new RuntimeException(e.getMessage());
- }
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+
+ try {
+ LeaseLeak leaseLeak = null;
+
+ // put a reference on a remote object.
+ Registry registry =
+ java.rmi.registry.LocateRegistry.getRegistry(
+ TestLibrary.REGISTRY_PORT);
+ leaseLeak = (LeaseLeak) registry.lookup("/LeaseLeak");
+ leaseLeak.ping();
+
+ } catch(Exception e) {
+ System.err.println("LeaseLeakClient Error: "+e.getMessage());
+ e.printStackTrace();
+ throw new RuntimeException(e.getMessage());
+ }
}
}
--- a/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -50,80 +50,80 @@
private CloseServerSocket() { }
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4457683\n");
+ System.err.println("\nRegression test for bug 4457683\n");
- verifyPortFree(PORT);
- Registry registry = LocateRegistry.createRegistry(PORT);
- System.err.println("- exported registry: " + registry);
- verifyPortInUse(PORT);
- UnicastRemoteObject.unexportObject(registry, true);
- System.err.println("- unexported registry");
- Thread.sleep(1); // work around BindException (bug?)
- verifyPortFree(PORT);
+ verifyPortFree(PORT);
+ Registry registry = LocateRegistry.createRegistry(PORT);
+ System.err.println("- exported registry: " + registry);
+ verifyPortInUse(PORT);
+ UnicastRemoteObject.unexportObject(registry, true);
+ System.err.println("- unexported registry");
+ Thread.sleep(1); // work around BindException (bug?)
+ verifyPortFree(PORT);
- /*
- * The follow portion of this test is disabled temporarily
- * because 4457683 was partially backed out because of
- * 6269166; for now, only server sockets originally opened for
- * exports on non-anonymous ports will be closed when all of
- * the corresponding remote objects have been exported. A
- * separate bug will be filed to represent the remainder of
- * 4457683 for anonymous-port exports.
- */
+ /*
+ * The follow portion of this test is disabled temporarily
+ * because 4457683 was partially backed out because of
+ * 6269166; for now, only server sockets originally opened for
+ * exports on non-anonymous ports will be closed when all of
+ * the corresponding remote objects have been exported. A
+ * separate bug will be filed to represent the remainder of
+ * 4457683 for anonymous-port exports.
+ */
-// SSF ssf = new SSF();
-// Remote impl = new CloseServerSocket();
-// Remote stub = UnicastRemoteObject.exportObject(impl, 0, null, ssf);
-// System.err.println("- exported object: " + stub);
-// UnicastRemoteObject.unexportObject(impl, true);
-// System.err.println("- unexported object");
-// synchronized (ssf) {
-// if (!ssf.serverSocketClosed) {
-// throw new RuntimeException("TEST FAILED: " +
-// "server socket not closed");
-// }
-// }
+// SSF ssf = new SSF();
+// Remote impl = new CloseServerSocket();
+// Remote stub = UnicastRemoteObject.exportObject(impl, 0, null, ssf);
+// System.err.println("- exported object: " + stub);
+// UnicastRemoteObject.unexportObject(impl, true);
+// System.err.println("- unexported object");
+// synchronized (ssf) {
+// if (!ssf.serverSocketClosed) {
+// throw new RuntimeException("TEST FAILED: " +
+// "server socket not closed");
+// }
+// }
- System.err.println("TEST PASSED");
+ System.err.println("TEST PASSED");
}
private static void verifyPortFree(int port) throws IOException {
- ServerSocket ss = new ServerSocket(PORT);
- ss.close();
- System.err.println("- port " + port + " is free");
+ ServerSocket ss = new ServerSocket(PORT);
+ ss.close();
+ System.err.println("- port " + port + " is free");
}
private static void verifyPortInUse(int port) throws IOException {
- try {
- verifyPortFree(port);
- } catch (BindException e) {
- System.err.println("- port " + port + " is in use");
- return;
- }
+ try {
+ verifyPortFree(port);
+ } catch (BindException e) {
+ System.err.println("- port " + port + " is in use");
+ return;
+ }
}
private static class SSF implements RMIServerSocketFactory {
- boolean serverSocketClosed = false;
- SSF() { };
+ boolean serverSocketClosed = false;
+ SSF() { };
- public ServerSocket createServerSocket(int port) throws IOException {
- return new SS(port);
- }
+ public ServerSocket createServerSocket(int port) throws IOException {
+ return new SS(port);
+ }
- private class SS extends ServerSocket {
- SS(int port) throws IOException {
- super(port);
- System.err.println("- created server socket: " + this);
- };
+ private class SS extends ServerSocket {
+ SS(int port) throws IOException {
+ super(port);
+ System.err.println("- created server socket: " + this);
+ };
- public void close() throws IOException {
- synchronized (SSF.this) {
- serverSocketClosed = true;
- SSF.this.notifyAll();
- }
- System.err.println("- closing server socket: " + this);
- super.close();
- }
- }
+ public void close() throws IOException {
+ synchronized (SSF.this) {
+ serverSocketClosed = true;
+ SSF.this.notifyAll();
+ }
+ System.err.println("- closing server socket: " + this);
+ super.close();
+ }
+ }
}
}
--- a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -46,7 +46,7 @@
* was attempting to lock.
*
* This test causes the above conditions to occur and waits to see if
- * a given set of remote calls finishes "quickly enough."
+ * a given set of remote calls finishes "quickly enough."
*/
import java.rmi.*;
@@ -60,98 +60,98 @@
static DGCDeadLock test = new DGCDeadLock();
static {
- System.setProperty("sun.rmi.transport.cleanInterval", "50");
+ System.setProperty("sun.rmi.transport.cleanInterval", "50");
}
static public void main(String[] args) {
- JavaVM testImplVM = null;
-
- System.err.println("\nregression test for 4118056\n");
- TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
+ JavaVM testImplVM = null;
+
+ System.err.println("\nregression test for 4118056\n");
+ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
try {
- String options = " -Djava.security.policy=" +
- TestParams.defaultPolicy +
- " -Djava.rmi.dgc.leaseValue=500000" +
- " -Dsun.rmi.dgc.checkInterval=" +
- (HOLD_TARGET_TIME - 5000) + "";
+ String options = " -Djava.security.policy=" +
+ TestParams.defaultPolicy +
+ " -Djava.rmi.dgc.leaseValue=500000" +
+ " -Dsun.rmi.dgc.checkInterval=" +
+ (HOLD_TARGET_TIME - 5000) + "";
- testImplVM = new JavaVM("TestImpl", options, "");
- testImplVM.start();
+ testImplVM = new JavaVM("TestImpl", options, "");
+ testImplVM.start();
- synchronized (test) {
- Thread t = new Thread(test);
- t.setDaemon(true);
- t.start();
+ synchronized (test) {
+ Thread t = new Thread(test);
+ t.setDaemon(true);
+ t.start();
- // wait for the remote calls to take place
- test.wait(TEST_FAIL_TIME);
- }
+ // wait for the remote calls to take place
+ test.wait(TEST_FAIL_TIME);
+ }
- if (!finished) {
- TestLibrary.bomb("Test failed, had exception or exercise" +
- " routines took too long to " +
- "execute");
- }
- System.err.println("Test passed, exercises " +
- "finished in time.");
+ if (!finished) {
+ TestLibrary.bomb("Test failed, had exception or exercise" +
+ " routines took too long to " +
+ "execute");
+ }
+ System.err.println("Test passed, exercises " +
+ "finished in time.");
} catch (Exception e) {
- testImplVM = null;
- TestLibrary.bomb("test failed", e);
+ testImplVM = null;
+ TestLibrary.bomb("test failed", e);
}
}
public void run() {
- try {
- String echo = null;
+ try {
+ String echo = null;
- // give the test remote object time to initialize.
- Thread.currentThread().sleep(8000);
+ // give the test remote object time to initialize.
+ Thread.currentThread().sleep(8000);
- // create a test client
- Test foo = (Test) Naming.lookup("rmi://:" +
- TestLibrary.REGISTRY_PORT +
- "/Foo");
- echo = foo.echo("Hello world");
- System.err.println("Test object created.");
+ // create a test client
+ Test foo = (Test) Naming.lookup("rmi://:" +
+ TestLibrary.REGISTRY_PORT +
+ "/Foo");
+ echo = foo.echo("Hello world");
+ System.err.println("Test object created.");
- /* give TestImpl time to lock the target in the
- * object table and any dirtys finish.
- */
- Thread.currentThread().sleep(5000);
+ /* give TestImpl time to lock the target in the
+ * object table and any dirtys finish.
+ */
+ Thread.currentThread().sleep(5000);
- //unreference "Foo"
- foo = null;
+ //unreference "Foo"
+ foo = null;
+
+ //garbage collect and finalize foo
+ Runtime.getRuntime().gc();
+ Runtime.getRuntime().runFinalization();
- //garbage collect and finalize foo
- Runtime.getRuntime().gc();
- Runtime.getRuntime().runFinalization();
-
- //import "Bar"
- Test bar = (Test) Naming.lookup("rmi://:" +
- TestLibrary.REGISTRY_PORT +
- "/Bar");
-
- /* infinite loop to show the liveness of Client,
- * if we have deadlock remote call will not return
- */
- try {
- for (int i = 0; i < 500; i++) {
- echo = bar.echo("Remote call" + i);
- Thread.sleep(10);
- }
+ //import "Bar"
+ Test bar = (Test) Naming.lookup("rmi://:" +
+ TestLibrary.REGISTRY_PORT +
+ "/Bar");
- // flag exercises finished
- finished = true;
+ /* infinite loop to show the liveness of Client,
+ * if we have deadlock remote call will not return
+ */
+ try {
+ for (int i = 0; i < 500; i++) {
+ echo = bar.echo("Remote call" + i);
+ Thread.sleep(10);
+ }
- } catch (RemoteException e) {
- }
-
- } catch (Exception e) {
- TestLibrary.bomb("test failed", e);
- } finally {
- }
+ // flag exercises finished
+ finished = true;
+
+ } catch (RemoteException e) {
+ }
+
+ } catch (Exception e) {
+ TestLibrary.bomb("test failed", e);
+ } finally {
+ }
}
}
--- a/jdk/test/java/rmi/transport/dgcDeadLock/Test.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/Test.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/jdk/test/java/rmi/transport/dgcDeadLock/TestImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/TestImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,7 +34,7 @@
import java.rmi.registry.*;
import java.rmi.server.*;
-public class TestImpl extends UnicastRemoteObject
+public class TestImpl extends UnicastRemoteObject
implements Test {
static Thread locker = null;
@@ -46,197 +46,197 @@
public String echo(String msg) throws RemoteException {
- if (locker == null) {
- // hold the target if not already held
- locker = lockTargetExpireLeases(foo, DGCDeadLock.HOLD_TARGET_TIME);
- }
+ if (locker == null) {
+ // hold the target if not already held
+ locker = lockTargetExpireLeases(foo, DGCDeadLock.HOLD_TARGET_TIME);
+ }
return "Message received: " + msg;
}
static public void main(String[] args) {
- Registry registry = null;
+ Registry registry = null;
try {
- registry = java.rmi.registry.LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT);
+ registry = java.rmi.registry.LocateRegistry.
+ createRegistry(TestLibrary.REGISTRY_PORT);
- //export "Foo"
- foo = new TestImpl();
- Naming.rebind("rmi://:" +
- TestLibrary.REGISTRY_PORT
- + "/Foo", foo);
+ //export "Foo"
+ foo = new TestImpl();
+ Naming.rebind("rmi://:" +
+ TestLibrary.REGISTRY_PORT
+ + "/Foo", foo);
- try {
- //export "Bar" after leases have been expired.
- bar = new TestImpl();
- Naming.rebind("rmi://localhost:" +
- TestLibrary.REGISTRY_PORT
- + "/Bar", bar);
- } catch (Exception e) {
- throw new RemoteException(e.getMessage());
- }
- Thread.sleep(DGCDeadLock.TEST_FAIL_TIME);
- System.err.println("object vm exiting...");
- System.exit(0);
+ try {
+ //export "Bar" after leases have been expired.
+ bar = new TestImpl();
+ Naming.rebind("rmi://localhost:" +
+ TestLibrary.REGISTRY_PORT
+ + "/Bar", bar);
+ } catch (Exception e) {
+ throw new RemoteException(e.getMessage());
+ }
+ Thread.sleep(DGCDeadLock.TEST_FAIL_TIME);
+ System.err.println("object vm exiting...");
+ System.exit(0);
} catch (Exception e) {
- System.err.println(e.getMessage());
- e.printStackTrace();
+ System.err.println(e.getMessage());
+ e.printStackTrace();
} finally {
- TestLibrary.unexport(registry);
- registry = null;
- }
+ TestLibrary.unexport(registry);
+ registry = null;
+ }
}
static Thread lockTargetExpireLeases(Remote toLock, int timeOut) {
- Thread t = new Thread((Runnable) new TargetLocker(toLock, timeOut));
- t.start();
- return t;
+ Thread t = new Thread((Runnable) new TargetLocker(toLock, timeOut));
+ t.start();
+ return t;
}
static class TargetLocker implements Runnable {
- Remote toLock = null;
- int timeOut = 0;
+ Remote toLock = null;
+ int timeOut = 0;
- TargetLocker(Remote toLock, int timeOut) {
- this.toLock = toLock;
- this.timeOut = timeOut;
- }
+ TargetLocker(Remote toLock, int timeOut) {
+ this.toLock = toLock;
+ this.timeOut = timeOut;
+ }
- public void run() {
- try {
- // give dgc dirty calls time to finish.
- Thread.currentThread().sleep(4000);
+ public void run() {
+ try {
+ // give dgc dirty calls time to finish.
+ Thread.currentThread().sleep(4000);
- java.security.AccessController.
- doPrivileged(new LockTargetCheckLeases(toLock,
- timeOut));
+ java.security.AccessController.
+ doPrivileged(new LockTargetCheckLeases(toLock,
+ timeOut));
- } catch (Exception e) {
- System.err.println(e.getMessage());
- e.printStackTrace();
- System.exit(1);
- }
- }
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
}
- static class LockTargetCheckLeases
- implements java.security.PrivilegedAction {
+ static class LockTargetCheckLeases
+ implements java.security.PrivilegedAction {
+
+ Remote toLock = null;
+ int timeOut = 0;
- Remote toLock = null;
- int timeOut = 0;
+ LockTargetCheckLeases(Remote toLock, int timeOut) {
+ this.toLock = toLock;
+ this.timeOut = timeOut;
+ }
- LockTargetCheckLeases(Remote toLock, int timeOut) {
- this.toLock = toLock;
- this.timeOut = timeOut;
- }
+ public Object run() {
+ try {
+
+ Class args[] = new Class[1];
+
+ Class objTableClass = Class.forName
+ ("sun.rmi.transport.ObjectTable");
- public Object run() {
- try {
-
- Class args[] = new Class[1];
-
- Class objTableClass = Class.forName
- ("sun.rmi.transport.ObjectTable");
-
- /* get the Target that corresponds to toLock from the
- * ObjectTable
- */
- args[0] = Class.forName("java.rmi.Remote");
- Method objTableGetTarget =
- objTableClass.getDeclaredMethod("getTarget", args );
- objTableGetTarget.setAccessible(true);
-
- Target lockTarget =
- ((Target) objTableGetTarget.invoke
- (null , new Object [] {toLock} ));
-
- // make sure the lease on this object has expired.
- expireLeases(lockTarget);
-
- // stop other threads from using the target for toLock.
- synchronized (lockTarget) {
- System.err.println("Locked the relevant target, sleeping " +
- timeOut/1000 + " seconds");
- Thread.currentThread().sleep(timeOut);
- System.err.println("Target unlocked");
- }
+ /* get the Target that corresponds to toLock from the
+ * ObjectTable
+ */
+ args[0] = Class.forName("java.rmi.Remote");
+ Method objTableGetTarget =
+ objTableClass.getDeclaredMethod("getTarget", args );
+ objTableGetTarget.setAccessible(true);
+
+ Target lockTarget =
+ ((Target) objTableGetTarget.invoke
+ (null , new Object [] {toLock} ));
+
+ // make sure the lease on this object has expired.
+ expireLeases(lockTarget);
- } catch (Exception e) {
- System.err.println(e.getMessage());
- e.printStackTrace();
- System.exit(1);
- }
- return null;
- }
+ // stop other threads from using the target for toLock.
+ synchronized (lockTarget) {
+ System.err.println("Locked the relevant target, sleeping " +
+ timeOut/1000 + " seconds");
+ Thread.currentThread().sleep(timeOut);
+ System.err.println("Target unlocked");
+ }
+
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ System.exit(1);
+ }
+ return null;
+ }
}
/* leases have long values, so no dirty calls which would lock out
* a clean call, but the leases need to expire anyway, so we do it
- * explicitly.
+ * explicitly.
*/
static void expireLeases(Target t) throws Exception {
- final Target target = t;
+ final Target target = t;
+
+ java.security.AccessController.doPrivileged(
- java.security.AccessController.doPrivileged(
+ // put this into another class?
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ try {
+
+ Class DGCClass = Class.forName("sun.rmi.transport.DGCImpl");
+ Method getDGCImpl =
+ DGCClass.getDeclaredMethod("getDGCImpl", null );
+ getDGCImpl.setAccessible(true);
- // put this into another class?
- new java.security.PrivilegedAction() {
- public Object run() {
- try {
+ // make sure the lease on this object has expired.
+ DGC dgcImpl = ((DGC) getDGCImpl.invoke(null, null));
+
+ /* Get the lease table from the DGCImpl. */
+ Field reflectedLeaseTable =
+ dgcImpl.getClass().getDeclaredField("leaseTable");
+ reflectedLeaseTable.setAccessible(true);
+
+ Map leaseTable = (Map) reflectedLeaseTable.get(dgcImpl);
+
+ // dont really need this synchronization...
+ synchronized (leaseTable) {
+ Iterator en = leaseTable.values().iterator();
+ while (en.hasNext()) {
+ Object info = en.next();
- Class DGCClass = Class.forName("sun.rmi.transport.DGCImpl");
- Method getDGCImpl =
- DGCClass.getDeclaredMethod("getDGCImpl", null );
- getDGCImpl.setAccessible(true);
-
- // make sure the lease on this object has expired.
- DGC dgcImpl = ((DGC) getDGCImpl.invoke(null, null));
-
- /* Get the lease table from the DGCImpl. */
- Field reflectedLeaseTable =
- dgcImpl.getClass().getDeclaredField("leaseTable");
- reflectedLeaseTable.setAccessible(true);
-
- Map leaseTable = (Map) reflectedLeaseTable.get(dgcImpl);
-
- // dont really need this synchronization...
- synchronized (leaseTable) {
- Iterator en = leaseTable.values().iterator();
- while (en.hasNext()) {
- Object info = en.next();
-
- /* Get the notifySet in the leaseInfo object. */
- Field notifySetField =
- info.getClass().getDeclaredField("notifySet");
- notifySetField.setAccessible(true);
- HashSet notifySet = (HashSet) notifySetField.get(info);
-
- Iterator iter = notifySet.iterator();
- while (iter.hasNext()) {
- Target notified = (Target) iter.next();
-
- if (notified == target) {
-
- /* Get and set the expiration field from the info object. */
- Field expirationField = info.getClass().
- getDeclaredField("expiration");
- expirationField.setAccessible(true);
- expirationField.setLong(info, 0);
- }
- }
- }
- }
- } catch (Exception e) {
- System.err.println(e.getMessage());
- e.printStackTrace();
- System.exit(1);
- }
- // no interesting return value for this privileged action
- return null;
- }
- });
+ /* Get the notifySet in the leaseInfo object. */
+ Field notifySetField =
+ info.getClass().getDeclaredField("notifySet");
+ notifySetField.setAccessible(true);
+ HashSet notifySet = (HashSet) notifySetField.get(info);
+
+ Iterator iter = notifySet.iterator();
+ while (iter.hasNext()) {
+ Target notified = (Target) iter.next();
+
+ if (notified == target) {
+
+ /* Get and set the expiration field from the info object. */
+ Field expirationField = info.getClass().
+ getDeclaredField("expiration");
+ expirationField.setAccessible(true);
+ expirationField.setLong(info, 0);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ System.exit(1);
+ }
+ // no interesting return value for this privileged action
+ return null;
+ }
+ });
}
}
--- a/jdk/test/java/rmi/transport/dgcDeadLock/TestImpl_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/TestImpl_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,78 +29,78 @@
implements Test, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("java.lang.String echo(java.lang.String)")
+ new java.rmi.server.Operation("java.lang.String echo(java.lang.String)")
};
-
+
private static final long interfaceHash = 8975711176019764637L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_echo_0;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_echo_0 = Test.class.getMethod("echo", new java.lang.Class[] {java.lang.String.class});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_echo_0 = Test.class.getMethod("echo", new java.lang.Class[] {java.lang.String.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public TestImpl_Stub() {
- super();
+ super();
}
public TestImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of echo(String)
public java.lang.String echo(java.lang.String $param_String_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_echo_0, new java.lang.Object[] {$param_String_1}, 5525131960618330777L);
- return ((java.lang.String) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_String_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.lang.String $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_echo_0, new java.lang.Object[] {$param_String_1}, 5525131960618330777L);
+ return ((java.lang.String) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_String_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ java.lang.String $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.lang.String) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -49,85 +49,85 @@
public static void main(String[] args) throws Exception {
- /*
- * Listen on port...
- */
- ServerSocket serverSocket = new ServerSocket(PORT);
+ /*
+ * Listen on port...
+ */
+ ServerSocket serverSocket = new ServerSocket(PORT);
- /*
- * (Attempt RMI call to port in separate thread.)
- */
- Registry registry = LocateRegistry.getRegistry(PORT);
- Connector connector = new Connector(registry);
- Thread t = new Thread(connector);
- t.setDaemon(true);
- t.start();
+ /*
+ * (Attempt RMI call to port in separate thread.)
+ */
+ Registry registry = LocateRegistry.getRegistry(PORT);
+ Connector connector = new Connector(registry);
+ Thread t = new Thread(connector);
+ t.setDaemon(true);
+ t.start();
- /*
- * ...accept one connection from port and send non-JRMP data.
- */
- Socket socket = serverSocket.accept();
- socket.getOutputStream().write("Wrong way".getBytes());
- socket.close();
+ /*
+ * ...accept one connection from port and send non-JRMP data.
+ */
+ Socket socket = serverSocket.accept();
+ socket.getOutputStream().write("Wrong way".getBytes());
+ socket.close();
- /*
- * Wait for call attempt to finish, and analyze result.
- */
- t.join(TIMEOUT);
- synchronized (connector) {
- if (connector.success) {
- throw new RuntimeException(
- "TEST FAILED: remote call succeeded??");
- }
- if (connector.exception == null) {
- throw new RuntimeException(
- "TEST FAILED: remote call did not time out");
- } else {
- System.err.println("remote call failed with exception:");
- connector.exception.printStackTrace();
- System.err.println();
+ /*
+ * Wait for call attempt to finish, and analyze result.
+ */
+ t.join(TIMEOUT);
+ synchronized (connector) {
+ if (connector.success) {
+ throw new RuntimeException(
+ "TEST FAILED: remote call succeeded??");
+ }
+ if (connector.exception == null) {
+ throw new RuntimeException(
+ "TEST FAILED: remote call did not time out");
+ } else {
+ System.err.println("remote call failed with exception:");
+ connector.exception.printStackTrace();
+ System.err.println();
- if (connector.exception instanceof MarshalException) {
- System.err.println(
- "TEST FAILED: MarshalException thrown, expecting " +
- "java.rmi.ConnectException or ConnectIOException");
- } else if (connector.exception instanceof ConnectException ||
- connector.exception instanceof ConnectIOException)
- {
- System.err.println(
- "TEST PASSED: java.rmi.ConnectException or " +
- "ConnectIOException thrown");
- } else {
- throw new RuntimeException(
- "TEST FAILED: unexpected Exception thrown",
- connector.exception);
- }
- }
- }
+ if (connector.exception instanceof MarshalException) {
+ System.err.println(
+ "TEST FAILED: MarshalException thrown, expecting " +
+ "java.rmi.ConnectException or ConnectIOException");
+ } else if (connector.exception instanceof ConnectException ||
+ connector.exception instanceof ConnectIOException)
+ {
+ System.err.println(
+ "TEST PASSED: java.rmi.ConnectException or " +
+ "ConnectIOException thrown");
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected Exception thrown",
+ connector.exception);
+ }
+ }
+ }
}
private static class Connector implements Runnable {
- private final Registry registry;
+ private final Registry registry;
- boolean success = false;
+ boolean success = false;
Exception exception = null;
- Connector(Registry registry) {
- this.registry = registry;
- }
+ Connector(Registry registry) {
+ this.registry = registry;
+ }
- public void run() {
- try {
- registry.lookup("Dale Cooper");
- synchronized (this) {
- success = true;
- }
- } catch (Exception e) {
- synchronized (this) {
- exception = e;
- }
- }
- }
+ public void run() {
+ try {
+ registry.lookup("Dale Cooper");
+ synchronized (this) {
+ success = true;
+ }
+ } catch (Exception e) {
+ synchronized (this) {
+ exception = e;
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -51,81 +51,81 @@
public static void main(String[] args) throws Exception {
- System.setProperty("sun.rmi.transport.tcp.handshakeTimeout",
- String.valueOf(TIMEOUT / 2));
+ System.setProperty("sun.rmi.transport.tcp.handshakeTimeout",
+ String.valueOf(TIMEOUT / 2));
- /*
- * Listen on port, but never process connections made to it.
- */
- ServerSocket serverSocket = new ServerSocket(PORT);
+ /*
+ * Listen on port, but never process connections made to it.
+ */
+ ServerSocket serverSocket = new ServerSocket(PORT);
- /*
- * Attempt RMI call to port in separate thread.
- */
- Registry registry = LocateRegistry.getRegistry(PORT);
- Connector connector = new Connector(registry);
- Thread t = new Thread(connector);
- t.setDaemon(true);
- t.start();
+ /*
+ * Attempt RMI call to port in separate thread.
+ */
+ Registry registry = LocateRegistry.getRegistry(PORT);
+ Connector connector = new Connector(registry);
+ Thread t = new Thread(connector);
+ t.setDaemon(true);
+ t.start();
- /*
- * Wait for call attempt to finished, and analyze result.
- */
- t.join(TIMEOUT);
- synchronized (connector) {
- if (connector.success) {
- throw new RuntimeException(
- "TEST FAILED: remote call succeeded??");
- }
- if (connector.exception == null) {
- throw new RuntimeException(
- "TEST FAILED: remote call did not time out");
- } else {
- System.err.println("remote call failed with exception:");
- connector.exception.printStackTrace();
- System.err.println();
+ /*
+ * Wait for call attempt to finished, and analyze result.
+ */
+ t.join(TIMEOUT);
+ synchronized (connector) {
+ if (connector.success) {
+ throw new RuntimeException(
+ "TEST FAILED: remote call succeeded??");
+ }
+ if (connector.exception == null) {
+ throw new RuntimeException(
+ "TEST FAILED: remote call did not time out");
+ } else {
+ System.err.println("remote call failed with exception:");
+ connector.exception.printStackTrace();
+ System.err.println();
- if (connector.exception instanceof MarshalException) {
- System.err.println(
- "TEST FAILED: MarshalException thrown, expecting " +
- "java.rmi.ConnectException or ConnectIOException");
- } else if (connector.exception instanceof ConnectException ||
- connector.exception instanceof ConnectIOException)
- {
- System.err.println(
- "TEST PASSED: java.rmi.ConnectException or " +
- "ConnectIOException thrown");
- } else {
- throw new RuntimeException(
- "TEST FAILED: unexpected Exception thrown",
- connector.exception);
- }
- }
- }
+ if (connector.exception instanceof MarshalException) {
+ System.err.println(
+ "TEST FAILED: MarshalException thrown, expecting " +
+ "java.rmi.ConnectException or ConnectIOException");
+ } else if (connector.exception instanceof ConnectException ||
+ connector.exception instanceof ConnectIOException)
+ {
+ System.err.println(
+ "TEST PASSED: java.rmi.ConnectException or " +
+ "ConnectIOException thrown");
+ } else {
+ throw new RuntimeException(
+ "TEST FAILED: unexpected Exception thrown",
+ connector.exception);
+ }
+ }
+ }
}
private static class Connector implements Runnable {
- private final Registry registry;
+ private final Registry registry;
- boolean success = false;
+ boolean success = false;
Exception exception = null;
- Connector(Registry registry) {
- this.registry = registry;
- }
+ Connector(Registry registry) {
+ this.registry = registry;
+ }
- public void run() {
- try {
- registry.lookup("Dale Cooper");
- synchronized (this) {
- success = true;
- }
- } catch (Exception e) {
- synchronized (this) {
- exception = e;
- }
- }
- }
+ public void run() {
+ try {
+ registry.lookup("Dale Cooper");
+ synchronized (this) {
+ success = true;
+ }
+ } catch (Exception e) {
+ synchronized (this) {
+ exception = e;
+ }
+ }
+ }
}
}
--- a/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -53,65 +53,60 @@
Remote getRemoteObject() throws RemoteException;
}
-public class HttpSocketTest extends UnicastRemoteObject
+public class HttpSocketTest extends UnicastRemoteObject
implements MyRemoteInterface
{
private static final String NAME = "HttpSocketTest";
private static final String REGNAME =
- "//:" + TestLibrary.REGISTRY_PORT + "/" + NAME;
+ "//:" + TestLibrary.REGISTRY_PORT + "/" + NAME;
public HttpSocketTest() throws RemoteException{}
private Remote ro;
public static void main(String[] args)
- throws Exception
+ throws Exception
{
-
- Registry registry = null;
+
+ Registry registry = null;
- TestLibrary.suggestSecurityManager(null);
-
- // Set the socket factory.
- System.err.println("installing socket factory");
- RMISocketFactory.setSocketFactory(new RMIHttpToPortSocketFactory());
+ TestLibrary.suggestSecurityManager(null);
- try {
+ // Set the socket factory.
+ System.err.println("installing socket factory");
+ RMISocketFactory.setSocketFactory(new RMIHttpToPortSocketFactory());
+
+ try {
System.err.println("Starting registry");
registry = LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
} catch (Exception e) {
- TestLibrary.bomb(e);
- }
+ TestLibrary.bomb(e);
+ }
- try {
+ try {
- registry.rebind( NAME, new HttpSocketTest() );
- MyRemoteInterface httpTest =
- (MyRemoteInterface)Naming.lookup( REGNAME );
- httpTest.setRemoteObject( new HttpSocketTest() );
- Remote r = httpTest.getRemoteObject();
+ registry.rebind( NAME, new HttpSocketTest() );
+ MyRemoteInterface httpTest =
+ (MyRemoteInterface)Naming.lookup( REGNAME );
+ httpTest.setRemoteObject( new HttpSocketTest() );
+ Remote r = httpTest.getRemoteObject();
- } catch (Exception e) {
- TestLibrary.bomb(e);
- }
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ }
}
public void setRemoteObject( Remote ro ) throws RemoteException {
- this.ro = ro;
+ this.ro = ro;
}
public Remote getRemoteObject() throws RemoteException {
- return( this.ro );
+ return( this.ro );
}
}
-
-
-
-
-
--- a/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,102 +29,102 @@
implements MyRemoteInterface, java.rmi.Remote
{
private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("java.rmi.Remote getRemoteObject()"),
- new java.rmi.server.Operation("void setRemoteObject(java.rmi.Remote)")
+ new java.rmi.server.Operation("java.rmi.Remote getRemoteObject()"),
+ new java.rmi.server.Operation("void setRemoteObject(java.rmi.Remote)")
};
-
+
private static final long interfaceHash = 3775375480010579665L;
-
+
private static final long serialVersionUID = 2;
-
+
private static boolean useNewInvoke;
private static java.lang.reflect.Method $method_getRemoteObject_0;
private static java.lang.reflect.Method $method_setRemoteObject_1;
-
+
static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke",
- new java.lang.Class[] {
- java.rmi.Remote.class,
- java.lang.reflect.Method.class,
- java.lang.Object[].class,
- long.class
- });
- useNewInvoke = true;
- $method_getRemoteObject_0 = MyRemoteInterface.class.getMethod("getRemoteObject", new java.lang.Class[] {});
- $method_setRemoteObject_1 = MyRemoteInterface.class.getMethod("setRemoteObject", new java.lang.Class[] {java.rmi.Remote.class});
- } catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
+ try {
+ java.rmi.server.RemoteRef.class.getMethod("invoke",
+ new java.lang.Class[] {
+ java.rmi.Remote.class,
+ java.lang.reflect.Method.class,
+ java.lang.Object[].class,
+ long.class
+ });
+ useNewInvoke = true;
+ $method_getRemoteObject_0 = MyRemoteInterface.class.getMethod("getRemoteObject", new java.lang.Class[] {});
+ $method_setRemoteObject_1 = MyRemoteInterface.class.getMethod("setRemoteObject", new java.lang.Class[] {java.rmi.Remote.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ useNewInvoke = false;
+ }
}
-
+
// constructors
public HttpSocketTest_Stub() {
- super();
+ super();
}
public HttpSocketTest_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of getRemoteObject()
public java.rmi.Remote getRemoteObject()
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- Object $result = ref.invoke(this, $method_getRemoteObject_0, null, -2578437860804964265L);
- return ((java.rmi.Remote) $result);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
- ref.invoke(call);
- java.rmi.Remote $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.Remote) in.readObject();
- } catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } catch (java.lang.ClassNotFoundException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- } finally {
- ref.done(call);
- }
- return $result;
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ Object $result = ref.invoke(this, $method_getRemoteObject_0, null, -2578437860804964265L);
+ return ((java.rmi.Remote) $result);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
+ ref.invoke(call);
+ java.rmi.Remote $result;
+ try {
+ java.io.ObjectInput in = call.getInputStream();
+ $result = (java.rmi.Remote) in.readObject();
+ } catch (java.io.IOException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } catch (java.lang.ClassNotFoundException e) {
+ throw new java.rmi.UnmarshalException("error unmarshalling return", e);
+ } finally {
+ ref.done(call);
+ }
+ return $result;
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
-
+
// implementation of setRemoteObject(Remote)
public void setRemoteObject(java.rmi.Remote $param_Remote_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_setRemoteObject_1, new java.lang.Object[] {$param_Remote_1}, -7518632118115022871L);
- } else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_Remote_1);
- } catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- ref.done(call);
- }
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ if (useNewInvoke) {
+ ref.invoke(this, $method_setRemoteObject_1, new java.lang.Object[] {$param_Remote_1}, -7518632118115022871L);
+ } else {
+ java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
+ try {
+ java.io.ObjectOutput out = call.getOutputStream();
+ out.writeObject($param_Remote_1);
+ } catch (java.io.IOException e) {
+ throw new java.rmi.MarshalException("error marshalling arguments", e);
+ }
+ ref.invoke(call);
+ ref.done(call);
+ }
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -60,109 +60,109 @@
private static final int SESSIONS = 50;
public interface Factory extends Remote {
- Session getSession() throws RemoteException;
+ Session getSession() throws RemoteException;
}
public interface Session extends Remote {
- void ping() throws RemoteException;
+ void ping() throws RemoteException;
}
private static class FactoryImpl implements Factory {
- FactoryImpl() { }
- public Session getSession() throws RemoteException {
- Session impl = new SessionImpl();
- UnicastRemoteObject.exportObject(impl, 0, new CSF(), new SSF());
- // return impl instead of stub to work around 4114579
- return impl;
- }
+ FactoryImpl() { }
+ public Session getSession() throws RemoteException {
+ Session impl = new SessionImpl();
+ UnicastRemoteObject.exportObject(impl, 0, new CSF(), new SSF());
+ // return impl instead of stub to work around 4114579
+ return impl;
+ }
}
private static class SessionImpl implements Session {
- SessionImpl() { }
- public void ping() { }
+ SessionImpl() { }
+ public void ping() { }
}
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4486732\n");
+ System.err.println("\nRegression test for bug 4486732\n");
- Factory factoryImpl = new FactoryImpl();
- Factory factoryStub =
- (Factory) UnicastRemoteObject.exportObject(factoryImpl, 0);
- for (int i = 0; i < SESSIONS; i++) {
- Session session = factoryStub.getSession();
- session.ping();
- }
- UnicastRemoteObject.unexportObject(factoryImpl, true);
+ Factory factoryImpl = new FactoryImpl();
+ Factory factoryStub =
+ (Factory) UnicastRemoteObject.exportObject(factoryImpl, 0);
+ for (int i = 0; i < SESSIONS; i++) {
+ Session session = factoryStub.getSession();
+ session.ping();
+ }
+ UnicastRemoteObject.unexportObject(factoryImpl, true);
- Registry registryImpl = LocateRegistry.createRegistry(PORT);
- CSF csf = new CSF();
- Reference<CSF> registryRef = new WeakReference<CSF>(csf);
- Registry registryStub = LocateRegistry.getRegistry("", PORT, csf);
- csf = null;
- registryStub.list();
- registryStub = null;
- UnicastRemoteObject.unexportObject(registryImpl, true);
+ Registry registryImpl = LocateRegistry.createRegistry(PORT);
+ CSF csf = new CSF();
+ Reference<CSF> registryRef = new WeakReference<CSF>(csf);
+ Registry registryStub = LocateRegistry.getRegistry("", PORT, csf);
+ csf = null;
+ registryStub.list();
+ registryStub = null;
+ UnicastRemoteObject.unexportObject(registryImpl, true);
- System.gc();
- // allow connections to time out
- Thread.sleep(3 * Long.getLong("sun.rmi.transport.connectionTimeout",
- 15000));
- System.gc();
+ System.gc();
+ // allow connections to time out
+ Thread.sleep(3 * Long.getLong("sun.rmi.transport.connectionTimeout",
+ 15000));
+ System.gc();
- if (CSF.deserializedInstances.size() != SESSIONS) {
- throw new Error("unexpected number of deserialized instances: " +
- CSF.deserializedInstances.size());
- }
+ if (CSF.deserializedInstances.size() != SESSIONS) {
+ throw new Error("unexpected number of deserialized instances: " +
+ CSF.deserializedInstances.size());
+ }
- int nonNullCount = 0;
- for (Reference<CSF> ref : CSF.deserializedInstances) {
- csf = ref.get();
- if (csf != null) {
- System.err.println("non-null deserialized instance: " + csf);
- nonNullCount++;
- }
- }
- if (nonNullCount > 0) {
- throw new Error("TEST FAILED: " +
- nonNullCount + " non-null deserialized instances");
- }
+ int nonNullCount = 0;
+ for (Reference<CSF> ref : CSF.deserializedInstances) {
+ csf = ref.get();
+ if (csf != null) {
+ System.err.println("non-null deserialized instance: " + csf);
+ nonNullCount++;
+ }
+ }
+ if (nonNullCount > 0) {
+ throw new Error("TEST FAILED: " +
+ nonNullCount + " non-null deserialized instances");
+ }
- csf = registryRef.get();
- if (csf != null) {
- System.err.println("non-null registry instance: " + csf);
- throw new Error("TEST FAILED: non-null registry instance");
- }
+ csf = registryRef.get();
+ if (csf != null) {
+ System.err.println("non-null registry instance: " + csf);
+ throw new Error("TEST FAILED: non-null registry instance");
+ }
- System.err.println("TEST PASSED");
+ System.err.println("TEST PASSED");
}
private static class CSF implements RMIClientSocketFactory, Serializable {
- static final List<Reference<CSF>> deserializedInstances =
- Collections.synchronizedList(new ArrayList<Reference<CSF>>());
- private static final AtomicInteger count = new AtomicInteger(0);
- private int num = count.incrementAndGet();
- CSF() { }
- public Socket createSocket(String host, int port) throws IOException {
- return new Socket(host, port);
- }
- public int hashCode() {
- return num;
- }
- public boolean equals(Object obj) {
- return obj instanceof CSF && ((CSF) obj).num == num;
- }
- private void readObject(ObjectInputStream in)
- throws IOException, ClassNotFoundException
- {
- in.defaultReadObject();
- deserializedInstances.add(new WeakReference<CSF>(this));
- }
+ static final List<Reference<CSF>> deserializedInstances =
+ Collections.synchronizedList(new ArrayList<Reference<CSF>>());
+ private static final AtomicInteger count = new AtomicInteger(0);
+ private int num = count.incrementAndGet();
+ CSF() { }
+ public Socket createSocket(String host, int port) throws IOException {
+ return new Socket(host, port);
+ }
+ public int hashCode() {
+ return num;
+ }
+ public boolean equals(Object obj) {
+ return obj instanceof CSF && ((CSF) obj).num == num;
+ }
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException
+ {
+ in.defaultReadObject();
+ deserializedInstances.add(new WeakReference<CSF>(this));
+ }
}
private static class SSF implements RMIServerSocketFactory {
- SSF() { }
- public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port);
- }
+ SSF() { }
+ public ServerSocket createServerSocket(int port) throws IOException {
+ return new ServerSocket(port);
+ }
}
}
--- a/jdk/test/java/rmi/transport/pinLastArguments/PinLastArguments.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/pinLastArguments/PinLastArguments.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,45 +45,45 @@
public class PinLastArguments {
public interface Ping extends Remote {
- void ping(Object first, Object second) throws RemoteException;
+ void ping(Object first, Object second) throws RemoteException;
}
private static class PingImpl implements Ping {
- PingImpl() { }
- public void ping(Object first, Object second) {
- System.err.println("ping invoked: " + first + ", " + second);
- }
+ PingImpl() { }
+ public void ping(Object first, Object second) {
+ System.err.println("ping invoked: " + first + ", " + second);
+ }
}
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 6332349\n");
+ System.err.println("\nRegression test for bug 6332349\n");
- Ping impl = new PingImpl();
- Reference<?> ref = new WeakReference<Ping>(impl);
- try {
- Ping stub = (Ping) UnicastRemoteObject.exportObject(impl, 0);
- Object notSerializable = new Object();
- stub.ping(impl, null);
- try {
- stub.ping(impl, notSerializable);
- } catch (MarshalException e) {
- if (e.getCause() instanceof NotSerializableException) {
- System.err.println("ping invocation failed as expected");
- } else {
- throw e;
- }
- }
- } finally {
- UnicastRemoteObject.unexportObject(impl, true);
- }
- impl = null;
+ Ping impl = new PingImpl();
+ Reference<?> ref = new WeakReference<Ping>(impl);
+ try {
+ Ping stub = (Ping) UnicastRemoteObject.exportObject(impl, 0);
+ Object notSerializable = new Object();
+ stub.ping(impl, null);
+ try {
+ stub.ping(impl, notSerializable);
+ } catch (MarshalException e) {
+ if (e.getCause() instanceof NotSerializableException) {
+ System.err.println("ping invocation failed as expected");
+ } else {
+ throw e;
+ }
+ }
+ } finally {
+ UnicastRemoteObject.unexportObject(impl, true);
+ }
+ impl = null;
- System.gc();
+ System.gc();
- if (ref.get() != null) {
- throw new Error("TEST FAILED: impl not garbage collected");
- }
+ if (ref.get() != null) {
+ throw new Error("TEST FAILED: impl not garbage collected");
+ }
- System.err.println("TEST PASSED");
+ System.err.println("TEST PASSED");
}
}
--- a/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -46,22 +46,22 @@
private static final long TIMEOUT = 60000;
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 6275081\n");
+ System.err.println("\nRegression test for bug 6275081\n");
- Remote impl = new Remote() { };
- long start = System.currentTimeMillis();
- for (int i = 0; i < REPS; i++) {
- System.err.println(i);
- UnicastRemoteObject.exportObject(impl, PORT);
- UnicastRemoteObject.unexportObject(impl, true);
- Thread.sleep(1); // work around BindException (bug?)
- }
- long delta = System.currentTimeMillis() - start;
- System.err.println(REPS + " export/unexport operations took " +
- delta + "ms");
- if (delta > TIMEOUT) {
- throw new Error("TEST FAILED: took over " + TIMEOUT + "ms");
- }
- System.err.println("TEST PASSED");
+ Remote impl = new Remote() { };
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < REPS; i++) {
+ System.err.println(i);
+ UnicastRemoteObject.exportObject(impl, PORT);
+ UnicastRemoteObject.unexportObject(impl, true);
+ Thread.sleep(1); // work around BindException (bug?)
+ }
+ long delta = System.currentTimeMillis() - start;
+ System.err.println(REPS + " export/unexport operations took " +
+ delta + "ms");
+ if (delta > TIMEOUT) {
+ throw new Error("TEST FAILED: took over " + TIMEOUT + "ms");
+ }
+ System.err.println("TEST PASSED");
}
}
--- a/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/readTimeout/ReadTimeoutTest.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -50,134 +50,134 @@
public class ReadTimeoutTest
{
- private static final int DELAY = 5000; // milliseconds
+ private static final int DELAY = 5000; // milliseconds
public static void main(String[] args)
- throws Exception
+ throws Exception
{
- // Make trouble for ourselves
- if (System.getSecurityManager() == null)
- System.setSecurityManager(new RMISecurityManager());
-
- // Flaky code alert - hope this is executed before TCPTransport.<clinit>
- System.setProperty("sun.rmi.transport.tcp.readTimeout", Integer.toString(DELAY));
+ // Make trouble for ourselves
+ if (System.getSecurityManager() == null)
+ System.setSecurityManager(new RMISecurityManager());
+
+ // Flaky code alert - hope this is executed before TCPTransport.<clinit>
+ System.setProperty("sun.rmi.transport.tcp.readTimeout", Integer.toString(DELAY));
+
+ // Set the socket factory.
+ System.err.println("(installing socket factory)");
+ SomeFactory fac = new SomeFactory();
+ RMISocketFactory.setSocketFactory(fac);
- // Set the socket factory.
- System.err.println("(installing socket factory)");
- SomeFactory fac = new SomeFactory();
- RMISocketFactory.setSocketFactory(fac);
+ // Create remote object
+ TestImpl impl = new TestImpl();
- // Create remote object
- TestImpl impl = new TestImpl();
+ // Export and get which port.
+ System.err.println("(exporting remote object)");
+ TestIface stub = impl.export();
+ Socket DoS = null;
+ try {
+ int port = fac.whichPort();
- // Export and get which port.
- System.err.println("(exporting remote object)");
- TestIface stub = impl.export();
- Socket DoS = null;
- try {
- int port = fac.whichPort();
+ // Sanity
+ if (port == 0)
+ throw new Error("TEST FAILED: export didn't reserve a port(?)");
- // Sanity
- if (port == 0)
- throw new Error("TEST FAILED: export didn't reserve a port(?)");
-
- // Now, connect to that port
- //Thread.sleep(2000);
- System.err.println("(connecting to listening port on 127.0.0.1:" +
- port + ")");
- DoS = new Socket("127.0.0.1", port);
- InputStream stream = DoS.getInputStream();
+ // Now, connect to that port
+ //Thread.sleep(2000);
+ System.err.println("(connecting to listening port on 127.0.0.1:" +
+ port + ")");
+ DoS = new Socket("127.0.0.1", port);
+ InputStream stream = DoS.getInputStream();
- // Read on the socket in the background
- boolean[] successful = new boolean[] { false };
- (new SomeReader(stream, successful)).start();
+ // Read on the socket in the background
+ boolean[] successful = new boolean[] { false };
+ (new SomeReader(stream, successful)).start();
- // Wait for completion
- int nretries = 4;
- while (nretries-- > 0) {
- if (successful[0])
- break;
- Thread.sleep(DELAY);
- }
+ // Wait for completion
+ int nretries = 4;
+ while (nretries-- > 0) {
+ if (successful[0])
+ break;
+ Thread.sleep(DELAY);
+ }
- if (successful[0]) {
- System.err.println("TEST PASSED.");
- } else {
- throw new Error("TEST FAILED.");
- }
+ if (successful[0]) {
+ System.err.println("TEST PASSED.");
+ } else {
+ throw new Error("TEST FAILED.");
+ }
- } finally {
- try {
- if (DoS != null)
- DoS.close(); // aborts the reader if still blocked
- impl.unexport();
- } catch (Throwable unmatter) {
- }
- }
+ } finally {
+ try {
+ if (DoS != null)
+ DoS.close(); // aborts the reader if still blocked
+ impl.unexport();
+ } catch (Throwable unmatter) {
+ }
+ }
- // Should exit here
+ // Should exit here
}
private static class SomeFactory
- extends RMISocketFactory
+ extends RMISocketFactory
{
- private int servport = 0;
+ private int servport = 0;
- public Socket createSocket(String h, int p)
- throws IOException
- {
- return (new Socket(h, p));
- }
+ public Socket createSocket(String h, int p)
+ throws IOException
+ {
+ return (new Socket(h, p));
+ }
- /** Create a server socket and remember which port it's on.
- * Aborts if createServerSocket(0) is called twice, because then
- * it doesn't know whether to remember the first or second port.
- */
- public ServerSocket createServerSocket(int p)
- throws IOException
- {
- ServerSocket ss;
- ss = new ServerSocket(p);
- if (p == 0) {
- if (servport != 0) {
- System.err.println("TEST FAILED: " +
- "Duplicate createServerSocket(0)");
- throw new Error("Test aborted (createServerSocket)");
- }
- servport = ss.getLocalPort();
- }
- return (ss);
- }
+ /** Create a server socket and remember which port it's on.
+ * Aborts if createServerSocket(0) is called twice, because then
+ * it doesn't know whether to remember the first or second port.
+ */
+ public ServerSocket createServerSocket(int p)
+ throws IOException
+ {
+ ServerSocket ss;
+ ss = new ServerSocket(p);
+ if (p == 0) {
+ if (servport != 0) {
+ System.err.println("TEST FAILED: " +
+ "Duplicate createServerSocket(0)");
+ throw new Error("Test aborted (createServerSocket)");
+ }
+ servport = ss.getLocalPort();
+ }
+ return (ss);
+ }
- /** Return which port was reserved by createServerSocket(0).
- * If the return value was 0, createServerSocket(0) wasn't called.
- */
- public int whichPort() {
- return (servport);
- }
+ /** Return which port was reserved by createServerSocket(0).
+ * If the return value was 0, createServerSocket(0) wasn't called.
+ */
+ public int whichPort() {
+ return (servport);
+ }
} // end class SomeFactory
protected static class SomeReader extends Thread {
- private InputStream readon;
- private boolean[] vec;
+ private InputStream readon;
+ private boolean[] vec;
- public SomeReader(InputStream s, boolean[] successvec) {
- super();
- this.setDaemon(true);
- this.readon = s;
- this.vec = successvec;
- }
+ public SomeReader(InputStream s, boolean[] successvec) {
+ super();
+ this.setDaemon(true);
+ this.readon = s;
+ this.vec = successvec;
+ }
- public void run() {
- try {
- int c = this.readon.read();
- if (c != -1)
- throw new Error ("Server returned " + c);
- this.vec[0] = true;
+ public void run() {
+ try {
+ int c = this.readon.read();
+ if (c != -1)
+ throw new Error ("Server returned " + c);
+ this.vec[0] = true;
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
} // end class SomeReader
}
--- a/jdk/test/java/rmi/transport/readTimeout/TestIface.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/readTimeout/TestIface.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -27,5 +27,5 @@
extends Remote
{
public String testCall(String ign)
- throws RemoteException;
+ throws RemoteException;
}
--- a/jdk/test/java/rmi/transport/readTimeout/TestImpl.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/readTimeout/TestImpl.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,19 +32,18 @@
}
public TestIface export()
- throws RemoteException
+ throws RemoteException
{
- return (TestIface)UnicastRemoteObject.exportObject(this);
+ return (TestIface)UnicastRemoteObject.exportObject(this);
}
public void unexport()
- throws NoSuchObjectException
+ throws NoSuchObjectException
{
- UnicastRemoteObject.unexportObject(this, true);
+ UnicastRemoteObject.unexportObject(this, true);
}
public String testCall(String ign) {
- return ("OK");
+ return ("OK");
}
}
-
--- a/jdk/test/java/rmi/transport/readTimeout/TestImpl_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/readTimeout/TestImpl_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,38 +29,38 @@
implements TestIface
{
private static final long serialVersionUID = 2;
-
+
private static java.lang.reflect.Method $method_testCall_0;
-
+
static {
- try {
- $method_testCall_0 = TestIface.class.getMethod("testCall", new java.lang.Class[] {java.lang.String.class});
- } catch (java.lang.NoSuchMethodException e) {
- throw new java.lang.NoSuchMethodError(
- "stub class initialization failed");
- }
+ try {
+ $method_testCall_0 = TestIface.class.getMethod("testCall", new java.lang.Class[] {java.lang.String.class});
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new java.lang.NoSuchMethodError(
+ "stub class initialization failed");
+ }
}
-
+
// constructors
public TestImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
// methods from remote interfaces
-
+
// implementation of testCall(String)
public java.lang.String testCall(java.lang.String $param_String_1)
- throws java.rmi.RemoteException
+ throws java.rmi.RemoteException
{
- try {
- Object $result = ref.invoke(this, $method_testCall_0, new java.lang.Object[] {$param_String_1}, -4495720265115653109L);
- return ((java.lang.String) $result);
- } catch (java.lang.RuntimeException e) {
- throw e;
- } catch (java.rmi.RemoteException e) {
- throw e;
- } catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
+ try {
+ Object $result = ref.invoke(this, $method_testCall_0, new java.lang.Object[] {$param_String_1}, -4495720265115653109L);
+ return ((java.lang.String) $result);
+ } catch (java.lang.RuntimeException e) {
+ throw e;
+ } catch (java.rmi.RemoteException e) {
+ throw e;
+ } catch (java.lang.Exception e) {
+ throw new java.rmi.UnexpectedException("undeclared checked exception", e);
+ }
}
}
--- a/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -53,32 +53,32 @@
private ReuseDefaultPort() { }
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 6269166\n");
- RMISocketFactory.setSocketFactory(new SF());
- Remote impl = new ReuseDefaultPort();
- Remote stub = UnicastRemoteObject.exportObject(impl, 0);
- System.err.println("- exported object: " + stub);
- try {
- Registry registry = LocateRegistry.createRegistry(PORT);
- System.err.println("- exported registry: " + registry);
- System.err.println("TEST PASSED");
- } finally {
- UnicastRemoteObject.unexportObject(impl, true);
- }
+ System.err.println("\nRegression test for bug 6269166\n");
+ RMISocketFactory.setSocketFactory(new SF());
+ Remote impl = new ReuseDefaultPort();
+ Remote stub = UnicastRemoteObject.exportObject(impl, 0);
+ System.err.println("- exported object: " + stub);
+ try {
+ Registry registry = LocateRegistry.createRegistry(PORT);
+ System.err.println("- exported registry: " + registry);
+ System.err.println("TEST PASSED");
+ } finally {
+ UnicastRemoteObject.unexportObject(impl, true);
+ }
}
private static class SF extends RMISocketFactory {
- private static RMISocketFactory defaultFactory =
- RMISocketFactory.getDefaultSocketFactory();
- SF() { }
- public Socket createSocket(String host, int port) throws IOException {
- return defaultFactory.createSocket(host, port);
- }
- public ServerSocket createServerSocket(int port) throws IOException {
- if (port == 0) {
- port = PORT;
- }
- return defaultFactory.createServerSocket(port);
- }
+ private static RMISocketFactory defaultFactory =
+ RMISocketFactory.getDefaultSocketFactory();
+ SF() { }
+ public Socket createSocket(String host, int port) throws IOException {
+ return defaultFactory.createSocket(host, port);
+ }
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (port == 0) {
+ port = PORT;
+ }
+ return defaultFactory.createServerSocket(port);
+ }
}
}
--- a/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -60,80 +60,80 @@
public static void main(String[] args) {
- System.err.println("\nRegression test for bug 4404702\n");
+ System.err.println("\nRegression test for bug 4404702\n");
- /*
- * HACK: Work around the fact that java.util.logging.LogManager's
- * (singleton) construction also has this bug-- it will register a
- * "shutdown hook", i.e. a thread, which will inherit and pin the
- * current thread's context class loader for the lifetime of the VM--
- * by causing the LogManager to be initialized now, instead of by
- * RMI when our special context class loader is set.
- */
- java.util.logging.LogManager.getLogManager();
+ /*
+ * HACK: Work around the fact that java.util.logging.LogManager's
+ * (singleton) construction also has this bug-- it will register a
+ * "shutdown hook", i.e. a thread, which will inherit and pin the
+ * current thread's context class loader for the lifetime of the VM--
+ * by causing the LogManager to be initialized now, instead of by
+ * RMI when our special context class loader is set.
+ */
+ java.util.logging.LogManager.getLogManager();
- /*
- * HACK: Work around the fact that the non-native, thread-based
- * SecureRandom seed generator (ThreadedSeedGenerator) seems to
- * have this bug too (which had been causing this test to fail
- * when run with jtreg on Windows XP-- see 4910382).
- */
- (new java.security.SecureRandom()).nextInt();
+ /*
+ * HACK: Work around the fact that the non-native, thread-based
+ * SecureRandom seed generator (ThreadedSeedGenerator) seems to
+ * have this bug too (which had been causing this test to fail
+ * when run with jtreg on Windows XP-- see 4910382).
+ */
+ (new java.security.SecureRandom()).nextInt();
- RuntimeThreadInheritanceLeak obj = new RuntimeThreadInheritanceLeak();
+ RuntimeThreadInheritanceLeak obj = new RuntimeThreadInheritanceLeak();
- try {
- ClassLoader loader = URLClassLoader.newInstance(new URL[0]);
- ReferenceQueue refQueue = new ReferenceQueue();
- Reference loaderRef = new WeakReference(loader, refQueue);
- System.err.println("created loader: " + loader);
+ try {
+ ClassLoader loader = URLClassLoader.newInstance(new URL[0]);
+ ReferenceQueue refQueue = new ReferenceQueue();
+ Reference loaderRef = new WeakReference(loader, refQueue);
+ System.err.println("created loader: " + loader);
- Thread.currentThread().setContextClassLoader(loader);
- UnicastRemoteObject.exportObject(obj);
- Thread.currentThread().setContextClassLoader(
- ClassLoader.getSystemClassLoader());
- System.err.println(
- "exported remote object with loader as context class loader");
+ Thread.currentThread().setContextClassLoader(loader);
+ UnicastRemoteObject.exportObject(obj);
+ Thread.currentThread().setContextClassLoader(
+ ClassLoader.getSystemClassLoader());
+ System.err.println(
+ "exported remote object with loader as context class loader");
- loader = null;
- System.err.println("nulled strong reference to loader");
+ loader = null;
+ System.err.println("nulled strong reference to loader");
- UnicastRemoteObject.unexportObject(obj, true);
- System.err.println("unexported remote object");
+ UnicastRemoteObject.unexportObject(obj, true);
+ System.err.println("unexported remote object");
- /*
- * HACK: Work around the fact that the sun.misc.GC daemon thread
- * also has this bug-- it will have inherited our loader as its
- * context class loader-- by giving it a chance to pass away.
- */
- Thread.sleep(2000);
- System.gc();
+ /*
+ * HACK: Work around the fact that the sun.misc.GC daemon thread
+ * also has this bug-- it will have inherited our loader as its
+ * context class loader-- by giving it a chance to pass away.
+ */
+ Thread.sleep(2000);
+ System.gc();
- System.err.println(
- "waiting to be notified of loader being weakly reachable...");
- Reference dequeued = refQueue.remove(TIMEOUT);
- if (dequeued == null) {
- System.err.println(
- "TEST FAILED: loader not deteced weakly reachable");
- dumpThreads();
- throw new RuntimeException(
- "TEST FAILED: loader not detected weakly reachable");
- }
+ System.err.println(
+ "waiting to be notified of loader being weakly reachable...");
+ Reference dequeued = refQueue.remove(TIMEOUT);
+ if (dequeued == null) {
+ System.err.println(
+ "TEST FAILED: loader not deteced weakly reachable");
+ dumpThreads();
+ throw new RuntimeException(
+ "TEST FAILED: loader not detected weakly reachable");
+ }
- System.err.println(
- "TEST PASSED: loader detected weakly reachable");
- dumpThreads();
+ System.err.println(
+ "TEST PASSED: loader detected weakly reachable");
+ dumpThreads();
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new RuntimeException("TEST FAILED: unexpected exception", e);
- } finally {
- try {
- UnicastRemoteObject.unexportObject(obj, true);
- } catch (RemoteException e) {
- }
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException("TEST FAILED: unexpected exception", e);
+ } finally {
+ try {
+ UnicastRemoteObject.unexportObject(obj, true);
+ } catch (RemoteException e) {
+ }
+ }
}
/**
@@ -141,19 +141,19 @@
* including their context class loaders.
**/
private static void dumpThreads() {
- System.err.println(
- "current live threads and their context class loaders:");
- Map threads = Thread.getAllStackTraces();
- for (Iterator iter = threads.entrySet().iterator(); iter.hasNext();) {
- Map.Entry e = (Map.Entry) iter.next();
- Thread t = (Thread) e.getKey();
- System.err.println(" thread: " + t);
- System.err.println(" context class loader: " +
- t.getContextClassLoader());
- StackTraceElement[] trace = (StackTraceElement[]) e.getValue();
- for (int i = 0; i < trace.length; i++) {
- System.err.println(" " + trace[i]);
- }
- }
+ System.err.println(
+ "current live threads and their context class loaders:");
+ Map threads = Thread.getAllStackTraces();
+ for (Iterator iter = threads.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry e = (Map.Entry) iter.next();
+ Thread t = (Thread) e.getKey();
+ System.err.println(" thread: " + t);
+ System.err.println(" context class loader: " +
+ t.getContextClassLoader());
+ StackTraceElement[] trace = (StackTraceElement[]) e.getValue();
+ for (int i = 0; i < trace.length; i++) {
+ System.err.println(" " + trace[i]);
+ }
+ }
}
}
--- a/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak_Stub.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak_Stub.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,10 +29,10 @@
implements java.rmi.Remote
{
private static final long serialVersionUID = 2;
-
+
// constructors
public RuntimeThreadInheritanceLeak_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
+ super(ref);
}
-
+
}