summaryrefslogtreecommitdiff
path: root/java/rmi/server/RMIClassLoader.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-03-02 18:56:12 +0000
committerTom Tromey <tromey@redhat.com>2006-03-02 18:56:12 +0000
commitd5d2810fcc0cb609c9175a38076a2ed7aa896b25 (patch)
tree90b09bb04bd4df37524b9f05834a1032bf512f44 /java/rmi/server/RMIClassLoader.java
parent394e32e947178ce2e9b8c7432c95108c0d89bbce (diff)
downloadclasspath-d5d2810fcc0cb609c9175a38076a2ed7aa896b25.tar.gz
* java/rmi/server/RMIClassLoader.java (getProviderInstance): Wrote.
Diffstat (limited to 'java/rmi/server/RMIClassLoader.java')
-rw-r--r--java/rmi/server/RMIClassLoader.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/java/rmi/server/RMIClassLoader.java b/java/rmi/server/RMIClassLoader.java
index 761d99830..33c44198d 100644
--- a/java/rmi/server/RMIClassLoader.java
+++ b/java/rmi/server/RMIClassLoader.java
@@ -38,10 +38,13 @@ exception statement from your version. */
package java.rmi.server;
+import gnu.classpath.ServiceFactory;
+import gnu.classpath.SystemProperties;
import gnu.java.rmi.server.RMIClassLoaderImpl;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Iterator;
/**
* This class provides a set of public static utility methods for supporting
@@ -181,7 +184,20 @@ public class RMIClassLoader
*/
private static RMIClassLoaderSpi getProviderInstance()
{
- // TODO: Do something more useful here.
- return null;
+ // If the user asked for the default, return it. We do a special
+ // check here because our standard service lookup function does not
+ // handle this -- nor should it.
+ String prop = SystemProperties.getProperty("java.rmi.server.RMIClassLoaderSpi");
+ if ("default".equals(prop))
+ return null;
+ Iterator it = ServiceFactory.lookupProviders(RMIClassLoaderSpi.class,
+ null);
+ if (it == null || ! it.hasNext())
+ return null;
+ // FIXME: the spec says we ought to throw an Error of some kind if
+ // the specified provider is not suitable for some reason. However
+ // our service factory simply logs the problem and moves on to the next
+ // provider in this situation.
+ return (RMIClassLoaderSpi) it.next();
}
}