[jboss-remoting-commits] JBoss Remoting SVN: r5079 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Apr 22 19:55:42 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-04-22 19:55:41 -0400 (Wed, 22 Apr 2009)
New Revision: 5079

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
Log:
JBREM-1120: Added writeTimeout variable.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java	2009-04-22 02:55:12 UTC (rev 5078)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java	2009-04-22 23:55:41 UTC (rev 5079)
@@ -51,6 +51,7 @@
 
    private InputStream in;
    private OutputStream out;
+   private int writeTimeout = -1;
 
    // Constructors ---------------------------------------------------------------------------------
 
@@ -78,6 +79,16 @@
       return in;
    }
 
+   public int getWriteTimeout()
+   {
+      return writeTimeout;
+   }
+
+   public void setWriteTimeout(int writeTimeout)
+   {
+      this.writeTimeout = writeTimeout;
+   }
+
    public void checkConnection() throws IOException
    {
       // Test to see if socket is alive by send ACK message
@@ -156,6 +167,15 @@
                log.trace("set temp timeout to: " + tempTimeout);
             }
          }
+         o = metadata.get(WRITE_TIMEOUT);
+         if (o instanceof Integer)
+         {
+            writeTimeout = ((Integer) o).intValue();
+            if (writeTimeout != -1)
+            {
+               log.trace("set writeTimeout to: " + writeTimeout);
+            }
+         }
       }
       
       out = createOutputStream(serializationType, socket, marshaller);
@@ -192,6 +212,11 @@
          log.warn("got null marshaller");
       
       OutputStream os = socket.getOutputStream();
+      if (writeTimeout > 0)
+      {
+         os = new TimedOutputStream(os, writeTimeout);
+      }
+      
       if (marshaller instanceof PreferredStreamMarshaller)
       {
          PreferredStreamMarshaller psm = (PreferredStreamMarshaller) marshaller;




More information about the jboss-remoting-commits mailing list