Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MODCLUSTER-322 Using AverageSystemLoadMetric can improperly cause a L…

…oad Factor of 0
  • Loading branch information...
commit 2d53be1fc1651cedf5d7b50348e5bcc3d6a1de35 1 parent d7ae6cd
@pferraro pferraro authored
View
2  core/src/main/java/org/jboss/modcluster/load/metric/impl/AverageSystemLoadMetric.java
@@ -45,6 +45,6 @@ public AverageSystemLoadMetric(OperatingSystemMXBean bean) {
@Override
public double getLoad(Engine engine) throws Exception {
- return this.bean.getSystemLoadAverage();
+ return this.bean.getSystemLoadAverage() / this.bean.getAvailableProcessors();
}
}
View
3  core/src/test/java/org/jboss/modcluster/load/metric/AverageSystemLoadMetricTestCase.java
@@ -42,7 +42,8 @@ public void getLoad() throws Exception {
LoadMetric metric = new AverageSystemLoadMetric(bean);
Engine engine = mock(Engine.class);
- when(bean.getSystemLoadAverage()).thenReturn(0.25);
+ when(bean.getSystemLoadAverage()).thenReturn(0.50);
+ when(bean.getAvailableProcessors()).thenReturn(2);
double load = metric.getLoad(engine);
Please sign in to comment.
Something went wrong with that request. Please try again.