You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2009/02/06 15:47:20 UTC
svn commit: r741578 -
/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
Author: fmeschbe
Date: Fri Feb 6 14:47:19 2009
New Revision: 741578
URL: http://svn.apache.org/viewvc?rev=741578&view=rev
Log:
FELIX-714 Prevent cycling of components if there is no configuration
change in the reconfigure method
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java?rev=741578&r1=741577&r2=741578&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java Fri Feb 6 14:47:19 2009
@@ -21,7 +21,10 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.*;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -330,8 +333,6 @@
public Dictionary getProperties()
{
- // TODO: Currently on ManagedService style configuration is supported, ManagedServiceFactory style is missing
-
if ( m_properties == null )
{
@@ -370,6 +371,14 @@
/**
* Called by the Configuration Admin Service to update the component with
* Configuration properties.
+ * <p>
+ * This causes the component to be reactivated with the new configuration
+ * unless no configuration has ever been set on this component and the
+ * <code>configuration</code> parameter is <code>null</code>. In this case
+ * nothing is to be done. If a configuration has previously been set and
+ * now the configuration is deleted, the <code>configuration</code>
+ * parameter is <code>null</code> and the component has to be reactivated
+ * with the default configuration.
*
* @param configuration The configuration properties for the component from
* the Configuration Admin Service or <code>null</code> if there is
@@ -377,6 +386,14 @@
*/
public void reconfigure( Dictionary configuration )
{
+ // nothing to do if there is no configuration (see FELIX-714)
+ if ( configuration == null && m_configurationProperties == null )
+ {
+ log( LogService.LOG_DEBUG, "No configuration provided (or deleted), nothing to do", getComponentMetadata(),
+ null );
+ return;
+ }
+
// store the properties
m_configurationProperties = configuration;