mirror of https://github.com/apache/cloudstack.git
Fix the initialization of management server
This commit is contained in:
parent
0f5c5c2078
commit
45a92ba369
|
|
@ -58,7 +58,7 @@ public class DataStoreProviderManagerImpl implements DataStoreProviderManager {
|
|||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
|
||||
|
||||
/*
|
||||
//TODO: hold global lock
|
||||
List<DataStoreProviderVO> providerVos = providerDao.listAll();
|
||||
for (DataStoreProvider provider : providers) {
|
||||
|
|
@ -86,7 +86,7 @@ public class DataStoreProviderManagerImpl implements DataStoreProviderManager {
|
|||
provider.configure(params);
|
||||
providerMap.put(uuid, provider);
|
||||
}
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,8 +206,7 @@ NiciraNvpElementService, ResourceStateAdapter, IpDeployer {
|
|||
public boolean configure(String name, Map<String, Object> params)
|
||||
throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
_resourceMgr.registerResourceStateAdapter(this.getClass()
|
||||
.getSimpleName(), this);
|
||||
_resourceMgr.registerResourceStateAdapter(name, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -392,6 +392,4 @@ Listener, ResourceStateAdapter {
|
|||
_resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName());
|
||||
return super.stop();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@
|
|||
package com.cloud.utils.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -51,24 +50,22 @@ import com.cloud.utils.db.TransactionContextBuilder;
|
|||
public class ComponentContext implements ApplicationContextAware {
|
||||
private static final Logger s_logger = Logger.getLogger(ComponentContext.class);
|
||||
|
||||
private static ApplicationContext s_appContext;
|
||||
private static ApplicationContext s_appContext;
|
||||
|
||||
@Inject List<GenericDao> daos;
|
||||
@Inject List<Manager> mgrs;
|
||||
@Inject List<Adapter> adapters;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
s_appContext = applicationContext;
|
||||
s_appContext = applicationContext;
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return s_appContext;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void initComponentsLifeCycle() {
|
||||
@SuppressWarnings("rawtype")
|
||||
Collection<GenericDao> daos = ComponentContext.getApplicationContext().getBeansOfType(GenericDao.class).values();
|
||||
Collection<Manager> mgrs = ComponentContext.getApplicationContext().getBeansOfType(Manager.class).values();
|
||||
Collection<Adapter> adapters = ComponentContext.getApplicationContext().getBeansOfType(Adapter.class).values();
|
||||
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
for (GenericDao dao : daos) {
|
||||
try {
|
||||
|
|
@ -80,7 +77,7 @@ public class ComponentContext implements ApplicationContextAware {
|
|||
}
|
||||
}
|
||||
|
||||
List<String> avoidMap = new ArrayList<String>();
|
||||
List<String> avoidMap = new ArrayList<String>();
|
||||
for (Manager manager : mgrs) {
|
||||
if (avoidMap.contains(manager.getName())) {
|
||||
s_logger.info("Skip manager: " + ComponentContext.getTargetClass(manager).getName() + " as it is already started");
|
||||
|
|
|
|||
Loading…
Reference in New Issue