diff options
| author | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2006-03-24 17:40:24 +0000 |
|---|---|---|
| committer | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2006-03-24 17:40:24 +0000 |
| commit | 63f5926a4f85a4c5f4c8349a7d5bc985badd503f (patch) | |
| tree | e459cef953f7bdc2a4d995b04143b2bcac9ff478 /gnu/java/rmi/activation/DefaultActivationSystem.java | |
| parent | f370efa1358a912b3c57e4bce650babbebd59269 (diff) | |
| download | classpath-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 'gnu/java/rmi/activation/DefaultActivationSystem.java')
| -rw-r--r-- | gnu/java/rmi/activation/DefaultActivationSystem.java | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/gnu/java/rmi/activation/DefaultActivationSystem.java b/gnu/java/rmi/activation/DefaultActivationSystem.java index 75fb45160..754b5dcb9 100644 --- a/gnu/java/rmi/activation/DefaultActivationSystem.java +++ b/gnu/java/rmi/activation/DefaultActivationSystem.java @@ -39,19 +39,80 @@ exception statement from your version. */ package gnu.java.rmi.activation; import java.rmi.activation.ActivationSystem; -import java.rmi.activation.Activator; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; /** - * The default activation system for this jre. + * Finds and returns the default activation system for this jre. * - * @author Audrius Meskauskas (audriusa@bioinformatics.org) + * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public abstract class DefaultActivationSystem - implements ActivationSystem, Activator { /** - * The singleton instance of the default activation system. + * The activation system (assigned if once found). */ - public static final ActivationSystem singleton - = ActivationSystemTransient.getInstance(); + static ActivationSystem system; + + /** + * The default activation registry port. + */ + static int ACTIVATION_REGISTRY_PORT; + + /** + * The name of the activation system registry port property. + */ + static String AS_PORT_PROPERTY = "java.rmi.activation.port"; + + /** + * The defalut name of the activation system in the activation registry. + */ + static String ACTIVATION_SYSTEM_NAME = "java.rmi.activation.ActivationSystem"; + + /** + * Get the activation system, default for this jre. If no external activation + * system exists, the internal activation system will be activated. This + * internal system is limited in capabilities and should be used exclusively + * for automated testing, to avoid necessity of starting rmi daemon during + * testing process. + */ + public static ActivationSystem get() + { + if (system == null) + try + { + // Obtain the port: + String asr = System.getProperty("java.rmi.activation.port"); + + if (asr != null) + { + try + { + ACTIVATION_REGISTRY_PORT = Integer.parseInt(asr); + if (ACTIVATION_REGISTRY_PORT <= 0) + throw new InternalError("Invalid " + asr + " value, " + + ACTIVATION_REGISTRY_PORT); + } + catch (NumberFormatException e) + { + throw new InternalError("Unable to parse " + asr + + " to integer"); + } + } + else + ACTIVATION_REGISTRY_PORT = ActivationSystem.SYSTEM_PORT; + + // Expect the naming service running first. + // The local host may want to use the shared registry + Registry r = LocateRegistry.getRegistry(ACTIVATION_REGISTRY_PORT); + ActivationSystem system = (ActivationSystem) r.lookup(ACTIVATION_SYSTEM_NAME); + return system; + } + catch (Exception ex) + { + system = ActivationSystemTransient.getInstance(); + } + + return system; + } } |
