felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jencks (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-4349) Synchronization issue in ComponentRegistry
Date Sun, 08 Dec 2013 20:06:21 GMT

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

David Jencks commented on FELIX-4349:
-------------------------------------

This looks good.  Could I ask what problem this caused?  A concurrent modification exception
or a circular dependency that didn't consistently get eventually resolved (or something else)?

> Synchronization issue in ComponentRegistry
> ------------------------------------------
>
>                 Key: FELIX-4349
>                 URL: https://issues.apache.org/jira/browse/FELIX-4349
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.8.0
>            Reporter: Guillaume Nodet
>             Fix For: scr-1.8.2
>
>
> Investigating an issue in some of our integration test, we found that the ComponentRegistry#m_missingDependencies
field is wrongly synchronized.
> Two methods are accessing this Map, registerMissingDependency and missingServicePresent,
but only the first one is synchronized.
> Patch proposed:
> {code}
> diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
> index 9b307a9..c40ab5f 100644
> --- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
> +++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
> @@ -660,7 +660,7 @@ public class ComponentRegistry implements ScrService, ServiceListener
>          }
>      }
>  
> -    public void missingServicePresent( final ServiceReference serviceReference, ComponentActorThread
actor )
> +    public synchronized void missingServicePresent( final ServiceReference serviceReference,
ComponentActorThread actor )
>      {
>          final List<Entry> dependencyManagers = m_missingDependencies.remove( serviceReference
);
>          if ( dependencyManagers != null )
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message