Author: pferraro
Date: 2009-02-03 11:04:29 -0500 (Tue, 03 Feb 2009)
New Revision: 2265
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java
Log:
Cosmetic internal changes
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java 2009-02-03
16:02:19 UTC (rev 2264)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/DeterministicLoadStateImpl.java 2009-02-03
16:04:29 UTC (rev 2265)
@@ -32,8 +32,8 @@
*/
public class DeterministicLoadStateImpl implements DeterministicLoadState
{
- private final AtomicReference<Double> currentLoad = new
AtomicReference<Double>(new Double(0));
- private final AtomicLong currentTime = new AtomicLong(System.currentTimeMillis());
+ private final AtomicReference<Double> previousLoad = new
AtomicReference<Double>(new Double(0));
+ private final AtomicLong previousTime = new AtomicLong(System.currentTimeMillis());
/**
* @{inheritDoc}
@@ -42,9 +42,9 @@
public double delta(double currentLoad)
{
long currentTime = System.currentTimeMillis();
- long previousTime = this.currentTime.getAndSet(currentTime);
+ long previousTime = this.previousTime.getAndSet(currentTime);
- double previousLoad = this.currentLoad.getAndSet(new
Double(currentLoad)).doubleValue();
+ double previousLoad = this.previousLoad.getAndSet(new
Double(currentLoad)).doubleValue();
double seconds = (currentTime - previousTime) / 1000d;
@@ -52,8 +52,8 @@
return (currentLoad - previousLoad) / seconds;
}
- public long getCurrentTime()
+ public long getPreviousTime()
{
- return this.currentTime.get();
+ return this.previousTime.get();
}
}
Modified:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java
===================================================================
---
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java 2009-02-03
16:02:19 UTC (rev 2264)
+++
trunk/mod_cluster/src/test/java/org/jboss/modcluster/load/metric/DeterministicLoadMetricTestCase.java 2009-02-03
16:04:29 UTC (rev 2265)
@@ -36,25 +36,25 @@
@Test
public void testDelta() throws InterruptedException
{
- long lastTime = this.state.getCurrentTime();
+ long lastTime = this.state.getPreviousTime();
Thread.sleep(500);
double result = this.state.delta(20);
- long nextTime = this.state.getCurrentTime();
+ long nextTime = this.state.getPreviousTime();
double elapsed = (nextTime - lastTime) / 1000d;
Assert.assertEquals(20 / elapsed, result, 0);
- lastTime = this.state.getCurrentTime();
+ lastTime = this.state.getPreviousTime();
Thread.sleep(1000);
result = this.state.delta(50);
- nextTime = this.state.getCurrentTime();
+ nextTime = this.state.getPreviousTime();
elapsed = (nextTime - lastTime) / 1000d;
Show replies by date