mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-1738 : Adding code for StatsCollector initialization using spring framework. This was not initialized and hence stats were not colleced on vm, host and storage in CS.
This commit is contained in:
parent
65cc29734a
commit
cfff6708f3
|
|
@ -27,8 +27,10 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -89,6 +91,7 @@ public class StatsCollector {
|
|||
@Inject private StoragePoolHostDao _storagePoolHostDao;
|
||||
@Inject private SecondaryStorageVmManager _ssvmMgr;
|
||||
@Inject private ResourceManager _resourceMgr;
|
||||
@Inject private ConfigurationDao _configDao;
|
||||
|
||||
private ConcurrentHashMap<Long, HostStats> _hostStats = new ConcurrentHashMap<Long, HostStats>();
|
||||
private final ConcurrentHashMap<Long, VmStats> _VmStats = new ConcurrentHashMap<Long, VmStats>();
|
||||
|
|
@ -108,6 +111,7 @@ public class StatsCollector {
|
|||
}
|
||||
|
||||
public static StatsCollector getInstance(Map<String, String> configs) {
|
||||
s_instance.init(configs);
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +119,11 @@ public class StatsCollector {
|
|||
s_instance = this;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init(){
|
||||
init(_configDao.getConfiguration());
|
||||
}
|
||||
|
||||
private void init(Map<String, String> configs) {
|
||||
_executor = Executors.newScheduledThreadPool(3, new NamedThreadFactory("StatsCollector"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue