You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2010/08/25 19:16:19 UTC
svn commit: r989232 - in /felix/trunk/eventadmin/impl: DEPENDENCIES pom.xml
src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
Author: cziegeler
Date: Wed Aug 25 17:16:18 2010
New Revision: 989232
URL: http://svn.apache.org/viewvc?rev=989232&view=rev
Log:
FELIX-2431 : EventAdmin service unregistered but not registered again on ConfigAdmin startup
Added:
felix/trunk/eventadmin/impl/DEPENDENCIES
Modified:
felix/trunk/eventadmin/impl/pom.xml
felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
Added: felix/trunk/eventadmin/impl/DEPENDENCIES
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/DEPENDENCIES?rev=989232&view=auto
==============================================================================
--- felix/trunk/eventadmin/impl/DEPENDENCIES (added)
+++ felix/trunk/eventadmin/impl/DEPENDENCIES Wed Aug 25 17:16:18 2010
@@ -0,0 +1,36 @@
+Apache Felix Event Admin
+Copyright 2006-2010 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2009).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Sun Microsystems, Inc.
+Copyright (c) 1994-2000.
+Licensed under a BSD license.
+
+
+II. Used Software
+
+This product uses software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2009).
+Licensed under the Apache License 2.0.
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
Modified: felix/trunk/eventadmin/impl/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/pom.xml?rev=989232&r1=989231&r2=989232&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/pom.xml (original)
+++ felix/trunk/eventadmin/impl/pom.xml Wed Aug 25 17:16:18 2010
@@ -49,6 +49,20 @@
</dependency>
</dependencies>
<build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ </resource>
+ <resource>
+ <targetPath>META-INF</targetPath>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>LICENSE*</include>
+ <include>NOTICE</include>
+ <include>DEPENDENCIES</include>
+ </includes>
+ </resource>
+ </resources>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java?rev=989232&r1=989231&r2=989232&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java Wed Aug 25 17:16:18 2010
@@ -156,11 +156,9 @@ public class Configuration
{
Object service = new ManagedService()
{
- public synchronized void updated( Dictionary properties ) throws ConfigurationException
+ public void updated( Dictionary properties ) throws ConfigurationException
{
- configure( properties );
- stop();
- start();
+ updateFromConfigAdmin(properties);
}
};
// add meta type provider if interfaces are available
@@ -185,6 +183,43 @@ public class Configuration
}
}
+ void updateFromConfigAdmin(final Dictionary config)
+ {
+ // do this in the background as we don't want to stop
+ // the config admin
+ new Thread()
+ {
+
+ public void run()
+ {
+ final ThreadPool aSyncPool;
+ final ThreadPool syncPool;
+ synchronized ( Configuration.this )
+ {
+ // we will shutdown the pools later
+ // to make the downtime as small as possible
+ aSyncPool = m_async_pool;
+ m_async_pool = null;
+ syncPool = m_sync_pool;
+ m_sync_pool = null;
+ Configuration.this.stop();
+ Configuration.this.configure( config );
+ Configuration.this.start();
+ }
+ if (aSyncPool != null )
+ {
+ aSyncPool.close();
+ }
+ if ( syncPool != null )
+ {
+ syncPool.close();
+ }
+ }
+
+ }.start();
+
+ }
+
/**
* Configures this instance.
*/
@@ -262,7 +297,7 @@ public class Configuration
}
}
- public synchronized void start()
+ private void start()
{
LogWrapper.getLogger().log(LogWrapper.LOG_DEBUG,
PROP_CACHE_SIZE + "=" + m_cacheSize);
@@ -320,9 +355,9 @@ public class Configuration
}
/**
- * Called to stop the event admin and restart it.
+ * Called to stop the event admin.
*/
- public synchronized void stop()
+ private void stop()
{
// We need to unregister manually
if ( m_registration != null )
@@ -335,7 +370,7 @@ public class Configuration
m_admin.stop();
m_admin = null;
}
- if ( m_async_pool != null )
+ if (m_async_pool != null )
{
m_async_pool.close();
m_async_pool = null;
@@ -354,20 +389,24 @@ public class Configuration
* down which is somewhat cumbersome given that the spec asks for return in
* a timely manner.
*/
- public synchronized void destroy()
+ public void destroy()
{
- if ( m_adapters != null )
+ synchronized ( this )
{
- for(int i=0;i<m_adapters.length;i++)
+ if ( m_adapters != null )
+ {
+ for(int i=0;i<m_adapters.length;i++)
+ {
+ m_adapters[i].destroy(m_bundleContext);
+ }
+ m_adapters = null;
+ }
+ if ( m_managedServiceReg != null )
{
- m_adapters[i].destroy(m_bundleContext);
+ m_managedServiceReg.unregister();
+ m_managedServiceReg = null;
}
- m_adapters = null;
- }
- if ( m_managedServiceReg != null )
- {
- m_managedServiceReg.unregister();
- m_managedServiceReg = null;
+ stop();
}
}