summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorAudrius Meskauskas <audriusa@Bioinformatics.org>2006-03-24 17:40:24 +0000
committerAudrius Meskauskas <audriusa@Bioinformatics.org>2006-03-24 17:40:24 +0000
commit63f5926a4f85a4c5f4c8349a7d5bc985badd503f (patch)
treee459cef953f7bdc2a4d995b04143b2bcac9ff478 /java
parentf370efa1358a912b3c57e4bce650babbebd59269 (diff)
downloadclasspath-63f5926a4f85a4c5f4c8349a7d5bc985badd503f.tar.gz
2006-03-24 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/java/rmi/activation/ActivationSystemTransient.java: Inherit from Activator. 2006-03-24 Audrius Meskauskas <AudriusA@Bioinformatics.org> * gnu/java/rmi/activation/DefaultActivationGroup.java (newInstance): Print debug message if debug flag is set. * gnu/java/rmi/activation/DefaultActivationSystem.java: Rewritten. * gnu/java/rmi/server/ActivatableServerRef.java (activate): assign detail, do not call iniCause(). (exportClass): New method. * gnu/java/rmi/server/CombinedClassLoader.java (constructor): Ignore null (bootstrap) class loader. * gnu/java/rmi/server/UnicastServerRef.java (methods, skel, stub, buildMethodHash, findStubSkelClass, getHelperClass): Changed visibility to protected. * java/rmi/activation/Activatable.java (export, register): Rewritten. (toStub): New method. * java/rmi/activation/ActivationGroup.java (getSystem): Rewritten. * java/rmi/activation/ActivationSystem.java (SYSTEM_PORT): Explained property java.rmi.activation.port. Applying two patches toghether because the intermediate version does not build.
Diffstat (limited to 'java')
-rw-r--r--java/rmi/activation/Activatable.java50
-rw-r--r--java/rmi/activation/ActivationGroup.java16
-rw-r--r--java/rmi/activation/ActivationSystem.java5
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;