[jboss-cvs] JBossAS SVN: r77330 - in trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load: metric and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 21 17:31:20 EDT 2008


Author: pferraro
Date: 2008-08-21 17:31:20 -0400 (Thu, 21 Aug 2008)
New Revision: 77330

Added:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProviderMBean.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/LoadMetricMBean.java
Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java
Log:
Add mbean interfaces to expose parameters used to tweak load balancing at runtime.

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java	2008-08-21 21:30:16 UTC (rev 77329)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProvider.java	2008-08-21 21:31:20 UTC (rev 77330)
@@ -38,7 +38,7 @@
  * 
  * @author Paul Ferraro
  */
-public class DynamicLoadBalanceFactorProvider implements LoadBalanceFactorProvider, LoadMetricSourceRegistration
+public class DynamicLoadBalanceFactorProvider implements LoadBalanceFactorProvider, LoadMetricSourceRegistration, DynamicLoadBalanceFactorProviderMBean
 {
    private final Logger log = Logger.getLogger(this.getClass());
    private final Collection<LoadMetricSource> sources = new ArrayList<LoadMetricSource>();
@@ -162,9 +162,8 @@
    }
 
    /**
-    * Get the decayFactor.
-    * 
-    * @return the decayFactor.
+    * @{inheritDoc}
+    * @see org.jboss.web.tomcat.service.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean#getDecayFactor()
     */
    public int getDecayFactor()
    {
@@ -172,9 +171,8 @@
    }
 
    /**
-    * Set the exponential decay factor applied to historic load values.
-    * 
-    * @param decayFactor The decayFactor to set.
+    * @{inheritDoc}
+    * @see org.jboss.web.tomcat.service.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean#setDecayFactor(int)
     */
    public void setDecayFactor(int decayFactor)
    {
@@ -187,9 +185,8 @@
    }
 
    /**
-    * Get the history.
-    * 
-    * @return the history.
+    * @{inheritDoc}
+    * @see org.jboss.web.tomcat.service.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean#getHistory()
     */
    public int getHistory()
    {
@@ -197,9 +194,8 @@
    }
 
    /**
-    * Set the number of historic load values to consider when calculating the current load factor.
-    * 
-    * @param history The history to set.
+    * @{inheritDoc}
+    * @see org.jboss.web.tomcat.service.modcluster.load.impl.DynamicLoadBalanceFactorProviderMBean#setHistory(int)
     */
    public void setHistory(int history)
    {

Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProviderMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProviderMBean.java	                        (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/impl/DynamicLoadBalanceFactorProviderMBean.java	2008-08-21 21:31:20 UTC (rev 77330)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.web.tomcat.service.modcluster.load.impl;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public interface DynamicLoadBalanceFactorProviderMBean
+{
+   /**
+    * Returns the history count.
+    * @return a positive integer
+    */
+   int getHistory();
+   
+   /**
+    * Sets the number of historical load values to consider when calculating the load balance factor.
+    * @param history
+    * @throws IllegalArgumentException if specified value is not a positive number
+    */
+   void setHistory(int history);
+   
+   /**
+    * Returns the exponential decay factor.
+    * @return a positive integer
+    */
+   int getDecayFactor();
+   
+   /**
+    * Sets the exponential decay factor to be applied to historical load values.
+    * @param decayFactor the new decay factor
+    * @throws IllegalArgumentException if specified value is not a positive number
+    */
+   void setDecayFactor(int decayFactor);
+}

Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/LoadMetricMBean.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/LoadMetricMBean.java	                        (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/LoadMetricMBean.java	2008-08-21 21:31:20 UTC (rev 77330)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.web.tomcat.service.modcluster.load.metric;
+
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public interface LoadMetricMBean extends LoadMetric
+{
+   void setWeight(int weight);
+   
+   void setCapacity(double capacity);
+}

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java	2008-08-21 21:30:16 UTC (rev 77329)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/AbstractLoadMetric.java	2008-08-21 21:31:20 UTC (rev 77330)
@@ -22,13 +22,14 @@
 package org.jboss.web.tomcat.service.modcluster.load.metric.impl;
 
 import org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetric;
+import org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricMBean;
 
 /**
  * Abstract {@link LoadMetric} implementation with basic mutators/accessors.
  * 
  * @author Paul Ferraro
  */
-public abstract class AbstractLoadMetric implements LoadMetric
+public abstract class AbstractLoadMetric implements LoadMetricMBean
 {
    private volatile int weight = 0;
    private volatile double capacity = 1;
@@ -42,6 +43,10 @@
       return this.weight;
    }
 
+   /**
+    * @{inheritDoc}
+    * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricMBean#setWeight(int)
+    */
    public void setWeight(int weight)
    {
       this.weight = weight;
@@ -56,6 +61,10 @@
       return this.capacity;
    }
    
+   /**
+    * @{inheritDoc}
+    * @see org.jboss.web.tomcat.service.modcluster.load.metric.LoadMetricMBean#setCapacity(double)
+    */
    public void setCapacity(double capacity)
    {
       if (capacity <= 0)




More information about the jboss-cvs-commits mailing list