diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-04 21:05:25 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-04 21:05:25 +0000 |
commit | 3d03c96d7b079549c24ed3fa5e74b0930c447647 (patch) | |
tree | 80c1a5467918045aa4107330c9f6aaede41a975b /java/sca | |
parent | 9d50b86d029573d79dbd6dcb4bc40ccbe8601765 (diff) |
Unexport the remote object so that RMI threads can be gracefully terminated
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@740884 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r-- | java/sca/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/java/sca/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java b/java/sca/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java index f10cf353b7..2efb470d33 100644 --- a/java/sca/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java +++ b/java/sca/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java @@ -22,14 +22,12 @@ package org.apache.tuscany.sca.binding.rmi.provider; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.rmi.NoSuchObjectException; import java.rmi.Remote; import java.rmi.server.UnicastRemoteObject; import java.security.AccessController; import java.security.PrivilegedExceptionAction; -import net.sf.cglib.asm.ClassWriter; -import net.sf.cglib.asm.Type; -import net.sf.cglib.core.Constants; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; @@ -60,6 +58,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { private RMIBinding binding; private RMIHost rmiHost; private RuntimeWire wire; + private Remote rmiProxy; public RMIServiceBindingProvider(RuntimeComponent rc, RuntimeComponentService rcs, RMIBinding binding, RMIHost rmiHost) { this.component = rc; @@ -75,7 +74,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { wire = service.getRuntimeWire(binding); Interface serviceInterface = service.getInterfaceContract().getInterface(); - Remote rmiProxy = createRmiService(serviceInterface); + rmiProxy = createRmiService(serviceInterface); try { @@ -88,6 +87,11 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { public void stop() { rmiHost.unregisterService(binding.getURI()); + try { + UnicastRemoteObject.unexportObject(rmiProxy, false); + } catch (NoSuchObjectException e) { + throw new ServiceRuntimeException(e); + } } private int getPort(String port) { |