felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1732934 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
Date Mon, 29 Feb 2016 18:59:24 GMT
Author: djencks
Date: Mon Feb 29 18:59:23 2016
New Revision: 1732934

URL: http://svn.apache.org/viewvc?rev=1732934&view=rev
Log:
FELIX-5202 Improve use of correct bundle based on global extender setting

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

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java?rev=1732934&r1=1732933&r2=1732934&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java Mon Feb 29 18:59:23
2016
@@ -63,9 +63,12 @@ public class Activator extends AbstractE
 
     // this bundle's context
     private static BundleContext m_context;
+    
+    //Either this bundle's context or the framework bundle context, depending on the globalExtender
setting.
+    private BundleContext m_globalContext;
 
     // this bundle
-    private static Bundle m_bundle;
+    private Bundle m_bundle;
 
     // the log service to log messages to
     private static volatile ServiceTracker<LogService, LogService> m_logService;
@@ -112,19 +115,20 @@ public class Activator extends AbstractE
 
     public void restart( boolean globalExtender )
     {
-        BundleContext context;
+    	BundleContext context = m_globalContext;
         if ( globalExtender )
         {
-            context = m_context.getBundle( Constants.SYSTEM_BUNDLE_LOCATION ).getBundleContext();
+        	m_globalContext = m_context.getBundle( Constants.SYSTEM_BUNDLE_LOCATION ).getBundleContext();
         }
         else
         {
-            context = m_context;
+        	m_globalContext = m_context;
         }
         if ( m_packageAdmin != null )
         {
             log( LogService.LOG_INFO, m_bundle, "Stopping to restart with new globalExtender
setting: " + globalExtender, null );
             //this really is a restart, not the initial start
+            // the initial start where m_globalContext is null should skip this as m_packageAdmin
should not yet be set.
             try
             {
                 super.stop(context);
@@ -137,7 +141,7 @@ public class Activator extends AbstractE
         try
         {
             log( LogService.LOG_INFO, m_bundle, "Starting with globalExtender setting: "
+ globalExtender, null );
-            super.start( context );
+            super.start( m_globalContext );
         }
         catch ( Exception e )
         {
@@ -153,7 +157,7 @@ public class Activator extends AbstractE
         m_componentBundles = new HashMap<Long, BundleComponentActivator>();
         m_componentRegistry = new ComponentRegistry( );
 
-        final ServiceComponentRuntime runtime = new ServiceComponentRuntimeImpl(m_context,
m_componentRegistry);
+        final ServiceComponentRuntime runtime = new ServiceComponentRuntimeImpl(m_globalContext,
m_componentRegistry);
         m_runtime_reg = m_context.registerService(ServiceComponentRuntime.class,
                 runtime, null);
 
@@ -474,7 +478,7 @@ public class Activator extends AbstractE
      * @param message The message to log
      * @param ex An optional <code>Throwable</code> whose stack trace is written,
      *      or <code>null</code> to not log a stack trace.
-     */
+     */ 
     public static void log( int level, Bundle bundle, String message, Throwable ex )
     {
         if ( isLogEnabled( level ) )



Mime
View raw message