activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r434006 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Date Wed, 23 Aug 2006 10:54:46 GMT
Author: jstrachan
Date: Wed Aug 23 03:54:43 2006
New Revision: 434006

URL: http://svn.apache.org/viewvc?rev=434006&view=rev
Log:
added the ability to configure the TCP keepAlive option

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

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=434006&r1=434005&r2=434006&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Wed Aug 23 03:54:43 2006
@@ -64,6 +64,7 @@
     protected boolean trace;
     protected boolean useLocalHost = true;
     protected int minmumWireFormatVersion;
+    private Boolean keepAlive;
 
     /**
      * Connect to a remote Node - e.g. a Broker
@@ -206,11 +207,21 @@
     public void setConnectionTimeout(int connectionTimeout) {
         this.connectionTimeout = connectionTimeout;
     }
-    
+
+    public Boolean getKeepAlive() {
+        return keepAlive;
+    }
+
+    /**
+     * Enable/disable TCP KEEP_ALIVE mode
+     */
+    public void setKeepAlive(Boolean keepAlive) {
+        this.keepAlive = keepAlive;
+    }
+
 
     // Implementation methods
     // -------------------------------------------------------------------------
-
     protected String resolveHostName(String host) throws UnknownHostException {
         String localName = InetAddress.getLocalHost().getHostName();
         if (localName != null && isUseLocalHost()) {
@@ -237,6 +248,10 @@
             log.debug("Cannot set socket buffer size. Reason: " + se, se);
         }
         sock.setSoTimeout(soTimeout);
+        
+        if (keepAlive != null) {
+            sock.setKeepAlive(keepAlive.booleanValue());
+        }
     }
 
     protected void doStart() throws Exception {



Mime
View raw message