activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r429765 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
Date Tue, 08 Aug 2006 18:39:40 GMT
Author: jstrachan
Date: Tue Aug  8 11:39:39 2006
New Revision: 429765

URL: http://svn.apache.org/viewvc?rev=429765&view=rev
Log:
added a better exception message if we get a binding exception

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java?rev=429765&r1=429764&r2=429765&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
Tue Aug  8 11:39:39 2006
@@ -74,15 +74,19 @@
         String host = bind.getHost();
         host = (host == null || host.length() == 0) ? "localhost" : host;
         InetAddress addr = InetAddress.getByName(host);
-        
-        if (host.trim().equals("localhost") || addr.equals(InetAddress.getLocalHost())) {
-        	this.serverSocket = serverSocketFactory.createServerSocket(bind.getPort(), backlog);
+
+        try {
+            if (host.trim().equals("localhost") || addr.equals(InetAddress.getLocalHost()))
{
+                this.serverSocket = serverSocketFactory.createServerSocket(bind.getPort(),
backlog);
+            }
+            else {
+                this.serverSocket = serverSocketFactory.createServerSocket(bind.getPort(),
backlog, addr);
+            }
+            this.serverSocket.setSoTimeout(2000);
         }
-        else {
-        	this.serverSocket = serverSocketFactory.createServerSocket(bind.getPort(), backlog,
addr);
+        catch (IOException e) {
+            throw IOExceptionSupport.create("Failed to bind to server socket: " + bind +
" due to: " + e, e);
         }
-        this.serverSocket.setSoTimeout(2000);
-        
         try {
 			setConnectURI(new URI(bind.getScheme(), bind.getUserInfo(), resolveHostName(bind.getHost()),
serverSocket.getLocalPort(), bind.getPath(),
 					bind.getQuery(), bind.getFragment()));



Mime
View raw message