Tuomas Kiviaho created FELIX-3864: ------------------------------------- Summary: 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 is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira