|
32 | 32 | import com.cloud.resource.ResourceManager; |
33 | 33 |
|
34 | 34 | import org.apache.log4j.Logger; |
| 35 | +import org.springframework.stereotype.Component; |
35 | 36 |
|
36 | 37 | import com.cloud.agent.AgentManager; |
37 | 38 | import com.cloud.agent.AgentManager.OnError; |
|
60 | 61 | import com.cloud.storage.dao.VolumeDao; |
61 | 62 | import com.cloud.storage.secondary.SecondaryStorageVmManager; |
62 | 63 | import com.cloud.utils.NumbersUtil; |
63 | | -import com.cloud.utils.component.ComponentContext; |
64 | | -import com.cloud.utils.component.ComponentLocator; |
65 | 64 | import com.cloud.utils.concurrency.NamedThreadFactory; |
66 | 65 | import com.cloud.utils.db.SearchCriteria; |
67 | 66 | import com.cloud.vm.UserVmManager; |
|
73 | 72 | * Provides real time stats for various agent resources up to x seconds |
74 | 73 | * |
75 | 74 | */ |
| 75 | +@Component |
76 | 76 | public class StatsCollector { |
77 | 77 | public static final Logger s_logger = Logger.getLogger(StatsCollector.class.getName()); |
78 | 78 |
|
@@ -106,18 +106,13 @@ public class StatsCollector { |
106 | 106 | public static StatsCollector getInstance() { |
107 | 107 | return s_instance; |
108 | 108 | } |
| 109 | + |
109 | 110 | public static StatsCollector getInstance(Map<String, String> configs) { |
110 | | - if (s_instance == null) { |
111 | | - |
112 | | - s_instance = new StatsCollector(); |
113 | | - s_instance = ComponentContext.inject(s_instance); |
114 | | - s_instance.init(configs); |
115 | | - |
116 | | - } |
117 | 111 | return s_instance; |
118 | 112 | } |
119 | 113 |
|
120 | 114 | public StatsCollector() { |
| 115 | + s_instance = this; |
121 | 116 | } |
122 | 117 |
|
123 | 118 | private void init(Map<String, String> configs) { |
|
0 commit comments