Author: pero Date: Sat Nov 12 04:36:42 2005 New Revision: 332768 URL: http://svn.apache.org/viewcvs?rev=332768&view=rev Log: Fix closed socket exceptions inside async modes. Some linux user have reported strange read exceptions. Sorry for that!
Modified: tomcat/container/tc5.5.x/modules/cluster/build.xml tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml Modified: tomcat/container/tc5.5.x/modules/cluster/build.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/build.xml?rev=332768&r1=332767&r2=332768&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/build.xml (original) +++ tomcat/container/tc5.5.x/modules/cluster/build.xml Sat Nov 12 04:36:42 2005 @@ -4,11 +4,12 @@ <!-- ===================== Initialize Property Values =================== --> <property file="../../../build.properties" /> - <property file="../../../jakarta-tomcat-5/build.properties.default" /> + <property file="../../../build/build.properties" /> + <property file="../../../build/build.properties.default" /> <!-- Build Defaults --> <property name="catalina.home" location="../.."/> - <property name="catalina.build" location="../../../jakarta-tomcat-5/build"/> + <property name="catalina.build" location="../../../build/build"/> <property name="cluster.build" value="${catalina.home}/modules/cluster/build"/> <property name="cluster.dist" value="${catalina.home}/modules/cluster/dist"/> Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml?rev=332768&r1=332767&r2=332768&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml Sat Nov 12 04:36:42 2005 @@ -5,6 +5,10 @@ <mbeans-descriptors> <mbean name="JvmRouteBinderValve" description="mod_jk jvmRoute jsessionid cookie backup correction" domain="Catalina" group="Valve" type="org.apache.catalina.cluster.session.JvmRouteBinderValve"> + <attribute name="className" + description="Fully qualified class name of the managed object" + type="java.lang.String" + writeable="false"/> <attribute name="info" description="describe version" type="java.lang.String" writeable="false"/> <attribute name="enabled" Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java?rev=332768&r1=332767&r2=332768&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java Sat Nov 12 04:36:42 2005 @@ -80,6 +80,11 @@ private boolean isSocketConnected = false; /** + * Message transfer over socket ? + */ + private boolean isMessageTransferStarted = false; + + /** * sender is in suspect state (last transfer failed) */ private boolean suspect; @@ -438,6 +443,13 @@ } /** + * @return Is DataSender send a message + */ + public boolean isMessageTransferStarted() { + return isMessageTransferStarted; + } + + /** * @param isSocketConnected * The isSocketConnected to set. */ @@ -577,13 +589,17 @@ */ public synchronized boolean checkKeepAlive() { boolean isCloseSocket = true ; - if(isConnected()) { - if ((keepAliveTimeout > -1 && (System.currentTimeMillis() - keepAliveConnectTime) > keepAliveTimeout) - || (keepAliveMaxRequestCount > -1 && keepAliveCount >= keepAliveMaxRequestCount)) { - closeSocket(); - } else - isCloseSocket = false ; - } + if(!isMessageTransferStarted) { + if(isConnected()) { + if ((keepAliveTimeout > -1 && (System.currentTimeMillis() - keepAliveConnectTime) > keepAliveTimeout) + || (keepAliveMaxRequestCount > -1 && keepAliveCount >= keepAliveMaxRequestCount)) { + closeSocket(); + } else + isCloseSocket = false ; + } + } else + isCloseSocket = false ; + return isCloseSocket; } @@ -766,6 +782,8 @@ checkKeepAlive(); if (!isConnected()) openSocket(); + else if(keepAliveTimeout > -1) + this.keepAliveConnectTime = System.currentTimeMillis(); } Exception exception = null; try { @@ -822,17 +840,25 @@ * @throws IOException * @since 5.5.10 */ - protected void writeData(ClusterData data) throws IOException { - OutputStream out = socket.getOutputStream(); - out.write(XByteBuffer.START_DATA); - out.write(XByteBuffer.toBytes(data.getCompress())); - out.write(XByteBuffer.toBytes(data.getMessage().length)); - out.write(data.getMessage()); - out.write(XByteBuffer.END_DATA); - out.flush(); - if (isWaitForAck()) - waitForAck(ackTimeout); - + protected void writeData(ClusterData data) throws IOException { + synchronized(this) { + isMessageTransferStarted = true ; + } + try { + OutputStream out = socket.getOutputStream(); + out.write(XByteBuffer.START_DATA); + out.write(XByteBuffer.toBytes(data.getCompress())); + out.write(XByteBuffer.toBytes(data.getMessage().length)); + out.write(data.getMessage()); + out.write(XByteBuffer.END_DATA); + out.flush(); + if (isWaitForAck()) + waitForAck(ackTimeout); + } finally { + synchronized(this) { + isMessageTransferStarted = false ; + } + } } /** Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=332768&r1=332767&r2=332768&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sat Nov 12 04:36:42 2005 @@ -115,6 +115,12 @@ <subsection name="Cluster"> <changelog> <fix> + Fix cluster module build.xml script for new svn repository structure (pero) + </fix> + <fix> + Fix closed socket exceptions inside async message transfer modes (pero) + </fix> + <fix> <bug>34984</bug>: HttpSessionBindingEvent.getValue() get correct value (pero) </fix> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]