diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-17 16:14:58 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-17 16:14:58 +0000 |
commit | d88b2af71307638c59e819285efaa91b8a1bd495 (patch) | |
tree | 30ee0e56a8b25e9e21a7b1d497cbdf9b57457669 /java/sca/modules/host-rmi/src | |
parent | a1c9138328d18948c1249d2853b3a15c171363fc (diff) |
Add a LifeCycleListener interface so that extension points or extension can be called back upon the start/stop of the extension point registry
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@785699 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/host-rmi/src')
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(); } |