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

Jürgen Albert commented on FELIX-6429:
--------------------------------------

I think its easiest to provide the code. This is the offending Class: 
https://gitlab.com/gecko.io/jersey_jaxrs_whiteboard/-/blob/master/org.gecko.rest.jersey/src/org/gecko/rest/jersey/runtime/application/feature/WhiteboardFeature.java

The problem happens in the dipose() method. 

Two things need to be considered: 
* The ServiceObjects may represent a Singleton or a Prototyp Service 
* We dispose our shit async. This means they Service behind the ServiceObjects 
nearly guaranteed already unregistered. 

I see a few flaws in the Code, but I can guarantee two things:
* either the one or the other dispose method will be called and even if, they 
would never be called overlapping (meaning we will never call ungetService 
twice in here for the same Service)
* extension.getProviderObject() always returns the same ServiceObjects instance.

Maybe this helps to clarify things.

> IllegalArgumentException that should not happen
> -----------------------------------------------
>
>                 Key: FELIX-6429
>                 URL: https://issues.apache.org/jira/browse/FELIX-6429
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-7.0.0
>            Reporter: Jürgen Albert
>            Assignee: Karl Pauls
>            Priority: Major
>
> We recently stumbled a couple of times over an IllegalArgumentException when 
> calling ServiceObjects.ungetService. In our case we are always in an async 
> process and the service we are calling unget for ist already unregistered. 
> According to the org.osgi.framework.ServiceObjects Spec the Exception will be 
> thrown under the following circumstances:
> {code:java}
>  @throws IllegalArgumentException If the specified service object is
>        {@code null} or was not provided by a {@code ServiceObjects}
>        object for the associated service.
> {code}
> I can guarantee that both conditions are not meet in our case. It is simply 
> that the service is already unregistered.
> If I read the javadoc correctly it should simply do nothing in such a case. I 
> haven't checked with the Spec though.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to