You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2011/02/09 15:01:46 UTC

svn commit: r1068894 - in /tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core: assembly/CompositeActivatorImpl.java scope/CompositeScopeContainer.java

Author: slaws
Date: Wed Feb  9 14:01:46 2011
New Revision: 1068894

URL: http://svn.apache.org/viewvc?rev=1068894&view=rev
Log:
TUSCANY-3834 - continue stopping components in the case of exceptions thrown during a previous component stop.

Modified:
    tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
    tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java

Modified: tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java?rev=1068894&r1=1068893&r2=1068894&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java (original)
+++ tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java Wed Feb  9 14:01:46 2011
@@ -739,13 +739,17 @@ public class CompositeActivatorImpl impl
             for (Binding binding : service.getBindings()) {
                 final ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding);
                 if (bindingProvider != null) {
-                    // Allow bindings to read properties. Requires PropertyPermission read in security policy. 
-                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                        public Object run() {
-                            bindingProvider.stop();
-                            return null;
-                          }
-                    });                       
+	                try {
+	                    // Allow bindings to read properties. Requires PropertyPermission read in security policy. 
+	                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
+	                        public Object run() {
+	                            bindingProvider.stop();
+	                            return null;
+	                          }
+	                    }); 
+	            	} catch (Throwable ex){
+	            		logger.log(Level.SEVERE, ex.getMessage(), ex);
+	            	}                    
                 }
             }
         }
@@ -758,26 +762,34 @@ public class CompositeActivatorImpl impl
             for (Binding binding : reference.getBindings()) {
                 final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
                 if (bindingProvider != null) {
-                    // Allow bindings to read properties. Requires PropertyPermission read in security policy. 
-                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                        public Object run() {
-                            bindingProvider.stop();
-                            return null;
-                          }
-                    });                       
+	                try {
+	                    // Allow bindings to read properties. Requires PropertyPermission read in security policy. 
+	                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
+	                        public Object run() {
+	                            bindingProvider.stop();
+	                            return null;
+	                          }
+	                    }); 
+	            	} catch (Throwable ex){
+	            		logger.log(Level.SEVERE, ex.getMessage(), ex);
+	            	}                    
                 }
             } 
             
             for (Endpoint endpoint : reference.getEndpoints()) {
                 final EndpointResolver endpointResolver = runtimeRef.getEndpointResolver(endpoint);
                 if (endpointResolver != null) {
-                    // Allow endpoint resolvers to do any shutdown reference manipulation
-                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                        public Object run() {
-                            endpointResolver.stop();
-                            return null;
-                          }
-                    });                       
+	                try {
+	                    // Allow endpoint resolvers to do any shutdown reference manipulation
+	                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
+	                        public Object run() {
+	                            endpointResolver.stop();
+	                            return null;
+	                          }
+	                    }); 
+	            	} catch (Throwable ex){
+	            		logger.log(Level.SEVERE, ex.getMessage(), ex);
+	            	}
                 }
             }             
         }
@@ -787,13 +799,17 @@ public class CompositeActivatorImpl impl
         } else {
             final ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
             if (implementationProvider != null) {
-                // Allow bindings to read properties. Requires PropertyPermission read in security policy. 
-                AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                    public Object run() {
-                        implementationProvider.stop();
-                        return null;
-                      }
-                });                       
+            	try {
+	                // Allow bindings to read properties. Requires PropertyPermission read in security policy. 
+	                AccessController.doPrivileged(new PrivilegedAction<Object>() {
+	                    public Object run() {
+	                        implementationProvider.stop();
+	                        return null;
+	                      }
+	                });  
+	        	} catch (Throwable ex){
+	        		logger.log(Level.SEVERE, ex.getMessage(), ex);
+	        	}
             }
         }
 
@@ -801,7 +817,11 @@ public class CompositeActivatorImpl impl
             ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
             if (runtimeComponent.getScopeContainer() != null && 
             		runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) {
-                runtimeComponent.getScopeContainer().stop();
+            	try {
+            		runtimeComponent.getScopeContainer().stop();
+            	} catch (Throwable ex){
+            		logger.log(Level.SEVERE, ex.getMessage(), ex);
+            	}
             }
         }
 

Modified: tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java?rev=1068894&r1=1068893&r2=1068894&view=diff
==============================================================================
--- tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java (original)
+++ tuscany/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java Wed Feb  9 14:01:46 2011
@@ -40,6 +40,7 @@ public class CompositeScopeContainer<KEY
             try {
                 wrapper.stop();
             } catch (TargetDestructionException e) {
+            	wrapper = null;
                 throw new IllegalStateException(e);
             }
         }