title: Felix: deployed bundle starts twice
body: <p>I'm deploying with Maven (but same issue with Felix web console) and the maven-sling-plugin and I see it starts twice:</p>
  
  <pre><code>*INFO* [qtp1462409406-40] logs/access.log 127.0.0.1 - admin 25/Feb/2016:11:18:31 +0100 "POST /dev/system/console/install HTTP/1.1" 200 - "-" "Jakarta Commons-HttpClient/3.1"
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content BundleEvent INSTALLED
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content BundleEvent RESOLVED
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content BundleEvent STARTING
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content BundleEvent STARTED
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content Service [com.as.test.jcr.service.NodeFinderImpl,374] ServiceEvent REGISTERED
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content Service [com.as.test.jcr.service.NodeSorterImpl,375] ServiceEvent REGISTERED
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install2994913564032148892.tmp] com.as.test.content Service [com.as.test.jcr.service.UserProcessorImpl,376] ServiceEvent REGISTERED
  
  ====&gt; Starts executing code: creates users, sets permissions and sort nodes with the JCR API
  [...]
  *ERROR* [pool-7-thread-1] com.as.test.content [com.as.test.jcr.service.ContentInitializerImpl(173)] Failed creating the component instance; see log for reason
  *INFO* [FelixFrameworkWiring] com.as.test.content BundleEvent STOPPING
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.ContentInitializerImpl,383] ServiceEvent UNREGISTERING
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.NodeSorterImpl,375] ServiceEvent UNREGISTERING
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.UserProcessorImpl,376] ServiceEvent UNREGISTERING
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.NodeFinderImpl,374] ServiceEvent UNREGISTERING
  *INFO* [FelixFrameworkWiring] com.as.test.content BundleEvent STOPPED
  *INFO* [FelixFrameworkWiring] com.as.test.content BundleEvent UNRESOLVED
  *INFO* [FelixFrameworkWiring] com.as.test.content BundleEvent RESOLVED
  *INFO* [FelixFrameworkWiring] com.as.test.content BundleEvent STARTING
  *INFO* [FelixFrameworkWiring] org.apache.sling.jcr.contentloader.internal.Loader Content of bundle already loaded com.as.test.content.
  *INFO* [FelixFrameworkWiring] com.as.test.content BundleEvent STARTED
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.NodeFinderImpl,384] ServiceEvent REGISTERED
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.NodeSorterImpl,385] ServiceEvent REGISTERED
  *INFO* [FelixFrameworkWiring] com.as.test.content Service [com.as.test.jcr.service.ContentInitializerImpl,387] ServiceEvent REGISTERED
  *INFO* [FelixFrameworkWiring] com.as.test.jcr.service.ContentInitializerImpl Initializing Sling content
  ====&gt; Starts (again) executing code: creates users, sets permissions and sort nodes with the JCR API
  </code></pre>
  
  <p>I'm executing some code on bundle's startup and it gets stopped in the middle of it, and then restarted, and I can't find why.</p>
  
  <p>I've tried with Sling launchpad 7 and 8, respectively using org.apache.felix.framework 4.4.1 and 5.2.0</p>
  
  <p>EDIT: stacktraces</p>
  
  <pre><code>1. Starts from background install
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   java.lang.Thread.getAllStackTraces(Thread.java:1640)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   com.as.test.Activator.printStrackTraces(Activator.java:33)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   com.as.test.Activator.start(Activator.java:23)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.framework.Felix.activateBundle(Felix.java:2154)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.framework.Felix.startBundle(Felix.java:2072)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.framework.BundleImpl.start(BundleImpl.java:963)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.webconsole.internal.core.InstallHelper.doRun(InstallHelper.java:67)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.doRun(    BaseUpdateInstallHelper.java:89)
  *INFO* [Background Install /var/folders/v0/gh9_k3ld5vx43sn057mg6h3c0000gn/T/install3836459285044407564.tmp] com.as.test.Activator   org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.run(    BaseUpdateInstallHelper.java:121)
  
  2. Stops from FelixFrameworkWiring
  *INFO* [FelixFrameworkWiring] com.as.test.Activator THREAD: Thread[FelixFrameworkWiring,5,main]
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   java.lang.Thread.dumpThreads(Native Method)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   java.lang.Thread.getAllStackTraces(Thread.java:1640)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   com.as.test.Activator.printStrackTraces(Activator.java:33)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   com.as.test.Activator.start(Activator.java:23)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix.activateBundle(Felix.java:2154)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix.startBundle(Felix.java:2072)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix$RefreshHelper.restart(Felix.java:4911)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix.refreshPackages(Felix.java:4148)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.FrameworkWiringImpl.run(FrameworkWiringImpl.java:178)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   java.lang.Thread.run(Thread.java:745)
  
  3. Restarts from FelixFrameworkWiring
  *INFO* [FelixFrameworkWiring] com.as.test.Activator THREAD: Thread[FelixFrameworkWiring,5,main]
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   java.lang.Thread.dumpThreads(Native Method)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   java.lang.Thread.getAllStackTraces(Thread.java:1640)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   com.as.test.Activator.printStrackTraces(Activator.java:33)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   com.as.test.Activator.start(Activator.java:23)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix.activateBundle(Felix.java:2154)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix.startBundle(Felix.java:2072)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix$RefreshHelper.restart(Felix.java:4911)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.Felix.refreshPackages(Felix.java:4148)
  *INFO* [FelixFrameworkWiring] com.as.test.Activator   org.apache.felix.framework.FrameworkWiringImpl.run(FrameworkWiringImpl.java:178)    
  </code></pre>