Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7249BF9FE for ; Thu, 21 Mar 2013 01:04:21 +0000 (UTC) Received: (qmail 83465 invoked by uid 500); 21 Mar 2013 01:04:17 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 83411 invoked by uid 500); 21 Mar 2013 01:04:17 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 83289 invoked by uid 99); 21 Mar 2013 01:04:17 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Mar 2013 01:04:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D58503EA55; Thu, 21 Mar 2013 01:04:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: cloudstack-commits@incubator.apache.org Date: Thu, 21 Mar 2013 01:04:33 -0000 Message-Id: <94f46d756ca14b898be0459a189d64a6@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [19/25] git commit: refs/heads/api_entity - 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. 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. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/3e68dd81 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3e68dd81 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3e68dd81 Branch: refs/heads/api_entity Commit: 3e68dd810e0d4df5213dd921f4b703befec55ecd Parents: 873ec27 Author: Nitin Mehta Authored: Wed Mar 20 16:44:44 2013 +0530 Committer: Nitin Mehta Committed: Wed Mar 20 16:44:44 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/server/StatsCollector.java | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e68dd81/server/src/com/cloud/server/StatsCollector.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index 76bae5b..7dcf091 100755 --- a/server/src/com/cloud/server/StatsCollector.java +++ b/server/src/com/cloud/server/StatsCollector.java @@ -27,10 +27,15 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; + +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.resource.ResourceManager; + import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -88,6 +93,7 @@ public class StatsCollector { @Inject private StoragePoolHostDao _storagePoolHostDao; @Inject private SecondaryStorageVmManager _ssvmMgr; @Inject private ResourceManager _resourceMgr; + @Inject private ConfigurationDao _configDao; private ConcurrentHashMap _hostStats = new ConcurrentHashMap(); private final ConcurrentHashMap _VmStats = new ConcurrentHashMap(); @@ -107,6 +113,7 @@ public class StatsCollector { } public static StatsCollector getInstance(Map configs) { + s_instance.init(configs); return s_instance; } @@ -114,6 +121,11 @@ public class StatsCollector { s_instance = this; } + @PostConstruct + private void init(){ + init(_configDao.getConfiguration()); + } + private void init(Map configs) { _executor = Executors.newScheduledThreadPool(3, new NamedThreadFactory("StatsCollector"));