Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions container/tomcat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod_cluster-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod_cluster-container-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down
2 changes: 0 additions & 2 deletions container/tomcat8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod_cluster-container-tomcat</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod_cluster-container-tomcat</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
Expand Down
2 changes: 0 additions & 2 deletions container/tomcat85/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod_cluster-container-tomcat</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mod_cluster-container-tomcat</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
Expand Down
5 changes: 4 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-container-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-load-spi</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import org.jboss.modcluster.container.Server;
import org.jboss.modcluster.load.LoadBalanceFactorProvider;
import org.jboss.modcluster.load.LoadBalanceFactorProviderFactory;
import org.jboss.modcluster.load.SimpleLoadBalanceFactorProviderFactory;
import org.jboss.modcluster.load.impl.SimpleLoadBalanceFactorProviderFactory;
import org.jboss.modcluster.mcmp.ContextFilter;
import org.jboss.modcluster.mcmp.MCMPConnectionListener;
import org.jboss.modcluster.mcmp.MCMPHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
* 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.modcluster.load;
package org.jboss.modcluster.load.impl;

import org.jboss.modcluster.load.LoadBalanceFactorProvider;
import org.jboss.modcluster.load.LoadBalanceFactorProviderFactory;

public class SimpleLoadBalanceFactorProviderFactory implements LoadBalanceFactorProviderFactory {
private final LoadBalanceFactorProvider provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
* 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.modcluster.load.metric;
package org.jboss.modcluster.load.metric.impl;

/**
* @author Paul Ferraro
*
*/
public interface DeterministicLoadState {
double delta(double currentLoad);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

import org.jboss.modcluster.load.metric.DeterministicLoadState;

/**
* Computes incremental load change per second from record of previous load.
*
Expand All @@ -35,10 +33,6 @@ public class DeterministicLoadStateImpl implements DeterministicLoadState {
private final AtomicReference<Double> previousLoad = new AtomicReference<Double>(new Double(0));
private final AtomicLong previousTime = new AtomicLong(System.currentTimeMillis());

/**
* @{inheritDoc
* @see org.jboss.modcluster.load.metric.DeterministicLoadState#delta(double)
*/
@Override
public double delta(double currentLoad) {
long currentTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import org.jboss.modcluster.container.Connector;
import org.jboss.modcluster.container.Engine;
import org.jboss.modcluster.load.metric.DeterministicLoadState;
import org.jboss.modcluster.load.metric.LoadMetric;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import org.jboss.modcluster.container.Connector;
import org.jboss.modcluster.container.Engine;
import org.jboss.modcluster.load.metric.DeterministicLoadState;
import org.jboss.modcluster.load.metric.LoadMetric;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import org.jboss.modcluster.container.Connector;
import org.jboss.modcluster.container.Engine;
import org.jboss.modcluster.load.metric.DeterministicLoadState;
import org.jboss.modcluster.load.metric.LoadMetric;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import org.jboss.modcluster.container.Connector;
import org.jboss.modcluster.container.Engine;
import org.jboss.modcluster.load.metric.impl.DeterministicLoadState;
import org.jboss.modcluster.load.metric.impl.ReceiveTrafficLoadMetric;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import org.jboss.modcluster.container.Connector;
import org.jboss.modcluster.container.Engine;
import org.jboss.modcluster.load.metric.impl.DeterministicLoadState;
import org.jboss.modcluster.load.metric.impl.RequestCountLoadMetric;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import org.jboss.modcluster.container.Connector;
import org.jboss.modcluster.container.Engine;
import org.jboss.modcluster.load.metric.impl.DeterministicLoadState;
import org.jboss.modcluster.load.metric.impl.SendTrafficLoadMetric;
import org.junit.Test;

Expand Down
43 changes: 43 additions & 0 deletions load-spi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2017, Red Hat, Inc., 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-parent</artifactId>
<version>2.0.0.Alpha1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<artifactId>mod_cluster-load-spi</artifactId>
<name>mod_cluster: Load SPI</name>

<dependencies>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-container-spi</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@

/**
* Provides the load balance factor for a node.
*
*
* @author Brian Stansberry
* @version $Revision$
*/
public interface LoadBalanceFactorProvider {
int getLoadBalanceFactor(Engine engine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

/**
* @author Paul Ferraro
*
*/
public interface LoadBalanceFactorProviderFactory {
LoadBalanceFactorProvider createLoadBalanceFactorProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/**
* Represents a specific load metric.
*
*
* @author Paul Ferraro
*/
public interface LoadMetric extends LoadMetricMBean {
Expand All @@ -34,10 +34,10 @@ public interface LoadMetric extends LoadMetricMBean {

/**
* Returns the current load of this metric as a percent of the metric's capacity.
*
*
* @return raw load / capacity.
* @throws NodeUnavailableException if the node should be put into the error state.
* @throws Exception if the load could not be determined.
* @throws Exception if the load could not be determined.
*/
double getLoad(Engine engine) throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,34 @@

/**
* @author Paul Ferraro
*
*/
public interface LoadMetricMBean {
/**
* Returns the "weight" of this metric, i.e. significance of this load metric compared to the other metrics.
*
*
* @return the weight of the metric
*/
int getWeight();

/**
* Returns the load capacity of this metric. Used to normalize the value returned by {@link #getLoad()} expressed as a
* percentage of the capacity, such that: 0 <= ({@link #getLoad()} / {@link #getCapacity()}) < 1
*
* Returns the load capacity of this metric. Used to normalize the value returned by {@link LoadMetric#getLoad} expressed as a
* percentage of the capacity, such that: 0 <= ({@link LoadMetric#getLoad} / {@link #getCapacity()}) < 1
*
* @return the estimated capacity of this metric.
*/
double getCapacity();

/**
* Returns the current load of this metric as a percent of the metric's capacity.
*
* @return raw load / capacity.
* @throws Exception if the load could not be determined.
* Sets the weight of the metric relative to the other metrics. Defaults to 1.
*
* @param weight weight of the metric.
*/
// double getLoad() throws Exception;

void setWeight(int weight);

/**
* Sets the maximum capacity of this metric. Used for metrics that do not have an implicit capacity and need to be configured. Defaults to 1.
*
* @param capacity non-negative capacity of the metric.
*/
void setCapacity(double capacity);
}
34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,32 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-container-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-load-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-container-tomcat</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.mod_cluster</groupId>
<artifactId>mod_cluster-container-tomcat</artifactId>
<type>test-jar</type>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
Expand Down Expand Up @@ -135,6 +161,7 @@
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -194,6 +221,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
<module>demo</module>
</modules>
</profile>
Expand All @@ -205,6 +233,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
<module>demo</module>
</modules>
<build>
Expand Down Expand Up @@ -233,6 +262,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
</modules>
</profile>
<profile>
Expand All @@ -243,6 +273,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
</modules>
</profile>
<profile>
Expand All @@ -253,6 +284,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
</modules>
</profile>
<profile>
Expand All @@ -263,6 +295,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
</modules>
</profile>
<profile>
Expand All @@ -273,6 +306,7 @@
<modules>
<module>core</module>
<module>container</module>
<module>load-spi</module>
<module>demo</module>
<module>docs</module>
</modules>
Expand Down