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

Tuomas Kiviaho closed FELIX-3864.
---------------------------------
    Resolution: Not a Problem

> Synchronized injection
> ----------------------
>
>                 Key: FELIX-3864
>                 URL: https://issues.apache.org/jira/browse/FELIX-3864
>             Project: Felix
>          Issue Type: Improvement
>          Components: Dependency Manager
>    Affects Versions: dependencymanager-3.0.0
>            Reporter: Tuomas Kiviaho
>
> I see myself repeating the following pattern quite often
> {code}
>    @ServiceDependency( removed = "removed", required=true  )
>     synchronized void added(LogService logService )
>     {
>         this.logService = logService;
>     }
>     synchronized void removed(LogService logService )
>     {
>         this.logService = null;
>     }
> {code}
> Would it be possible to get optional synchronization support directly from 
> dependency manager. I noticed that there's a sort of synchronization already 
> taking place at ComponentImpl
> {code}
>   private void configureImplementation(Class clazz, Object instance, String 
> instanceName) {
>   ...
>                                       synchronized (SYNC) {
>                                           field.set(serviceInstance, 
> instance);
>                                       }
> {code}
> I propose adding of 'boolean synchronization default false' attribute to 
> @*Dependency which might contain a notion that this applies only to field 
> injection. If syncronization between component's field injections is not 
> needed then SYNC could be replaced with serviceInstance whenever the 
> attribute is set.



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

Reply via email to