[ 
https://issues.apache.org/jira/browse/ARIES-1407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15561777#comment-15561777
 ] 

Grzegorz Grzybek commented on ARIES-1407:
-----------------------------------------

If you run {{org.apache.aries.blueprint.itests.BlueprintContainerTest#test()}} 
you should see:
{noformat}
...
Bundle start
======== Initializing Foo =========
Service registration notification: 5 10 4474039: Hello FooBar 
org.eclipse.osgi.framework.internal.core.BundleContextImpl@7cf1c94e [a list 
element, 5] PLN Fri Apr 17 00:00:00 CEST 2009 
{osgi.service.blueprint.compname=foo, key=value}
[main] INFO org.apache.aries.blueprint.container.BlueprintExtender - Destroying 
BlueprintContainer for bundle org.apache.aries.blueprint.sample/1.0.1.SNAPSHOT
Service unregistration notification: 5 10 4474039: Hello FooBar 
org.eclipse.osgi.framework.internal.core.BundleContextImpl@7cf1c94e [a list 
element, 5] PLN Fri Apr 17 00:00:00 CEST 2009 
{osgi.service.blueprint.compname=foo, key=value}
======== Destroying Foo =========
Bundle stop
...
{noformat}

Registration listener is called at this point:
{noformat}
"main@1" prio=5 tid=0x1 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
          at 
org.apache.aries.blueprint.sample.FooRegistrationListener.serviceRegistered(FooRegistrationListener.java:29)
          at 
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
          at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at 
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)
          at 
org.apache.aries.blueprint.utils.ServiceListener.invokeMethod(ServiceListener.java:97)
          at 
org.apache.aries.blueprint.utils.ServiceListener.register(ServiceListener.java:59)
          at 
org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:329)
          at 
org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:252)
          at 
org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:365)
          at 
org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:541)
          at 
org.eclipse.osgi.internal.serviceregistry.ServiceUse$1.run(ServiceUse.java:141)
          at 
java.security.AccessController.doPrivileged(AccessController.java:-1)
          at 
org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(ServiceUse.java:139)
          at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:468)
          - locked <0xcc0> (a 
org.eclipse.osgi.internal.serviceregistry.ServiceUse)
          at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:467)
          at 
org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(BundleContextImpl.java:594)
          at 
org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:411)
          at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)
          at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
          at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
          at 
org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
          at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:317)
          at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
          at 
org.apache.aries.itest.RichBundleContext.getService(RichBundleContext.java:81)
          at 
org.apache.aries.itest.RichBundleContext.getService(RichBundleContext.java:55)
          at 
org.apache.aries.blueprint.itests.Helper.testBlueprintContainer(Helper.java:104)
          at 
org.apache.aries.blueprint.itests.BlueprintContainerTest.test(BlueprintContainerTest.java:38)
          at 
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
          at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
          at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
          at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
          at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
          at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
          at 
org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:68)
          at 
org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:37)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
          at 
org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:124)
          at 
org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:97)
          at 
org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73)
          at 
org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:109)
          - locked <0xbc6> (a 
org.ops4j.pax.exam.nat.internal.NativeTestContainer)
          at 
org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:109)
          at 
org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:267)
          at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
          at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
          at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98)
          at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
          at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:43)
          at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:239)
          at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
{noformat}

The blueprint XML is:
{code:xml}
...
<service ref="foo" auto-export="all-classes">
        <service-properties>
                <entry key="key" value="value" />
        </service-properties>
        <registration-listener ref="fooRegistrationListener"
                registration-method="serviceRegistered" 
unregistration-method="serviceUnregistered" />
</service>
<bean id="fooRegistrationListener"
        class="org.apache.aries.blueprint.sample.FooRegistrationListener" />
...
{code}

Do you have a test case, sample blueprint XML file that shows that registration 
listeners *aren't* called?


> Service (un)registration listener not called anymore
> ----------------------------------------------------
>
>                 Key: ARIES-1407
>                 URL: https://issues.apache.org/jira/browse/ARIES-1407
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>         Environment: Servicemix 5.4.1
>            Reporter: metatech
>         Attachments: blueprint_registration_listener_fix_v2.patch
>
>
> Service (un)registration listeners are not called anymore since Blueprint 
> 1.4.0.
> There are 2 booleans in the "ServiceRecipe" class which are tested against 
> the wrong values.
> Please find a patch which makes them work again with Blueprint 1.4.3.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to