4 new revisions:
Revision: 7e4c432ffef9
Author: [email protected] <[email protected]>
Date: Mon Apr 8 04:52:20 2013
Log: Update Netty to 3.6.4.Final...
http://code.google.com/p/commscale/source/detail?r=7e4c432ffef9&repo=load-balancer
Revision: 4778ade9e883
Author: [email protected] <[email protected]>
Date: Tue Apr 9 13:01:28 2013
Log: Fixes issue 19
http://code.google.com/p/commscale/source/detail?r=4778ade9e883&repo=load-balancer
Revision: 4778e601ca6f
Author: [email protected] <[email protected]>
Date: Mon Apr 22 05:50:26 2013
Log: Update issue 21
http://code.google.com/p/commscale/source/detail?r=4778e601ca6f&repo=load-balancer
Revision: 952bd875eeed
Author: [email protected] <[email protected]>
Date: Mon Apr 22 06:24:18 2013
Log: Merge remote-tracking branch 'origin/master'
http://code.google.com/p/commscale/source/detail?r=952bd875eeed&repo=load-balancer
==============================================================================
Revision: 7e4c432ffef9
Author: [email protected] <[email protected]>
Date: Mon Apr 8 04:52:20 2013
Log: Update Netty to 3.6.4.Final
Fixes issue 17
http://code.google.com/p/commscale/source/detail?r=7e4c432ffef9&repo=load-balancer
Modified:
/jar/pom.xml
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpBalancerForwarder.java
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpRequestHandler.java
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpResponseHandler.java
=======================================
--- /jar/pom.xml Mon Oct 1 05:18:37 2012
+++ /jar/pom.xml Mon Apr 8 04:52:20 2013
@@ -1,14 +1,15 @@
-<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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
+
<parent>
<groupId>org.mobicents.tools</groupId>
<artifactId>sip-balancer</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.7.0-SNAPSHOT</version>
</parent>
-
+
<artifactId>sip-balancer-jar</artifactId>
-
+
<name>Mobicents Converged Load Balancer Jar</name>
<description>Mobicents Converged Load Balancer Jar</description>
<url>http://code.google.com/p/commscale.load-balancer</url>
@@ -22,33 +23,33 @@
</manifest.implementation.version>
<manifest.implementation.vendor>TeleStax, Inc.
</manifest.implementation.vendor>
- </properties>
+ </properties>
<dependencies>
- <dependency>
- <groupId>org.jboss.netty</groupId>
+ <dependency>
+ <groupId>io.netty</groupId>
<artifactId>netty</artifactId>
- <version>3.1.5.GA</version>
- <!--scope>provided</scope-->
+ <version>3.6.4.Final</version>
+ <!--scope>provided</scope -->
</dependency>
- <!-- clustering deps -->
+ <!-- clustering deps -->
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
<version>3.2.1.GA</version>
</dependency>
-
+
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-pojo</artifactId>
- <version>3.0.0.GA</version>
- </dependency>
- <dependency>
+ <version>3.0.0.GA</version>
+ </dependency>
+ <dependency>
<groupId>jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>2.7.0.GA</version>
- </dependency>
-
+ <version>2.7.0.GA</version>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -64,18 +65,12 @@
<dependency>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
- <version>1.2.1</version>
+ <version>1.2.1</version>
</dependency>
- <!--dependency>
- <groupId>com.sun.jdmk</groupId>
- <artifactId>jmxtools</artifactId>
- <version>1.2.1</version>
- <scope>system</scope>
- <systemPath>${basedir}/lib/jmxtools-1.2.1.jar
- </systemPath>
- <optional>true</optional>
- </dependency-->
+ <!--dependency> <groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
+ <version>1.2.1</version> <scope>system</scope>
<systemPath>${basedir}/lib/jmxtools-1.2.1.jar
+ </systemPath> <optional>true</optional> </dependency -->
<dependency>
<groupId>javax.sip</groupId>
@@ -104,16 +99,16 @@
<manifestEntries>
<Implementation-Title>
${manifest.implementation.title}
- </Implementation-Title>
+ </Implementation-Title>
<Implementation-Version>
${manifest.implementation.version}
- </Implementation-Version>
+
</Implementation-Version>
<Implementation-Vendor-Id>
${manifest.implementation.vendor}
- </Implementation-Vendor-Id>
+
</Implementation-Vendor-Id>
<Implementation-URL>
${manifest.url}
- </Implementation-URL>
+ </Implementation-URL>
</manifestEntries>
</archive>
</configuration>
@@ -130,16 +125,16 @@
<manifestEntries>
<Implementation-Title>
${manifest.implementation.title}
- </Implementation-Title>
+ </Implementation-Title>
<Implementation-Version>
${manifest.implementation.version}
- </Implementation-Version>
+
</Implementation-Version>
<Implementation-Vendor-Id>
${manifest.implementation.vendor}
- </Implementation-Vendor-Id>
+
</Implementation-Vendor-Id>
<Implementation-URL>
${manifest.url}
- </Implementation-URL>
+ </Implementation-URL>
</manifestEntries>
</archive>
<descriptors>
@@ -150,35 +145,49 @@
<executions>
<execution>
<id>make-assembly</id>
- <!--
- this is used for
inheritance merges
- -->
+ <!-- this is used for inheritance
merges -->
<phase>package</phase>
- <!--
- append to the packaging
phase.
- -->
+ <!-- append to the packaging
phase. -->
<goals>
<goal>attached</goal><!--
goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArguments>
+ <g />
+ </compilerArguments>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+
<useProjectReferences>false</useProjectReferences>
+ </configuration>
+ </plugin>
</plugins>
</build>
<repositories>
<repository>
- <id>wso2-repository-group</id>
- <name>Wso2 Public Maven Repository Group</name>
- <url>http://dist.wso2.org/maven2</url>
- <layout>default</layout>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
+ <id>wso2-repository-group</id>
+ <name>Wso2 Public Maven Repository Group</name>
+ <url>http://dist.wso2.org/maven2</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
</repository>
</repositories>
</project>
=======================================
---
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpBalancerForwarder.java
Thu Feb 14 12:37:26 2013
+++
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpBalancerForwarder.java
Mon Apr 8 04:52:20 2013
@@ -46,22 +46,16 @@
NioServerSocketChannelFactory nioServerSocketChannelFactory = null;
NioClientSocketChannelFactory nioClientSocketChannelFactory = null;
Channel serverChannel;
-
+
public void start() {
- executor = Executors.newFixedThreadPool(32);
- nioServerSocketChannelFactory = new
NioServerSocketChannelFactory(
- executor,
- executor);
- nioClientSocketChannelFactory = new
NioClientSocketChannelFactory(
- executor,
- executor);
- HttpChannelAssociations.serverBootstrap = new ServerBootstrap(
- nioServerSocketChannelFactory);
- HttpChannelAssociations.inboundBootstrap = new ClientBootstrap(
- nioClientSocketChannelFactory);
+ executor = Executors.newCachedThreadPool();
+ nioServerSocketChannelFactory = new
NioServerSocketChannelFactory(executor, executor);
+ nioClientSocketChannelFactory = new
NioClientSocketChannelFactory(executor, executor);
+ HttpChannelAssociations.serverBootstrap = new
ServerBootstrap(nioServerSocketChannelFactory);
+ HttpChannelAssociations.inboundBootstrap = new
ClientBootstrap(nioClientSocketChannelFactory);
HttpChannelAssociations.channels = new ConcurrentHashMap<Channel,
Channel>();
-
-
+
+
Integer httpPort = 2222;
if(balancerRunner.balancerContext.properties != null) {
String httpPortString =
balancerRunner.balancerContext.properties.getProperty("httpPort", "2080");
@@ -70,9 +64,9 @@
logger.info("HTTP LB listening on port " + httpPort);
HttpChannelAssociations.serverBootstrap.setPipelineFactory(new
HttpServerPipelineFactory(balancerRunner));
serverChannel = HttpChannelAssociations.serverBootstrap.bind(new
InetSocketAddress(httpPort));
- HttpChannelAssociations.inboundBootstrap.setPipelineFactory(new
HttpClientPipelineFactory());
+ HttpChannelAssociations.inboundBootstrap.setPipelineFactory(new
HttpClientPipelineFactory());
}
-
+
public void stop() {
if(executor == null) return; // already stopped
for (Entry<Channel, Channel> entry :
HttpChannelAssociations.channels.entrySet()) {
@@ -86,19 +80,19 @@
serverChannel.unbind();
serverChannel.close();
serverChannel.getCloseFuture().awaitUninterruptibly();
-
+
// http://code.google.com/p/commscale/issues/detail?id=6
// Hang the VM on shutdown if HTTP Requests has been handled
// so commented out
-// nioServerSocketChannelFactory.releaseExternalResources();
-// nioClientSocketChannelFactory.releaseExternalResources();
-
-//
HttpChannelAssociations.serverBootstrap.releaseExternalResources();
-//
HttpChannelAssociations.inboundBootstrap.releaseExternalResources();
-
+ //
nioServerSocketChannelFactory.releaseExternalResources();
+ //
nioClientSocketChannelFactory.releaseExternalResources();
+
+ //
HttpChannelAssociations.serverBootstrap.releaseExternalResources();
+ //
HttpChannelAssociations.inboundBootstrap.releaseExternalResources();
+
executor.shutdownNow();
executor = null;
-// System.gc();
+ // System.gc();
}
}
=======================================
---
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpRequestHandler.java
Thu Feb 14 12:37:26 2013
+++
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpRequestHandler.java
Mon Apr 8 04:52:20 2013
@@ -25,18 +25,17 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.InetSocketAddress;
+import java.nio.charset.Charset;
import java.util.Enumeration;
import java.util.Set;
-import java.util.logging.Level;
+
import org.apache.log4j.Logger;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelFutureListener;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
@@ -50,7 +49,6 @@
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.HttpVersion;
-import org.mobicents.tools.sip.balancer.BalancerContext;
import org.mobicents.tools.sip.balancer.BalancerRunner;
import org.mobicents.tools.sip.balancer.InvocationContext;
import org.mobicents.tools.sip.balancer.SIPNode;
@@ -59,99 +57,101 @@
* @author Vladimir Ralev ([email protected])
*
*/
-@ChannelPipelineCoverage("one")
+//https://issues.jboss.org/browse/NETTY-283 - ChannelPipelineCoverage
deprecated
+//@ChannelPipelineCoverage("one")
public class HttpRequestHandler extends SimpleChannelUpstreamHandler {
-
+
private static final Logger logger =
Logger.getLogger(HttpRequestHandler.class.getCanonicalName());
-
- private volatile HttpRequest request;
- private volatile boolean readingChunks;
-
- private BalancerRunner balancerRunner;
-
- public HttpRequestHandler(BalancerRunner balancerRunner) {
- this.balancerRunner = balancerRunner;
- }
- @Override
- public void messageReceived(ChannelHandlerContext ctx, final
MessageEvent e) throws Exception {
- if (!readingChunks) {
- request = (HttpRequest) e.getMessage();
-
- if(logger.isDebugEnabled()) {
- logger.debug("Request URI accessed: " + request.getUri() + "
channel " + e.getChannel());
- }
-
- Channel associatedChannel =
HttpChannelAssociations.channels.get(e.getChannel());
-
- InvocationContext invocationContext =
balancerRunner.getLatestInvocationContext();
-
- SIPNode node = null;
- try {
- node =
invocationContext.balancerAlgorithm.processHttpRequest(request);
- } catch (Exception ex) {
- StringWriter sw = new StringWriter();
- ex.printStackTrace(new PrintWriter(sw));
- logger.warn("Problem in balancer algorithm", ex);
-
- writeResponse(e, HttpResponseStatus.INTERNAL_SERVER_ERROR, "Load
Balancer Error: Exception in the balancer algorithm:\n" +
- sw.toString()
- );
- return;
- }
-
-
- if(node == null) {
- if(logger.isInfoEnabled()) {
- logger.info("Service unavailable. No server is
available.");
- }
- writeResponse(e,
HttpResponseStatus.SERVICE_UNAVAILABLE, "Service is temporarily
unavailable");
- return;
- }
+ private volatile HttpRequest request;
+ private volatile boolean readingChunks;
- if(associatedChannel != null &&
associatedChannel.isConnected()) {
- associatedChannel.write(request);
- } else {
+ private BalancerRunner balancerRunner;
- e.getChannel().getCloseFuture().addListener(new
ChannelFutureListener() {
- public void operationComplete(ChannelFuture arg0) throws Exception
{
- closeChannelPair(arg0.getChannel());
- }
- });
-
- // Start the connection attempt.
- ChannelFuture future =
HttpChannelAssociations.inboundBootstrap.connect(new
InetSocketAddress(node.getIp(),
(Integer)node.getProperties().get("httpPort")));
+ public HttpRequestHandler(BalancerRunner balancerRunner) {
+ this.balancerRunner = balancerRunner;
+ }
- future.addListener(new ChannelFutureListener() {
- public void operationComplete(ChannelFuture arg0) throws
Exception {
- Channel channel = arg0.getChannel();
-
HttpChannelAssociations.channels.put(e.getChannel(), channel);
-
HttpChannelAssociations.channels.put(channel, e.getChannel());
+ @Override
+ public void messageReceived(ChannelHandlerContext ctx, final MessageEvent
e) throws Exception {
+ if (!readingChunks) {
+ request = (HttpRequest) e.getMessage();
- if (request.isChunked()) {
- readingChunks = true;
- }
- channel.write(request);
+ if(logger.isDebugEnabled()) {
+ logger.debug("Request URI accessed: " + request.getUri() + " channel "
+ e.getChannel());
+ }
- channel.getCloseFuture().addListener(new
ChannelFutureListener() {
- public void operationComplete(ChannelFuture arg0) throws
Exception {
-
closeChannelPair(arg0.getChannel());
- }
- });
- }
- });
- }
- } else {
- HttpChunk chunk = (HttpChunk) e.getMessage();
- if (chunk.isLast()) {
- readingChunks = false;
- }
-
HttpChannelAssociations.channels.get(e.getChannel()).write(chunk);
- }
- }
-
- private void closeChannelPair(Channel channel) {
+ Channel associatedChannel =
HttpChannelAssociations.channels.get(e.getChannel());
+
+ InvocationContext invocationContext =
balancerRunner.getLatestInvocationContext();
+
+ SIPNode node = null;
+ try {
+ node =
invocationContext.balancerAlgorithm.processHttpRequest(request);
+ } catch (Exception ex) {
+ StringWriter sw = new StringWriter();
+ ex.printStackTrace(new PrintWriter(sw));
+ logger.warn("Problem in balancer algorithm",
ex);
+
+ writeResponse(e, HttpResponseStatus.INTERNAL_SERVER_ERROR, "Load
Balancer Error: Exception in the balancer algorithm:\n" +
+ sw.toString()
+ );
+ return;
+ }
+
+
+ if(node == null) {
+ if(logger.isInfoEnabled()) {
+ logger.info("Service unavailable. No server
is available.");
+ }
+ writeResponse(e, HttpResponseStatus.SERVICE_UNAVAILABLE, "Service is
temporarily unavailable");
+ return;
+ }
+
+ if(associatedChannel != null &&
associatedChannel.isConnected()) {
+ associatedChannel.write(request);
+ } else {
+
+ e.getChannel().getCloseFuture().addListener(new
ChannelFutureListener() {
+ public void
operationComplete(ChannelFuture arg0) throws Exception {
+
closeChannelPair(arg0.getChannel());
+ }
+ });
+
+ // Start the connection attempt.
+ ChannelFuture future =
HttpChannelAssociations.inboundBootstrap.connect(new
InetSocketAddress(node.getIp(),
(Integer)node.getProperties().get("httpPort")));
+
+ future.addListener(new ChannelFutureListener() {
+
+ public void
operationComplete(ChannelFuture arg0) throws Exception {
+ Channel channel =
arg0.getChannel();
+
HttpChannelAssociations.channels.put(e.getChannel(), channel);
+
HttpChannelAssociations.channels.put(channel, e.getChannel());
+
+ if (request.isChunked()) {
+ readingChunks = true;
+ }
+ channel.write(request);
+
+
channel.getCloseFuture().addListener(new ChannelFutureListener() {
+ public void
operationComplete(ChannelFuture arg0) throws Exception {
+
closeChannelPair(arg0.getChannel());
+ }
+ });
+ }
+ });
+ }
+ } else {
+ HttpChunk chunk = (HttpChunk) e.getMessage();
+ if (chunk.isLast()) {
+ readingChunks = false;
+ }
+
HttpChannelAssociations.channels.get(e.getChannel()).write(chunk);
+ }
+ }
+
+ private void closeChannelPair(Channel channel) {
Channel associatedChannel =
HttpChannelAssociations.channels.get(channel);
if(associatedChannel != null) {
try {
@@ -170,65 +170,65 @@
//logger.info("Channel closed. Channels remaining: " +
HttpChannelAssocialtions.channels.size());
if(logger.isDebugEnabled()) {
try {
- logger.debug("Channel closed " +
HttpChannelAssociations.channels.size() + " " + channel);
- Enumeration<Channel> c =
HttpChannelAssociations.channels.keys();
- while(c.hasMoreElements()) {
- logger.debug(c.nextElement().toString());
- }
+ logger.debug("Channel closed " +
HttpChannelAssociations.channels.size() + " " + channel);
+ Enumeration<Channel> c =
HttpChannelAssociations.channels.keys();
+ while(c.hasMoreElements()) {
+
logger.debug(c.nextElement().toString());
+ }
} catch (Exception e) {
logger.debug("error", e);
}
}
- }
+ }
- private void writeResponse(MessageEvent e, HttpResponseStatus status,
String responseString) {
- // Convert the response content to a ChannelBuffer.
- ChannelBuffer buf =
ChannelBuffers.copiedBuffer(responseString, "UTF-8");
+ private void writeResponse(MessageEvent e, HttpResponseStatus status,
String responseString) {
+ // Convert the response content to a ChannelBuffer.
+ ChannelBuffer buf = ChannelBuffers.copiedBuffer(responseString,
Charset.forName("UTF-8"));
- // Decide whether to close the connection or not.
- boolean close =
-
HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION))
||
- request.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
-
!HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION));
+ // Decide whether to close the connection or not.
+ boolean close =
+
HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION))
||
+
request.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
+
!HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION));
- // Build the response object.
- HttpResponse response = new
DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
- response.setContent(buf);
- response.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/plain;
charset=UTF-8");
+ // Build the response object.
+ HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
status);
+ response.setContent(buf);
+ response.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/plain;
charset=UTF-8");
- if (!close) {
- // There's no need to add 'Content-Length' header
- // if this is the last response.
- response.setHeader(HttpHeaders.Names.CONTENT_LENGTH,
String.valueOf(buf.readableBytes()));
- }
+ if (!close) {
+ // There's no need to add 'Content-Length' header
+ // if this is the last response.
+ response.setHeader(HttpHeaders.Names.CONTENT_LENGTH,
String.valueOf(buf.readableBytes()));
+ }
- String cookieString = request.getHeader(HttpHeaders.Names.COOKIE);
- if (cookieString != null) {
- CookieDecoder cookieDecoder = new CookieDecoder();
- Set<Cookie> cookies = cookieDecoder.decode(cookieString);
- if(!cookies.isEmpty()) {
- // Reset the cookies if necessary.
- CookieEncoder cookieEncoder = new CookieEncoder(true);
- for (Cookie cookie : cookies) {
- cookieEncoder.addCookie(cookie);
- }
- response.addHeader(HttpHeaders.Names.SET_COOKIE,
cookieEncoder.encode());
- }
- }
+ String cookieString =
request.getHeader(HttpHeaders.Names.COOKIE);
+ if (cookieString != null) {
+ CookieDecoder cookieDecoder = new CookieDecoder();
+ Set<Cookie> cookies =
cookieDecoder.decode(cookieString);
+ if(!cookies.isEmpty()) {
+ // Reset the cookies if necessary.
+ CookieEncoder cookieEncoder = new
CookieEncoder(true);
+ for (Cookie cookie : cookies) {
+ cookieEncoder.addCookie(cookie);
+ }
+ response.addHeader(HttpHeaders.Names.SET_COOKIE,
cookieEncoder.encode());
+ }
+ }
- // Write the response.
- ChannelFuture future = e.getChannel().write(response);
+ // Write the response.
+ ChannelFuture future = e.getChannel().write(response);
- // Close the connection after the write operation is done if
necessary.
- if (close) {
- future.addListener(ChannelFutureListener.CLOSE);
- }
- }
+ // Close the connection after the write operation is done if
necessary.
+ if (close) {
+ future.addListener(ChannelFutureListener.CLOSE);
+ }
+ }
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
e)
- throws Exception {
- logger.error("Error", e.getCause());
- e.getChannel().close();
- }
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
+ throws Exception {
+ logger.error("Error", e.getCause());
+ e.getChannel().close();
+ }
}
=======================================
---
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpResponseHandler.java
Tue May 22 06:40:28 2012
+++
/jar/src/main/java/org/mobicents/tools/http/balancer/HttpResponseHandler.java
Mon Apr 8 04:52:20 2013
@@ -22,12 +22,9 @@
package org.mobicents.tools.http.balancer;
-import java.util.logging.Level;
import org.apache.log4j.Logger;
-
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
@@ -36,7 +33,8 @@
* @author Vladimir Ralev ([email protected])
*
*/
-@ChannelPipelineCoverage("one")
+//https://issues.jboss.org/browse/NETTY-283 - ChannelPipelineCoverage
deprecated
+//@ChannelPipelineCoverage("one")
public class HttpResponseHandler extends SimpleChannelUpstreamHandler {
private static final Logger logger =
Logger.getLogger(HttpResponseHandler.class.getCanonicalName());
@Override
==============================================================================
Revision: 4778ade9e883
Author: [email protected] <[email protected]>
Date: Tue Apr 9 13:01:28 2013
Log: Fixes issue 19
http://code.google.com/p/commscale/source/detail?r=4778ade9e883&repo=load-balancer
Modified:
/jar/pom.xml
=======================================
--- /jar/pom.xml Mon Apr 8 04:52:20 2013
+++ /jar/pom.xml Tue Apr 9 13:01:28 2013
@@ -29,7 +29,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
- <version>3.6.4.Final</version>
+ <version>3.6.5.Final</version>
<!--scope>provided</scope -->
</dependency>
<!-- clustering deps -->
==============================================================================
Revision: 4778e601ca6f
Author: [email protected] <[email protected]>
Date: Mon Apr 22 05:50:26 2013
Log: Update issue 21
http://code.google.com/p/commscale/source/detail?r=4778e601ca6f&repo=load-balancer
Modified:
/jar/pom.xml
/jar/src/main/java/org/mobicents/tools/sip/balancer/CallIDAffinityBalancerAlgorithm.java
/jar/src/main/java/org/mobicents/tools/sip/balancer/HeaderConsistentHashBalancerAlgorithm.java
/jar/src/main/java/org/mobicents/tools/sip/balancer/PureConsistentHashBalancerAlgorithm.java
/jar/src/main/java/org/mobicents/tools/sip/balancer/UDPPacketForwarder.java
/jar/src/main/java/org/mobicents/tools/sip/balancer/WorstCaseUdpTestAffinityAlgorithm.java
/jar/src/test/java/org/mobicents/tools/sip/balancer/operation/NoInternalAddressTest.java
/jar/src/test/java/org/mobicents/tools/sip/balancer/scalability/RollingUpgradeTest.java
=======================================
--- /jar/pom.xml Tue Apr 9 13:01:28 2013
+++ /jar/pom.xml Mon Apr 22 05:50:26 2013
@@ -53,7 +53,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>4.11</version>
<scope>test</scope>
</dependency>
<!-- logging dependency -->
@@ -172,6 +172,14 @@
<useProjectReferences>false</useProjectReferences>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.4</version>
+ <configuration>
+ <argLine>-Xms512m -Xmx1024m
-XX:MaxPermSize=1024m</argLine>
+ </configuration>
+ </plugin>
</plugins>
</build>
<repositories>
=======================================
---
/jar/src/main/java/org/mobicents/tools/sip/balancer/CallIDAffinityBalancerAlgorithm.java
Tue May 22 06:40:28 2012
+++
/jar/src/main/java/org/mobicents/tools/sip/balancer/CallIDAffinityBalancerAlgorithm.java
Mon Apr 22 05:50:26 2013
@@ -55,8 +55,9 @@
logger.debug("internal request");
}
- public void processInternalResponse(Response request) {
+ public void processInternalResponse(Response response) {
logger.debug("internal response");
+ processExternalResponse(response);
}
public void processExternalResponse(Response response) {
=======================================
---
/jar/src/main/java/org/mobicents/tools/sip/balancer/HeaderConsistentHashBalancerAlgorithm.java
Thu Jun 28 08:51:49 2012
+++
/jar/src/main/java/org/mobicents/tools/sip/balancer/HeaderConsistentHashBalancerAlgorithm.java
Mon Apr 22 05:50:26 2013
@@ -121,7 +121,9 @@
.getValue();
}
- if(nodesArray.length == 0) throw new RuntimeException("No Application
Servers registered. All servers are dead.");
+ if(nodesArray.length == 0) {
+ throw new RuntimeException("No Application Servers registered. All
servers are dead.");
+ }
int nodeIndex = hashAffinityKeyword(headerValue);
@@ -194,6 +196,11 @@
this.httpAffinityKey =
getProperties().getProperty("httpAffinityKey", "appsession");
this.sipHeaderAffinityKey =
getProperties().getProperty("sipHeaderAffinityKey", "Call-ID");
}
+
+ @Override
+ public void processExternalResponse(Response response){
+ this.processExternalResponse(response, this.invocationContext);
+ }
public void processExternalResponse(Response response, InvocationContext
context) {
=======================================
---
/jar/src/main/java/org/mobicents/tools/sip/balancer/PureConsistentHashBalancerAlgorithm.java
Thu Jun 28 08:51:49 2012
+++
/jar/src/main/java/org/mobicents/tools/sip/balancer/PureConsistentHashBalancerAlgorithm.java
Mon Apr 22 05:50:26 2013
@@ -94,6 +94,11 @@
}
}
+ @Override
+ public synchronized void nodeAdded(SIPNode node){
+ this.nodeAdded(node, invocationContext);
+ }
+
public synchronized void nodeAdded(SIPNode node, InvocationContext
context) {
addNode(node);
syncNodes();
=======================================
---
/jar/src/main/java/org/mobicents/tools/sip/balancer/UDPPacketForwarder.java
Tue Apr 19 04:47:21 2011
+++
/jar/src/main/java/org/mobicents/tools/sip/balancer/UDPPacketForwarder.java
Mon Apr 22 05:50:26 2013
@@ -108,6 +108,7 @@
running = false;
try {
worker.interrupt();
+ fromSocket.disconnect();
fromSocket.close();
} catch (Exception e) {
//e.printStackTrace();
=======================================
---
/jar/src/main/java/org/mobicents/tools/sip/balancer/WorstCaseUdpTestAffinityAlgorithm.java
Tue May 22 06:40:28 2012
+++
/jar/src/main/java/org/mobicents/tools/sip/balancer/WorstCaseUdpTestAffinityAlgorithm.java
Mon Apr 22 05:50:26 2013
@@ -82,7 +82,8 @@
uri = (SipURI) request.getRequestURI();
}
try {
- SIPNode newNode = getNodeA(callId+cseq);
+ //Gvag: new transaction should go to a new node
+ SIPNode newNode =
nextAvailableNode();//getNodeA(callId+cseq);
if(newNode == null) {
for(SIPNode node:invocationContext.nodes) {
if(!node.equals(assignedNode)) {
=======================================
---
/jar/src/test/java/org/mobicents/tools/sip/balancer/operation/NoInternalAddressTest.java
Mon Sep 5 18:29:15 2011
+++
/jar/src/test/java/org/mobicents/tools/sip/balancer/operation/NoInternalAddressTest.java
Mon Apr 22 05:50:26 2013
@@ -92,7 +92,7 @@
String[] nodes = balancer.getNodeList();
assertEquals(numNodes, nodes.length);
servers[0].sendHeartbeat = false;
- Thread.sleep(10000);
+ Thread.sleep(10500);
nodes = balancer.getNodeList();
assertEquals(numNodes-1, nodes.length);
}
@@ -235,7 +235,7 @@
route.setParameter("node_port", "4060");
route.setLrParam();
shootist.start();
- servers[0].sipListener.sendSipRequest("INVITE", fromAddress, toAddress,
null, null, false);
+// servers[0].sipListener.sendSipRequest("INVITE", fromAddress,
toAddress, null, null, false);
servers[0].sipListener.sendSipRequest("INVITE", fromAddress, toAddress,
null, route, false, null, null, ruri);
Thread.sleep(16000);
assertTrue(shootist.inviteRequest.getHeader(RecordRouteHeader.NAME).toString().contains("node_host"));
=======================================
---
/jar/src/test/java/org/mobicents/tools/sip/balancer/scalability/RollingUpgradeTest.java
Tue May 15 09:31:51 2012
+++
/jar/src/test/java/org/mobicents/tools/sip/balancer/scalability/RollingUpgradeTest.java
Mon Apr 22 05:50:26 2013
@@ -172,7 +172,8 @@
shootist.callerSendsBye=true;
shootist.sendInitialInvite();
//servers[0].sendHeartbeat = false;
- Thread.sleep(15000);
+ //Sleep in order for the old version nodes to be removed and then send
BYE
+ Thread.sleep(18000);
shootist.sendBye();
Thread.sleep(2000);
@@ -215,7 +216,6 @@
srv.version="2";
}
}
-
}
} else {
byeServer = source;
@@ -238,7 +238,7 @@
shootist.callerSendsBye=true;
shootist.sendInitialInvite();
//servers[0].sendHeartbeat = false;
- Thread.sleep(15000);
+ Thread.sleep(20000);
shootist.sendBye();
Thread.sleep(2000);
==============================================================================
Revision: 952bd875eeed
Author: [email protected] <[email protected]>
Date: Mon Apr 22 06:24:18 2013
Log: Merge remote-tracking branch 'origin/master'
http://code.google.com/p/commscale/source/detail?r=952bd875eeed&repo=load-balancer
--
---
You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.