Author: pferraro
Date: 2008-12-09 10:22:43 -0500 (Tue, 09 Dec 2008)
New Revision: 2097
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterListener.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/LoadMetric.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/AbstractLoadMetric.java
Log:
Use constants for default values.
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterListener.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterListener.java 2008-12-09
14:57:23 UTC (rev 2096)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterListener.java 2008-12-09
15:22:43 UTC (rev 2097)
@@ -77,9 +77,9 @@
private final StringManager sm = StringManager.getManager(Constants.Package);
private Class<? extends LoadMetric<? extends LoadContext>> loadMetricClass
= BusyConnectorsLoadMetric.class;
- private int decayFactor = 2;
- private int history = 9;
- private double capacity = 1;
+ private int decayFactor = DynamicLoadBalanceFactorProvider.DEFAULT_DECAY_FACTOR;
+ private int history = DynamicLoadBalanceFactorProvider.DEFAULT_HISTORY;
+ private double capacity = LoadMetric.DEFAULT_CAPACITY;
public ModClusterListener()
{
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java 2008-12-09
14:57:23 UTC (rev 2096)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java 2008-12-09
15:22:43 UTC (rev 2097)
@@ -44,6 +44,9 @@
*/
public class DynamicLoadBalanceFactorProvider implements LoadBalanceFactorProvider,
DynamicLoadBalanceFactorProviderMBean
{
+ public static final int DEFAULT_DECAY_FACTOR = 2;
+ public static final int DEFAULT_HISTORY = 9;
+
private final Logger log = Logger.getLogger(this.getClass());
private final Map<LoadMetricSource<LoadContext>,
Map<LoadMetric<LoadContext>, List<Double>>> loadHistory = new
LinkedHashMap<LoadMetricSource<LoadContext>,
Map<LoadMetric<LoadContext>, List<Double>>>();
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/LoadMetric.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/LoadMetric.java 2008-12-09
14:57:23 UTC (rev 2096)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/LoadMetric.java 2008-12-09
15:22:43 UTC (rev 2097)
@@ -28,6 +28,9 @@
*/
public interface LoadMetric<C extends LoadContext> extends LoadMetricMBean
{
+ public static final double DEFAULT_CAPACITY = 1;
+ public static final int DEFAULT_WEIGHT = 1;
+
/**
* Returns the current load. This value only has meaning when expressed as a ratio of
the capacity.
* @return the current load.
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/AbstractLoadMetric.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/AbstractLoadMetric.java 2008-12-09
14:57:23 UTC (rev 2096)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/load/metric/impl/AbstractLoadMetric.java 2008-12-09
15:22:43 UTC (rev 2097)
@@ -32,8 +32,8 @@
*/
public abstract class AbstractLoadMetric<C extends LoadContext> implements
LoadMetric<C>, LoadMetricMBean
{
- private volatile int weight = 1;
- private volatile double capacity = 1;
+ private volatile int weight = LoadMetric.DEFAULT_WEIGHT;
+ private volatile double capacity = LoadMetric.DEFAULT_CAPACITY;
/**
* @{inheritDoc}
Show replies by date