summaryrefslogtreecommitdiff
path: root/java/rmi/activation/Activatable.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/rmi/activation/Activatable.java')
-rw-r--r--java/rmi/activation/Activatable.java50
1 files changed, 37 insertions, 13 deletions
diff --git a/java/rmi/activation/Activatable.java b/java/rmi/activation/Activatable.java
index f7fe1ad55..472c65c11 100644
--- a/java/rmi/activation/Activatable.java
+++ b/java/rmi/activation/Activatable.java
@@ -232,8 +232,8 @@ public abstract class Activatable
}
/**
- * This method registers an activatable object. The object is expected to
- * be on the anonymous port (null client and server socket factories).
+ * This method registers an activatable object. The object is expected to be
+ * on the anonymous port (null client and server socket factories).
*
* @param desc the object description.
* @return the remote stub for the activatable object (the first call on this
@@ -246,7 +246,17 @@ public abstract class Activatable
throws UnknownGroupException, ActivationException, RemoteException
{
ActivationID id = obtainId(desc);
- return id.activate(false);
+ try
+ {
+ return toStub(
+ id,
+ Thread.currentThread().getContextClassLoader().loadClass(
+ desc.getClassName()));
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ActivationException("Class not found: "+desc.getClassName());
+ }
}
/**
@@ -456,16 +466,9 @@ public abstract class Activatable
RMIServerSocketFactory serverSocketFactory)
throws RemoteException
{
- UnicastServerRef sref = null;
- if (obj instanceof RemoteObject)
- sref = (UnicastServerRef) ((RemoteObject) obj).getRef();
-
- if (sref == null)
- sref = new ActivatableServerRef(makeId(id), id, port, serverSocketFactory);
-
- Remote stub = sref.exportObject(obj);
- // addStub(obj, stub); // need probably the stub repository elsewhere
- return stub;
+ ActivatableServerRef sref = null;
+ sref = new ActivatableServerRef(makeId(id), id, port, serverSocketFactory);
+ return sref.exportObject(obj);
}
/**
@@ -504,4 +507,25 @@ public abstract class Activatable
return id;
}
+ /**
+ * Connect the object to the UnicastServer (export), but not activate it.
+ * The object will be activated on the first call.
+ */
+ static Remote toStub(ActivationID anId, Class stubFor)
+ {
+ try
+ {
+ ActivatableServerRef asr =
+ new ActivatableServerRef(makeId(anId), anId, 0, null);
+ UnicastServer.exportActivatableObject(asr);
+ return asr.exportClass(stubFor);
+ }
+ catch (RemoteException e)
+ {
+ InternalError ierr = new InternalError(
+ "Failed to obtain activatable stub");
+ ierr.initCause(e);
+ throw ierr;
+ }
+ }
}