felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r831390 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
Date Fri, 30 Oct 2009 17:08:19 GMT
Author: fmeschbe
Date: Fri Oct 30 17:08:19 2009
New Revision: 831390

URL: http://svn.apache.org/viewvc?rev=831390&view=rev
Log:
FELIX-1832 Instead of deactivating in case of instantiation failure just
ensure the instance is deleted and remain in the Registered state. It may
not be possible to unregister the factory service in this situation.

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java?rev=831390&r1=831389&r2=831390&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
Fri Oct 30 17:08:19 2009
@@ -419,13 +419,14 @@
 
         if ( m_serviceRegistration != null )
         {
-            log( LogService.LOG_DEBUG, "unregistering the services", null );
+            log( LogService.LOG_DEBUG, "Unregistering the services", null );
 
             m_serviceRegistration.unregister();
             m_serviceRegistration = null;
         }
     }
 
+
     //**********************************************************************************************************
     public BundleComponentActivator getActivator()
     {
@@ -1120,7 +1121,19 @@
                 return dcm.getInstance();
             }
 
-            super.deactivate( dcm, ComponentConstants.DEACTIVATION_REASON_UNSPECIFIED );
+            // component could not really be created. This may be temporary
+            // so we stay in the registered state but ensure the component
+            // instance is deleted
+            try
+            {
+                dcm.deleteComponent( ComponentConstants.DEACTIVATION_REASON_UNSPECIFIED );
+            }
+            catch ( Throwable t )
+            {
+                dcm.log( LogService.LOG_DEBUG, "Cannot delete incomplete component instance.
Ignoring.", t );
+            }
+
+            // no service can be returned (be prepared for more logging !!)
             return null;
         }
     }



Mime
View raw message