summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/host-rmi/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/host-rmi/src')
-rw-r--r--java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java2
-rw-r--r--java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java16
-rw-r--r--java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java5
-rw-r--r--java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java5
4 files changed, 11 insertions, 17 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 f98ce018e5..99a6a5fab7 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
@@ -155,7 +155,7 @@ public class DefaultRMIHost implements RMIHost {
}
}
- public void destroy() {
+ public void stop() {
for (Registry registry : rmiRegistries.values()) {
try {
UnicastRemoteObject.unexportObject(registry, false);
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 edfda79dd0..b7435a1f84 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
@@ -22,15 +22,14 @@ package org.apache.tuscany.sca.host.rmi;
import java.util.ArrayList;
import java.util.List;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.LifeCycleListener;
/**
* Default implementation of an RMI host extension point.
*
* @version $Rev$ $Date$
*/
-public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint, ModuleActivator {
+public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint, LifeCycleListener {
private List<RMIHost> rmiHosts = new ArrayList<RMIHost>();
@@ -40,6 +39,9 @@ public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint, Modu
public void addRMIHost(RMIHost rmiHost) {
rmiHosts.add(rmiHost);
+ if(rmiHost instanceof LifeCycleListener) {
+ ((LifeCycleListener) rmiHost).start();
+ }
}
public void removeRMIHost(RMIHost rmiHost) {
@@ -50,12 +52,14 @@ public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint, Modu
return rmiHosts;
}
- public void start(ExtensionPointRegistry registry) {
+ public void start() {
}
- public void stop(ExtensionPointRegistry registry) {
+ public void stop() {
for (RMIHost host : rmiHosts) {
- host.destroy();
+ if(host instanceof LifeCycleListener) {
+ ((LifeCycleListener) host).stop();
+ }
}
}
}
diff --git a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java
index e2fad5d9b5..2f3e2311ed 100644
--- a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java
+++ b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java
@@ -59,9 +59,4 @@ public class ExtensibleRMIHost implements RMIHost {
protected RMIHost getDefaultHost() {
return rmiHosts.getRMIHosts().get(0);
}
-
- public void destroy() {
- getDefaultHost().destroy();
- }
-
}
diff --git a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java
index b85cc2fc2a..bf8659c254 100644
--- a/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java
+++ b/java/sca/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java
@@ -57,9 +57,4 @@ public interface RMIHost {
* @throws RMIHostRuntimeException
*/
Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException;
-
- /**
- * Destroy the host. It can be used to unbind the RMI registry
- */
- void destroy();
}