tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common ChannelNioSocket.java ChannelSocket.java
Date Sat, 24 Sep 2005 23:53:23 GMT
billbarker    2005/09/24 16:53:23

  Modified:    jk/java/org/apache/jk/common ChannelNioSocket.java
                        ChannelSocket.java
  Log:
  Gracefully handle the case where some Socket options are disabled at the OS level.
  
  For reasons known only to Sun, Socket.setSoLinger actually throws an exception on some Solaris
systems.  Since I'm betting that virtually nobody ever sets this option explictly, just log
the error at DEBUG level and continue on.
  
  Revision  Changes    Path
  1.7       +17 -6     jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelNioSocket.java
  
  Index: ChannelNioSocket.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelNioSocket.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChannelNioSocket.java	27 Jul 2005 15:12:01 -0000	1.6
  +++ ChannelNioSocket.java	24 Sep 2005 23:53:22 -0000	1.7
  @@ -34,6 +34,7 @@
   import java.net.InetSocketAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  +import java.net.SocketException;
   
   import javax.management.ListenerNotFoundException;
   import javax.management.MBeanNotificationInfo;
  @@ -320,12 +321,12 @@
           ep.setNote( socketNote, s );
           if(log.isDebugEnabled() )
               log.debug("Accepted socket " + s +" channel "  + sc.isBlocking());
  -        if( linger > 0 )
  -            s.setSoLinger( true, linger);
  -        if( socketTimeout > 0 ) 
  -            s.setSoTimeout( socketTimeout );
  -        
  -        s.setTcpNoDelay( tcpNoDelay ); // set socket tcpnodelay state
  +
  +        try {
  +            setSocketOptions(s);
  +        } catch(SocketException sex) {
  +            log.debug("Error initializing Socket Options", sex);
  +        }
           
           requestCount++;
   
  @@ -337,6 +338,16 @@
           ep.setControl( tp );
       }
   
  +    private void setSocketOptions(Socket s) throws SocketException {
  +        if( socketTimeout > 0 ) 
  +            s.setSoTimeout( socketTimeout );
  +        
  +        s.setTcpNoDelay( tcpNoDelay ); // set socket tcpnodelay state
  +
  +        if( linger > 0 )
  +            s.setSoLinger( true, linger);
  +    }
  +
       public void resetCounters() {
           requestCount=0;
       }
  
  
  
  1.58      +16 -6     jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java
  
  Index: ChannelSocket.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- ChannelSocket.java	27 Jul 2005 15:12:01 -0000	1.57
  +++ ChannelSocket.java	24 Sep 2005 23:53:22 -0000	1.58
  @@ -294,12 +294,12 @@
           ep.setNote( socketNote, s );
           if(log.isDebugEnabled() )
               log.debug("Accepted socket " + s );
  -        if( linger > 0 )
  -            s.setSoLinger( true, linger);
  -        if( socketTimeout > 0 ) 
  -            s.setSoTimeout( socketTimeout );
  -        
  -        s.setTcpNoDelay( tcpNoDelay ); // set socket tcpnodelay state
  +
  +        try {
  +            setSocketOptions(s);
  +        } catch(SocketException sex) {
  +            log.debug("Error initializing Socket Options", sex);
  +        }
           
           requestCount++;
   
  @@ -314,6 +314,16 @@
           ep.setControl( tp );
       }
   
  +    private void setSocketOptions(Socket s) throws SocketException {
  +        if( socketTimeout > 0 ) 
  +            s.setSoTimeout( socketTimeout );
  +        
  +        s.setTcpNoDelay( tcpNoDelay ); // set socket tcpnodelay state
  +
  +        if( linger > 0 )
  +            s.setSoLinger( true, linger);
  +    }
  +
       public void resetCounters() {
           requestCount=0;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message