Author: pero Date: Thu Jan 5 11:30:42 2006 New Revision: 366253 URL: http://svn.apache.org/viewcvs?rev=366253&view=rev Log: DataSender close socket after connection failure and throws Exception also even if waitForAck is false!
Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/DataSender.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java?rev=366253&r1=366252&r2=366253&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java Thu Jan 5 11:30:42 2006 @@ -268,11 +268,11 @@ ClusterData data = (ClusterData) entry.getValue(); messagesize = data.getMessage().length; sender.pushMessage(data); - outQueueCounter++; } catch (Exception x) { log.warn(sm.getString("AsyncSocketSender.send.error", entry.getKey())); } finally { + outQueueCounter++; decQueuedNrOfBytes(messagesize); } } 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=366253&r1=366252&r2=366253&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 Thu Jan 5 11:30:42 2006 @@ -822,7 +822,7 @@ closeSocket(); } exception = x; - // FIXME Hmm, throw the exception or not? + throw x ; } } finally { this.keepAliveCount++; Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java?rev=366253&r1=366252&r2=366253&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java Thu Jan 5 11:30:42 2006 @@ -474,12 +474,12 @@ ClusterData data = (ClusterData) entry.data(); messagesize = data.getMessage().length; sender.pushMessage(data); - outQueueCounter++; } catch (Exception x) { log.warn(sm.getString( "AsyncSocketSender.send.error", entry .getKey()), x); } finally { + outQueueCounter++; decQueuedNrOfBytes(messagesize); } entry = entry.next(); Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java?rev=366253&r1=366252&r2=366253&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java Thu Jan 5 11:30:42 2006 @@ -439,6 +439,7 @@ * Send to all senders at same cluster domain as message from address * @param message Cluster message to send * @since 5.5.10 + * FIXME Refactor with sendMessage get a sender list from */ public void sendMessageClusterDomain(ClusterMessage message) throws java.io.IOException { @@ -459,15 +460,12 @@ try { sendMessageData(data, sender); } catch (Exception x) { - if (!sender.getSuspect()) { - log.warn("Unable to send replicated message to " - + sender + ", is server down?", x); - sender.setSuspect(true); - } + // FIXME remember exception and send it at finally } } } } finally { + // FIXME better exception handling if (doTransmitterProcessingStats) { addProcessingStats(time); } @@ -478,6 +476,7 @@ /** * send message to all senders (broadcast) * @see org.apache.catalina.cluster.ClusterSender#sendMessage(org.apache.catalina.cluster.ClusterMessage) + * FIXME Refactor with sendMessageClusterDomain! */ public void sendMessage(ClusterMessage message) throws java.io.IOException { @@ -494,14 +493,11 @@ try { sendMessageData(data, sender); } catch (Exception x) { - if (!sender.getSuspect()) { - log.warn("Unable to send replicated message to " - + sender + ", is server down?", x); - sender.setSuspect(true); - } + // FIXME remember exception and send it at finally } } } finally { + // FIXME better exception handling if (doTransmitterProcessingStats) { addProcessingStats(time); } @@ -801,7 +797,8 @@ } /** - * serialize message and add timestamp + * serialize message and add timestamp from message + * handle compression * @see GZIPOutputStream * @param msg cluster message * @return cluster message as byte array @@ -819,7 +816,7 @@ data.setTimestamp(msg.getTimestamp()); data.setCompress(msg.getCompress()); data.setResend(msg.getResend()); - // FIXME add Stats how much comress and uncompress messages and bytes are transfered + // FIXME add stats: How much comress and uncompress messages and bytes are transfered if ((isCompress() && msg.getCompress() != ClusterMessage.FLAG_FORBIDDEN) || msg.getCompress() == ClusterMessage.FLAG_ALLOWED) { gout = new GZIPOutputStream(outs); Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java?rev=366253&r1=366252&r2=366253&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java Thu Jan 5 11:30:42 2006 @@ -914,17 +914,20 @@ * @throws ClassNotFoundException */ protected void registerClusterValve() throws Exception { - for (Iterator iter = valves.iterator(); iter.hasNext();) { - ClusterValve valve = (ClusterValve) iter.next(); - if (log.isDebugEnabled()) - log.debug("Invoking addValve on " + getContainer() - + " with class=" + valve.getClass().getName()); - if (valve != null) { - IntrospectionUtils.callMethodN(getContainer(), "addValve", - new Object[] { valve }, new Class[] { org.apache.catalina.Valve.class }); + if(container != null ) { + for (Iterator iter = valves.iterator(); iter.hasNext();) { + ClusterValve valve = (ClusterValve) iter.next(); + if (log.isDebugEnabled()) + log.debug("Invoking addValve on " + getContainer() + + " with class=" + valve.getClass().getName()); + if (valve != null) { + IntrospectionUtils.callMethodN(getContainer(), "addValve", + new Object[] { valve }, + new Class[] { org.apache.catalina.Valve.class }); + } + valve.setCluster(this); } - valve.setCluster(this); } } Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java?rev=366253&r1=366252&r2=366253&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/WorkerThread.java Thu Jan 5 11:30:42 2006 @@ -23,8 +23,6 @@ */ public class WorkerThread extends Thread { - private static org.apache.commons.logging.Log log = - org.apache.commons.logging.LogFactory.getLog( WorkerThread.class ); protected ThreadPool pool; protected boolean doRun = true; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]