Permalink
Browse files

SMX4NMR-306: Container freezes while installing jbi feature

git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx4/nmr/trunk@1415107 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 5ca2972 commit 2052938cb00f5ca317fd629181f560d3fa500de1 @gertv gertv committed Nov 29, 2012
@@ -29,7 +29,7 @@
/**
* A managed service that will update the configurations based on the ConfigAdmin configuration
*/
-public class ExecutorConfigurator implements ManagedService {
+public class ExecutorConfigurator {
private ExecutorFactoryImpl executorFactory;
@@ -41,14 +41,14 @@ public void setExecutorFactory(ExecutorFactoryImpl factory) {
this.executorFactory = factory;
}
- public void updated(Dictionary properties) throws ConfigurationException {
+ public void update(Map properties) throws ConfigurationException {
if (executorFactory.getDefaultConfig() == null) {
executorFactory.setDefaultConfig(new ExecutorConfig(true, null));
}
Map<String, ExecutorConfig> configs = new HashMap<String, ExecutorConfig>();
if (properties != null) {
- for (Enumeration e = properties.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
+ for (Object keyObject : properties.keySet()) {
+ String key = (String) keyObject;
if (key.endsWith(".corePoolSize")) {
getConfig(configs, key).setCorePoolSize(getInt(properties, key));
} else if (key.endsWith(".maximumPoolSize")) {
@@ -101,15 +101,15 @@ private ExecutorConfig getConfig(Map<String, ExecutorConfig> configs, String key
return config;
}
- private int getInt(Dictionary properties, String key) {
+ private int getInt(Map properties, String key) {
return Integer.parseInt(properties.get(key).toString());
}
- private long getLong(Dictionary properties, String key) {
+ private long getLong(Map properties, String key) {
return Long.parseLong(properties.get(key).toString());
}
- private boolean getBool(Dictionary properties, String key) {
+ private boolean getBool(Map properties, String key) {
return Boolean.parseBoolean(properties.get(key).toString());
}
}
@@ -133,6 +133,12 @@
<service ref="executorFactory" interface="org.apache.servicemix.executors.ExecutorFactory"/>
+ <!-- ExecutorFactory configurer -->
+ <bean id="executorConfigurator" class="org.apache.servicemix.nmr.osgi.ExecutorConfigurator">
+ <cm:managed-properties persistent-id="org.apache.servicemix.nmr"
+ update-strategy="component-managed" update-method="update" />
+ <property name="executorFactory" ref="executorFactory"/>
+ </bean>
<!-- Property place holder -->
<cm:property-placeholder persistent-id="org.apache.servicemix.nmr">
@@ -21,7 +21,7 @@
import org.osgi.service.cm.ConfigurationException;
/**
- * Test cases for {@link org.apache.servicemix.nmr.osgi.ExecutorConfigurator#updated(java.util.Dictionary)}
+ * Test cases for {@link org.apache.servicemix.nmr.osgi.ExecutorConfigurator#update(java.util.Map)}
*/
public class ExecutorConfiguratorTest extends TestCase {
@@ -30,7 +30,7 @@ public void testUpdatedWithNullDictionary() {
configurator.setExecutorFactory(new ExecutorFactoryImpl());
try {
- configurator.updated(null);
+ configurator.update(null);
// this is OK
} catch (Exception e) {
e.printStackTrace();

0 comments on commit 2052938

Please sign in to comment.