You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jamie goodyear (JIRA)" <ji...@apache.org> on 2011/07/12 15:45:00 UTC

[jira] [Closed] (KARAF-136) should override equals method for FeaturesListener to handle the proxy compared to wrapped object case

     [ https://issues.apache.org/jira/browse/KARAF-136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jamie goodyear closed KARAF-136.
--------------------------------


> should override equals method for FeaturesListener to handle the proxy compared to wrapped object case
> ------------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-136
>                 URL: https://issues.apache.org/jira/browse/KARAF-136
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>             Fix For: 2.1.0
>
>
> When I shutdown the karaf, I always get exception like
> org.osgi.service.blueprint.container.ServiceUnavailableException: Service is unavailable
> 	at org.apache.aries.blueprint.container.ReferenceListRecipe$ServiceDispatcher.call(ReferenceListRecipe.java:201)
> 	at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$JdkProxyFactory$1.invoke(AbstractServiceReferenceRecipe.java:632)
> 	at $Proxy12.repositoryEvent(Unknown Source)
> 	at org.apache.karaf.features.internal.FeaturesServiceImpl.callListeners(FeaturesServiceImpl.java:939)
> 	at org.apache.karaf.features.internal.FeaturesServiceImpl.internalRemoveRepository(FeaturesServiceImpl.java:186)
> 	at org.apache.karaf.features.internal.FeaturesServiceImpl.stop(FeaturesServiceImpl.java:777)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_13]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_13]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_13]
> 	at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_13]
> 	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:230)[7:org.apache.aries.blueprint:0.1.0.r964701]
> 	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:854)[7:org.apache.aries.blueprint:0.1.0.r964701]
> 	at org.apache.aries.blueprint.container.BeanRecipe.destroy(BeanRecipe.java:761)[7:org.apache.aries.blueprint:0.1.0.r964701]
> 	at org.apache.aries.blueprint.container.BlueprintRepository.destroy(BlueprintRepository.java:295)[7:org.apache.aries.blueprint:0.1.0.r964701]
> But in FeaturesServiceImpl, if the FeaturesListener gone, it should invoke unregisterListener() mothed, so we shouldn't get this exception at all.
> After investigating this issue, I found that the unregisterListener() mothed get invoked, but the  listeners.remove(listener); doesn't work even the listener actually is in the ListenerList.
> The problem comes from that the aries blueprint container use DynamicProxy to inject the OSGi service, so we run into a well known issue about Proxy compare to wrapped object, here is a good article[1] about this issue, we just need  override equals method for FeaturesListener to handle this case.
> [1]http://www.javaspecialists.eu/archive/Issue126.html 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira