You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Ron Koerner (JIRA)" <ji...@apache.org> on 2009/04/30 19:16:31 UTC

[jira] Created: (FELIX-1114) callback after configuration change needed

callback after configuration change needed
------------------------------------------

                 Key: FELIX-1114
                 URL: https://issues.apache.org/jira/browse/FELIX-1114
             Project: Felix
          Issue Type: Improvement
          Components: iPOJO
    Affects Versions: iPOJO-1.2.0
            Reporter: Ron Koerner


It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.

Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like

@Property(name="port")
public void setPort(String port)
{
   incomingSocket.close();
   incomingSocket=new IncomingSocket(port);
}

because that is costly and leaves the possibility to have things written to the wrong file.

Therefore something like

@Updated
public void updatedConfiguration()
{
  // put changed configuration in use
}

is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.

Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on FELIX-1114 started by Clement Escoffier.

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (FELIX-1114) callback after configuration change needed

Posted by "Ron Koerner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Koerner reopened FELIX-1114:
--------------------------------


It seems my problem was the old ant task. After proper reloading my application works as expected.
Well, nearly. I'm using FileInstall/ConfigAdmin to reconfigure my services and unfortunately there seems to be no link between the reconfigure() and updated() methods of ConfigurationHandler. Therefore a reconfigure() triggers the callback, but updated() does not. Since ConfigAdmin updates invoke updated(), but not reconfigure(), no callback is triggered in this case. 

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier updated FELIX-1114:
-------------------------------------


Hi,

How do you know that the class is no more loaded ? 
In fact, except if you use the online manipulator, annotations are processed offline. So, this does not impact the classloading. 

I might be related to the "lazzy-policy" of the feature. If a reconfiguration occurs and no pojo object is already created, it waits until a pojo object is created to call the updated method. To force the creation of a pojo object, declare your component as immediate (@Component(immediate=true)). 

You can also use "arch". arch is a simple Felix command (it also exists for Equinox) that introspects current iPOJO instances and dump their state [http://felix.apache.org/site/ipojo-arch-command.html]. If you can get the architecture/state of the instance using the @Updated, it could definitely help to debug it.

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1114) callback after configuration change needed

Posted by "Ron Koerner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12705529#action_12705529 ] 

Ron Koerner commented on FELIX-1114:
------------------------------------

Hi Clement,

I'm very impressed about your response and implementation speed.

Unfortunately I have a problem to use the new feature. As soon as I add the annotation the class seems not to be loaded anymore.
I'm quite new to OSGi and may not have found all the debug switches, but right now I can't see any errors anywhere. Actually I don't see any OSGi framework-level errors at all, so I always have to guess why a class was not loaded. Since I'm not using BND yet, I usually forget an import in the manifest.

I'd be grateful for a hint on how to improve my debugging.

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier resolved FELIX-1114.
--------------------------------------

    Resolution: Fixed

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier resolved FELIX-1114.
--------------------------------------

    Resolution: Fixed

Fixed in revision 770759.

Provides a 'updated' attribute in 'Properties' specifying a method called when a reconfiguration is completed:
<properties updated="afterReconfiguration">
    <property ...>
</properties>

The specified method receives a Dictionary containing the <key,value> pairs

Provides the associated annotation:
@Updated
public void afterReconfiguration(Dictionary conf) {
    ...
}

Extend the API to support the 'updated' attribute (setUpdatedMethod(String method))

Add test checking the 'updated' attribute behavior on simple properties, ManagedService reconfiguration and ManagedServiceFactory reconfiguration.


Please check, and write a comment if it works as you expect.

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier updated FELIX-1114:
-------------------------------------

              Assignee: Clement Escoffier
    Remaining Estimate: 0h
     Original Estimate: 0h

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1114) callback after configuration change needed

Posted by "Ron Koerner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704716#action_12704716 ] 

Ron Koerner commented on FELIX-1114:
------------------------------------

Since I desperately need something like this, I'll provide a patch next week (unless someone tells me how to do it on another way).

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier updated FELIX-1114:
-------------------------------------

    Fix Version/s: iPOJO-1.4.0

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier updated FELIX-1114:
-------------------------------------


You're absolutely right. I forget one method !

My tests didn't check that case. I just create a test case and will fix it right now.

Thanks.

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704909#action_12704909 ] 

Clement Escoffier commented on FELIX-1114:
------------------------------------------

Hi, 

There is not such method right now. But for the time being you can inject your properties inside a Dictionary or a Map. The setter method of this property will be called when a reconfiguration occurs. 
However this solution does not work with the configuration admin as config admin's configuration does not support map/dictionary properties.

I agree that such kind of method can be useful. But a couple of questions need to be answered before:

1) What kind of argument do you need in the updated method ? It will makes sense to push all the properties like:
@Updated
public void updatedConfiguration(Dictionary properties)
{
  // put changed configuration in use
}

2) Should this method be called at each configuration and reconfiguration (so, both at the beginning and at each reconfiguration) ? 


IMHO, such method must not create a POJO object if none exist, so it means that the method will be called after every configuration/reconfiguration only if a pojo object exist or wait for an object creation (and then be called ).

Clement


> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1114) callback after configuration change needed

Posted by "Clement Escoffier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier updated FELIX-1114:
-------------------------------------


Fixed at the revision 771293.

This second fix supports ManagedService. 
Can you try it ?

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1114) callback after configuration change needed

Posted by "Ron Koerner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12705549#action_12705549 ] 

Ron Koerner commented on FELIX-1114:
------------------------------------

It may be related to the fact that I used the ant task from 1.2.0... I got it running with a minimal test, but not yet with the real application.
I'll keep you updated.



> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1114) callback after configuration change needed

Posted by "Ron Koerner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12705583#action_12705583 ] 

Ron Koerner commented on FELIX-1114:
------------------------------------

Works like a charm. Thank you very much.

Schoene Gruesse aus Paderborn

> callback after configuration change needed
> ------------------------------------------
>
>                 Key: FELIX-1114
>                 URL: https://issues.apache.org/jira/browse/FELIX-1114
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.2.0
>            Reporter: Ron Koerner
>            Assignee: Clement Escoffier
>             Fix For: iPOJO-1.4.0
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> It often occurs that a configuration/property change requires some work to be done. If only a single property is affected method injection can be used.
> If multiple properties are changed and these changes are kind of an atomic transaction, there is no (sensible) way to tell the service to use the new values.
> Imagine a service listening on a port and writing the output to a file. The service has the two string properties "port" and "file". When the service is validated, it opens a listening port and a writable file according to the properties. Now imagine it is either dangerous to have a port input written to the wrong file or opening ports and files is very costly or there is already an object doing the work for us but it needs to be constructed with port number and filename and cannot be changed at runtime. Therefore we cannot use method injection like
> @Property(name="port")
> public void setPort(String port)
> {
>    incomingSocket.close();
>    incomingSocket=new IncomingSocket(port);
> }
> because that is costly and leaves the possibility to have things written to the wrong file.
> Therefore something like
> @Updated
> public void updatedConfiguration()
> {
>   // put changed configuration in use
> }
> is needed. The method annotated with @Updated (or specified in XML) is to called after all the configuration changes are done.
> Right now, the only way is to stop and start the service since only one ManagedService per PID is recognized by ConfigurationAdmin.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.