Author: fhanik
Date: Thu Mar 16 13:12:23 2006
New Revision: 386458
URL: http://svn.apache.org/viewcvs?rev=386458&view=rev
Log:
Implemented an autoBind feature, so that tcpListenPort doesn't have to be
unique, it can try to find an open port starting with the given port
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReceiverBase.java
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/BioReceiver.java
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReceiverBase.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReceiverBase.java?rev=386458&r1=386457&r2=386458&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReceiverBase.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/ReceiverBase.java
Thu Mar 16 13:12:23 2006
@@ -61,6 +61,8 @@
private long tcpSelectorTimeout;
private String tcpListenAddress;
private boolean sendAck;
+ //how many times to search for an available socket
+ private int autoBind = 1;
public ReceiverBase() {
}
@@ -257,6 +259,10 @@
return tcpListenAddress;
}
+ public int getAutoBind() {
+ return autoBind;
+ }
+
public void setTcpSelectorTimeout(long selTimeout) {
tcpSelectorTimeout = selTimeout;
}
@@ -291,5 +297,10 @@
public void setSendAck(boolean sendAck) {
this.sendAck = sendAck;
+ }
+
+ public void setAutoBind(int autoBind) {
+ this.autoBind = autoBind;
+ if ( this.autoBind <= 0 ) this.autoBind = 1;
}
}
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/BioReceiver.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/BioReceiver.java?rev=386458&r1=386457&r2=386458&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/BioReceiver.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/BioReceiver.java
Thu Mar 16 13:12:23 2006
@@ -99,7 +99,7 @@
serverSocket = new ServerSocket();
// set the port the server channel will listen to
//serverSocket.bind(new InetSocketAddress(getBind(),
getTcpListenPort()));
- bind(serverSocket,getPort(),10);
+ bind(serverSocket,getPort(),getAutoBind());
}
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java?rev=386458&r1=386457&r2=386458&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
Thu Mar 16 13:12:23 2006
@@ -120,7 +120,7 @@
selector = Selector.open();
// set the port the server channel will listen to
//serverSocket.bind(new InetSocketAddress(getBind(),
getTcpListenPort()));
- bind(serverSocket,getTcpListenPort(),10);
+ bind(serverSocket,getTcpListenPort(),getAutoBind());
// set non-blocking mode for the listening socket
serverChannel.configureBlocking(false);
// register the ServerSocketChannel with the Selector
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]