felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tuomas Kiviaho (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-3864) Synchronized injection
Date Wed, 23 Jan 2013 10:02:12 GMT
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

   @ServiceDependency( removed = "removed", required=true  )
    synchronized void added(LogService logService )
        this.logService = logService;

    synchronized void removed(LogService logService )
        this.logService = null;

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

  private void configureImplementation(Class clazz, Object instance, String instanceName)
		                        synchronized (SYNC) {
		                            field.set(serviceInstance, instance);

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

View raw message