diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-06 16:56:01 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-06 16:56:01 +0000 |
commit | 58f1d25ca60915a00e4ae3522b0c928153c4491d (patch) | |
tree | fc1359bd1fe9860c02a14c7658fc279e2a81480a /java/sca/modules/host-rmi/src | |
parent | 381a103a148d1aacb19f0afb14f66d9d6e298878 (diff) |
Create RMI Registry before checking its existence
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@822344 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/host-rmi/src')
2 files changed, 7 insertions, 9 deletions
diff --git a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java index f7d2184e24..cc819d194c 100644 --- a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java +++ b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java @@ -61,14 +61,10 @@ public class DefaultRMIHost implements RMIHost { registry = rmiRegistries.get(Integer.toString(rmiURI.port)); if (registry == null) { try { - registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory); - // FIXME: It takes about 15 seconds to time out - registry.lookup(rmiURI.serviceName); - } catch (RemoteException e) { registry = LocateRegistry.createRegistry(rmiURI.port, socketFactory, socketFactory); - } catch (NotBoundException e) { - // Ignore - } + } catch (RemoteException e) { + registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory); + } rmiRegistries.put(Integer.toString(rmiURI.port), registry); } registry.bind(rmiURI.serviceName, serviceObject); diff --git a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java index b7435a1f84..541ee8ba06 100644 --- a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java +++ b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java @@ -34,7 +34,6 @@ public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint, Life private List<RMIHost> rmiHosts = new ArrayList<RMIHost>(); public DefaultRMIHostExtensionPoint() { - addRMIHost(new DefaultRMIHost()); } public void addRMIHost(RMIHost rmiHost) { @@ -48,7 +47,10 @@ public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint, Life rmiHosts.remove(rmiHost); } - public List<RMIHost> getRMIHosts() { + public synchronized List<RMIHost> getRMIHosts() { + if(rmiHosts.isEmpty()) { + addRMIHost(new DefaultRMIHost()); + } return rmiHosts; } |