Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4585

SCR will create an additional component instance when ComponentContext.enableComponent is called

    XMLWordPrintableJSON

Details

    Description

      In the OSGi CT, the testActivateDeactivate(org.osgi.test.cases.component.junit.DeclarativeServicesControl) method tests that that component activate and deactivate methods are properly called. It uses ComponentContext.disableComponent and enableComponent to cause component instances to be disposed and created.

      If ComponentContext.enableComponent is called on an already enabled component, SCR will improperly create an additional instance of the component.

      See the following log messages:

      org.osgi.test.cases.component.tb6.CcBcMapIntNS110@1048641931 activate
      org.osgi.test.cases.component.tb6.ContExp@339127939 activate
      configuration update org.osgi.test.cases.component.tb6.CcBcMapIntNS110
      configuration updated org.osgi.test.cases.component.tb6.CcBcMapIntNS110
      org.osgi.test.cases.component.tb6.CcBcMapIntNS110@1048641931 deactCcBcMapInt
      org.osgi.test.cases.component.tb6.CcBcMapIntNS110@855459426 activate
      enable org.osgi.test.cases.component.tb6.CcBcMapIntNS110
      enabled org.osgi.test.cases.component.tb6.CcBcMapIntNS110
      org.osgi.test.cases.component.tb6.CcBcMapIntNS110@232400695 activate

      We can see that CcBcMapIntNS110 is activated initially. Then in response to a configuration change, the component instance is deactivated and a new instance it activated. Then ComponentContext.enableComponent is called on the already enabled component and another instance is created in error.

      This error is creating problems passing the OSGi CT.

      Attachments

        Activity

          People

            djencks David Jencks
            bjhargrave BJ Hargrave
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: