diff options
Diffstat (limited to 'java/rmi/activation')
-rw-r--r-- | java/rmi/activation/Activatable.java | 50 | ||||
-rw-r--r-- | java/rmi/activation/ActivationGroup.java | 16 | ||||
-rw-r--r-- | java/rmi/activation/ActivationSystem.java | 5 |
3 files changed, 54 insertions, 17 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; + } + } } diff --git a/java/rmi/activation/ActivationGroup.java b/java/rmi/activation/ActivationGroup.java index f90300acc..2fc438a8d 100644 --- a/java/rmi/activation/ActivationGroup.java +++ b/java/rmi/activation/ActivationGroup.java @@ -281,8 +281,18 @@ public abstract class ActivationGroup } /** - * Get the current activation system. If the system is not set via this - * method, the default implementatin for this virtual machine is returned. + * Get the current activation system. If the system is not set via + * {@link #setSystem} method, the default system for this virtual machine is + * returned. The default system is first searched by name + * "java.rmi.activation.ActivationSystem" on the activation registry port. The + * default value of the activation registry port is + * {@link ActivationSystem#SYSTEM_PORT}, but it can be changed by putting the + * system property java.rmi.activation.port. Both activation system and + * activation registry are provided by the RMI daemon tool, RMID, if it is + * running on the local host. If the RMID is not running, the internal + * transient activation system will be created and returned. This internal + * system is highly limited in in capabilities and is not intended to be used + * anywhere apart automated testing. * * @return the activation system for this virtual machine * @throws ActivationException @@ -290,7 +300,7 @@ public abstract class ActivationGroup public static ActivationSystem getSystem() throws ActivationException { if (system == null) - return DefaultActivationSystem.singleton; + return DefaultActivationSystem.get(); else return system; } diff --git a/java/rmi/activation/ActivationSystem.java b/java/rmi/activation/ActivationSystem.java index ab56b4692..719676445 100644 --- a/java/rmi/activation/ActivationSystem.java +++ b/java/rmi/activation/ActivationSystem.java @@ -55,12 +55,15 @@ import java.rmi.RemoteException; * methods in this interface throw {@link java.rmi.AccessException} if called * from the client that is not reside on the same host as the activation system. * </p> + * @see ActivationGroup#getSystem() */ public interface ActivationSystem extends Remote { /** - * The port, used by the activation system (1098 by default). + * The port, used by the activation system. The value is equal to 1098 by + * default, but it can be changed by putting the system property + * . */ int SYSTEM_PORT = 1098; |