You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2006/10/24 05:11:48 UTC

svn commit: r467214 [3/3] - in /tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes: demos/ test/ test/channel/ test/interceptors/ test/io/ test/membership/ test/transport/

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/LoadTest.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/LoadTest.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/LoadTest.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/LoadTest.java Mon Oct 23 20:11:45 2006
@@ -1,425 +1,425 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.catalina.tribes.demos;
-
-import java.io.Serializable;
-import java.util.Random;
-
-import org.apache.catalina.tribes.ByteMessage;
-import org.apache.catalina.tribes.ChannelException;
-import org.apache.catalina.tribes.ChannelListener;
-import org.apache.catalina.tribes.ManagedChannel;
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.MembershipListener;
-import org.apache.catalina.tribes.io.XByteBuffer;
-import org.apache.catalina.tribes.Channel;
-import java.io.Externalizable;
-
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
-public class LoadTest implements MembershipListener,ChannelListener, Runnable {
-    protected static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoadTest.class);
-    public static int size = 24000;
-    public static Object mutex = new Object();
-    public boolean doRun = true;
-    
-    public long bytesReceived = 0;
-    public float mBytesReceived = 0;
-    public int  messagesReceived = 0;
-    public boolean send = true;
-    public boolean debug = false;
-    public int msgCount = 100;
-    ManagedChannel channel=null;
-    public int statsInterval = 10000;
-    public long pause = 0;
-    public boolean breakonChannelException = false;
-    public boolean async = false;
-    public long receiveStart = 0;
-    public int channelOptions = Channel.SEND_OPTIONS_DEFAULT;
-    
-    static int messageSize = 0;
-    
-    public static long messagesSent = 0;
-    public static long messageStartSendTime = 0;
-    public static long messageEndSendTime = 0;
-    public static int  threadCount = 0;
-    
-    public static synchronized void startTest() {
-        threadCount++;
-        if ( messageStartSendTime == 0 ) messageStartSendTime = System.currentTimeMillis();
-    }
-    
-    public static synchronized void endTest() {
-        threadCount--;
-        if ( messageEndSendTime == 0 && threadCount==0 ) messageEndSendTime = System.currentTimeMillis();
-    }
-
-    
-    public static synchronized long addSendStats(long count) {
-        messagesSent+=count;
-        return 0l;
-    }    
-    
-    private static void printSendStats(long counter, int messageSize) {
-        float cnt = (float)counter;
-        float size = (float)messageSize;
-        float time = (float)(System.currentTimeMillis()-messageStartSendTime) / 1000f;
-        log.info("****SEND STATS-"+Thread.currentThread().getName()+"*****"+
-                 "\n\tMessage count:"+counter+
-                 "\n\tTotal bytes  :"+(long)(size*cnt)+
-                 "\n\tTotal seconds:"+(time)+
-                 "\n\tBytes/second :"+(size*cnt/time)+
-                 "\n\tMBytes/second:"+(size*cnt/time/1024f/1024f));
-    }
-
-    
-    
-    public LoadTest(ManagedChannel channel, 
-                    boolean send,
-                    int msgCount,
-                    boolean debug,
-                    long pause,
-                    int stats,
-                    boolean breakOnEx) {
-        this.channel = channel;
-        this.send = send;
-        this.msgCount = msgCount;
-        this.debug = debug;
-        this.pause = pause;
-        this.statsInterval = stats;
-        this.breakonChannelException = breakOnEx;
-    }
-    
-    
-    
-    public void run() {
-        
-        long counter = 0;
-        long total = 0;
-        LoadMessage msg = new LoadMessage();
-        int messageSize = LoadTest.messageSize;
-        
-        try {
-            startTest();
-            while (total < msgCount) {
-                if (channel.getMembers().length == 0 || (!send)) {
-                    synchronized (mutex) {
-                        try {
-                            mutex.wait();
-                        } catch (InterruptedException x) {
-                            log.info("Thread interrupted from wait");
-                        }
-                    }
-                } else {
-                    try {
-                        //msg.setMsgNr((int)++total);
-                        counter++;
-                        if (debug) {
-                            printArray(msg.getMessage());
-                        }
-                        channel.send(channel.getMembers(), msg, channelOptions);
-                        if ( pause > 0 ) {
-                            if ( debug) System.out.println("Pausing sender for "+pause+" ms.");
-                            Thread.sleep(pause);
-                        }
-                    } catch (ChannelException x) {
-                        if ( debug ) log.error("Unable to send message:"+x.getMessage(),x);
-                        log.error("Unable to send message:"+x.getMessage());
-                        ChannelException.FaultyMember[] faulty = x.getFaultyMembers();
-                        for (int i=0; i<faulty.length; i++ ) log.error("Faulty: "+faulty[i]);
-                        --counter;
-                        if ( this.breakonChannelException ) throw x;
-                    }
-                }
-                if ( (counter % statsInterval) == 0 && (counter > 0)) {
-                    //add to the global counter
-                    counter = addSendStats(counter);
-                    //print from the global counter
-                    //printSendStats(LoadTest.messagesSent, LoadTest.messageSize, LoadTest.messageSendTime);
-                    printSendStats(LoadTest.messagesSent, LoadTest.messageSize);
-                    
-                }
-
-            }
-        }catch ( Exception x ) {
-            log.error("Captured error while sending:"+x.getMessage());
-            if ( debug ) log.error("",x);
-            printSendStats(LoadTest.messagesSent, LoadTest.messageSize);
-        }
-        endTest();
-    }
-
-    
-
-    /**
-     * memberAdded
-     *
-     * @param member Member
-     * @todo Implement this org.apache.catalina.tribes.MembershipListener
-     *   method
-     */
-    public void memberAdded(Member member) {
-        log.info("Member added:"+member);
-        synchronized (mutex) {
-            mutex.notifyAll();
-        }
-    }
-
-    /**
-     * memberDisappeared
-     *
-     * @param member Member
-     * @todo Implement this org.apache.catalina.tribes.MembershipListener
-     *   method
-     */
-    public void memberDisappeared(Member member) {
-        log.info("Member disappeared:"+member);
-    }
-    
-    public boolean accept(Serializable msg, Member mbr){ 
-       return (msg instanceof LoadMessage) || (msg instanceof ByteMessage);
-    }
-    
-    public void messageReceived(Serializable msg, Member mbr){ 
-        if ( receiveStart == 0 ) receiveStart = System.currentTimeMillis();
-        if ( debug ) {
-            if ( msg instanceof LoadMessage ) {
-                printArray(((LoadMessage)msg).getMessage());
-            }
-        }
-        
-        if ( msg instanceof ByteMessage && !(msg instanceof LoadMessage)) {
-            LoadMessage tmp = new LoadMessage();
-            tmp.setMessage(((ByteMessage)msg).getMessage());
-            msg = tmp;
-            tmp = null;
-        }
-        
-        
-        bytesReceived+=((LoadMessage)msg).getMessage().length;
-        mBytesReceived+=((float)((LoadMessage)msg).getMessage().length)/1024f/1024f;
-        messagesReceived++;
-        if ( (messagesReceived%statsInterval)==0 || (messagesReceived==msgCount)) {
-            float bytes = (float)(((LoadMessage)msg).getMessage().length*messagesReceived);
-            float seconds = ((float)(System.currentTimeMillis()-receiveStart)) / 1000f;
-            log.info("****RECEIVE STATS-"+Thread.currentThread().getName()+"*****"+
-                     "\n\tMessage count :"+(long)messagesReceived+
-                     "\n\tTotal bytes   :"+(long)bytes+
-                     "\n\tTotal mbytes  :"+(long)mBytesReceived+
-                     "\n\tTime since 1st:"+seconds+" seconds"+
-                     "\n\tBytes/second  :"+(bytes/seconds)+
-                     "\n\tMBytes/second :"+(mBytesReceived/seconds)+"\n");
-
-        }
-    }
-    
-    
-    public static void printArray(byte[] data) {
-        System.out.print("{");
-        for (int i=0; i<data.length; i++ ) {
-            System.out.print(data[i]);
-            System.out.print(",");
-        }
-        System.out.println("} size:"+data.length);
-    }
-
-    
-    
-    //public static class LoadMessage implements Serializable  {
-    public static class LoadMessage extends ByteMessage  implements Serializable {
-        
-        public static byte[] outdata = new byte[size];
-        public static Random r = new Random(System.currentTimeMillis());
-        public static int getMessageSize (LoadMessage msg) {
-            int messageSize = msg.getMessage().length;
-            if ( ((Object)msg) instanceof ByteMessage ) return messageSize;
-            try {
-                messageSize  = XByteBuffer.serialize(new LoadMessage()).length;
-                log.info("Average message size:" + messageSize + " bytes");
-            } catch (Exception x) {
-                log.error("Unable to calculate test message size.", x);
-            }
-            return messageSize;
-        }
-        static {
-            r.nextBytes(outdata);
-        }
-        
-        protected byte[] message = getMessage();
-        
-        public LoadMessage() {
-        }
-        
-        public byte[] getMessage() {
-            if ( message == null ) {
-                message = outdata;
-            }
-            return message;
-        }
-        
-        public void setMessage(byte[] data) {
-            this.message = data;
-        }
-    }
-    
-    public static void usage() {
-        System.out.println("Tribes Load tester.");
-        System.out.println("The load tester can be used in sender or received mode or both");
-        System.out.println("Usage:\n\t"+
-                           "java LoadTest [options]\n\t"+
-                           "Options:\n\t\t"+
-                           "[-mode receive|send|both]  \n\t\t"+
-                           "[-startoptions startflags (default is Channel.DEFAULT) ]  \n\t\t"+
-                           "[-debug]  \n\t\t"+
-                           "[-count messagecount]  \n\t\t"+
-                           "[-stats statinterval]  \n\t\t"+
-                           "[-pause nrofsecondstopausebetweensends]  \n\t\t"+
-                           "[-threads numberofsenderthreads]  \n\t\t"+
-                           "[-size messagesize]  \n\t\t"+
-                           "[-sendoptions channeloptions]  \n\t\t"+
-                           "[-break (halts execution on exception)]\n"+
-                           "[-shutdown (issues a channel.stop() command after send is completed)]\n"+
-                           "\tChannel options:"+
-                           ChannelCreator.usage()+"\n\n"+
-                           "Example:\n\t"+
-                           "java LoadTest -port 4004\n\t"+
-                           "java LoadTest -bind 192.168.0.45 -port 4005\n\t"+
-                           "java LoadTest -bind 192.168.0.45 -port 4005 -mbind 192.168.0.45 -count 100 -stats 10\n");
-    }
-    
-    public static void main(String[] args) throws Exception {
-        boolean send = true;
-        boolean debug = false;
-        long pause = 0;
-        int count = 1000000;
-        int stats = 10000;
-        boolean breakOnEx = false;
-        int threads = 1;
-        boolean shutdown = false;
-        int startoptions = Channel.DEFAULT;
-        int channelOptions = Channel.SEND_OPTIONS_DEFAULT;
-        if ( args.length == 0 ) {
-            args = new String[] {"-help"};
-        }
-        for (int i = 0; i < args.length; i++) {
-            if ("-threads".equals(args[i])) {
-                threads = Integer.parseInt(args[++i]);
-            } else if ("-count".equals(args[i])) {
-                count = Integer.parseInt(args[++i]);
-                System.out.println("Sending "+count+" messages.");
-            } else if ("-pause".equals(args[i])) {
-                pause = Long.parseLong(args[++i])*1000;
-            } else if ("-break".equals(args[i])) {
-                breakOnEx = true;
-            } else if ("-shutdown".equals(args[i])) {
-                shutdown = true;
-            } else if ("-stats".equals(args[i])) {
-                stats = Integer.parseInt(args[++i]);
-                System.out.println("Stats every "+stats+" message");
-            } else if ("-sendoptions".equals(args[i])) {
-                channelOptions = Integer.parseInt(args[++i]);
-                System.out.println("Setting send options to "+channelOptions);
-            } else if ("-startoptions".equals(args[i])) {
-                startoptions = Integer.parseInt(args[++i]);
-                System.out.println("Setting start options to "+startoptions);
-            } else if ("-size".equals(args[i])) {
-                size = Integer.parseInt(args[++i])-4;
-                System.out.println("Message size will be:"+(size+4)+" bytes");
-            } else if ("-mode".equals(args[i])) {
-                if ( "receive".equals(args[++i]) ) send = false;
-            } else if ("-debug".equals(args[i])) {
-                debug = true;
-            } else if ("-help".equals(args[i])) 
-            {
-                usage();
-                System.exit(1);
-            }
-        }
-        
-        ManagedChannel channel = (ManagedChannel)ChannelCreator.createChannel(args);
-        
-        LoadTest test = new LoadTest(channel,send,count,debug,pause,stats,breakOnEx);
-        test.channelOptions = channelOptions;
-        LoadMessage msg = new LoadMessage();
-        
-        messageSize = LoadMessage.getMessageSize(msg);
-        channel.addChannelListener(test);
-        channel.addMembershipListener(test);
-        channel.start(startoptions);
-        Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
-        while ( threads > 1 ) {
-            Thread t = new Thread(test);
-            t.setDaemon(true);
-            t.start();
-            threads--;
-            test = new LoadTest(channel,send,count,debug,pause,stats,breakOnEx);
-            test.channelOptions = channelOptions;
-        }
-        test.run();
-        if ( shutdown && send ) channel.stop(channel.DEFAULT);
-        System.out.println("System test complete, sleeping to let threads finish.");
-        Thread.sleep(60*1000*60);
-    } 
-    
-    public static class Shutdown extends Thread {
-        ManagedChannel channel = null;
-        public Shutdown(ManagedChannel channel) {
-            this.channel = channel;
-        }
-        
-        public void run() {
-            System.out.println("Shutting down...");
-            SystemExit exit = new SystemExit(5000);
-            exit.setDaemon(true);
-            exit.start();
-            try {
-                channel.stop(channel.DEFAULT);
-                
-            }catch ( Exception x ) {
-                x.printStackTrace();
-            }
-            System.out.println("Channel stopped.");
-        }
-    }
-    public static class SystemExit extends Thread {
-        private long delay;
-        public SystemExit(long delay) {
-            this.delay = delay;
-        }
-        public void run () {
-            try {
-                Thread.sleep(delay);
-            }catch ( Exception x ) {
-                x.printStackTrace();
-            }
-            System.exit(0);
-
-        }
-    }
-    
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.tribes.demos;
+
+import java.io.Serializable;
+import java.util.Random;
+
+import org.apache.catalina.tribes.ByteMessage;
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.ManagedChannel;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.MembershipListener;
+import org.apache.catalina.tribes.io.XByteBuffer;
+import org.apache.catalina.tribes.Channel;
+import java.io.Externalizable;
+
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ * <p>Copyright: Copyright (c) 2005</p>
+ *
+ * <p>Company: </p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public class LoadTest implements MembershipListener,ChannelListener, Runnable {
+    protected static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoadTest.class);
+    public static int size = 24000;
+    public static Object mutex = new Object();
+    public boolean doRun = true;
+    
+    public long bytesReceived = 0;
+    public float mBytesReceived = 0;
+    public int  messagesReceived = 0;
+    public boolean send = true;
+    public boolean debug = false;
+    public int msgCount = 100;
+    ManagedChannel channel=null;
+    public int statsInterval = 10000;
+    public long pause = 0;
+    public boolean breakonChannelException = false;
+    public boolean async = false;
+    public long receiveStart = 0;
+    public int channelOptions = Channel.SEND_OPTIONS_DEFAULT;
+    
+    static int messageSize = 0;
+    
+    public static long messagesSent = 0;
+    public static long messageStartSendTime = 0;
+    public static long messageEndSendTime = 0;
+    public static int  threadCount = 0;
+    
+    public static synchronized void startTest() {
+        threadCount++;
+        if ( messageStartSendTime == 0 ) messageStartSendTime = System.currentTimeMillis();
+    }
+    
+    public static synchronized void endTest() {
+        threadCount--;
+        if ( messageEndSendTime == 0 && threadCount==0 ) messageEndSendTime = System.currentTimeMillis();
+    }
+
+    
+    public static synchronized long addSendStats(long count) {
+        messagesSent+=count;
+        return 0l;
+    }    
+    
+    private static void printSendStats(long counter, int messageSize) {
+        float cnt = (float)counter;
+        float size = (float)messageSize;
+        float time = (float)(System.currentTimeMillis()-messageStartSendTime) / 1000f;
+        log.info("****SEND STATS-"+Thread.currentThread().getName()+"*****"+
+                 "\n\tMessage count:"+counter+
+                 "\n\tTotal bytes  :"+(long)(size*cnt)+
+                 "\n\tTotal seconds:"+(time)+
+                 "\n\tBytes/second :"+(size*cnt/time)+
+                 "\n\tMBytes/second:"+(size*cnt/time/1024f/1024f));
+    }
+
+    
+    
+    public LoadTest(ManagedChannel channel, 
+                    boolean send,
+                    int msgCount,
+                    boolean debug,
+                    long pause,
+                    int stats,
+                    boolean breakOnEx) {
+        this.channel = channel;
+        this.send = send;
+        this.msgCount = msgCount;
+        this.debug = debug;
+        this.pause = pause;
+        this.statsInterval = stats;
+        this.breakonChannelException = breakOnEx;
+    }
+    
+    
+    
+    public void run() {
+        
+        long counter = 0;
+        long total = 0;
+        LoadMessage msg = new LoadMessage();
+        int messageSize = LoadTest.messageSize;
+        
+        try {
+            startTest();
+            while (total < msgCount) {
+                if (channel.getMembers().length == 0 || (!send)) {
+                    synchronized (mutex) {
+                        try {
+                            mutex.wait();
+                        } catch (InterruptedException x) {
+                            log.info("Thread interrupted from wait");
+                        }
+                    }
+                } else {
+                    try {
+                        //msg.setMsgNr((int)++total);
+                        counter++;
+                        if (debug) {
+                            printArray(msg.getMessage());
+                        }
+                        channel.send(channel.getMembers(), msg, channelOptions);
+                        if ( pause > 0 ) {
+                            if ( debug) System.out.println("Pausing sender for "+pause+" ms.");
+                            Thread.sleep(pause);
+                        }
+                    } catch (ChannelException x) {
+                        if ( debug ) log.error("Unable to send message:"+x.getMessage(),x);
+                        log.error("Unable to send message:"+x.getMessage());
+                        ChannelException.FaultyMember[] faulty = x.getFaultyMembers();
+                        for (int i=0; i<faulty.length; i++ ) log.error("Faulty: "+faulty[i]);
+                        --counter;
+                        if ( this.breakonChannelException ) throw x;
+                    }
+                }
+                if ( (counter % statsInterval) == 0 && (counter > 0)) {
+                    //add to the global counter
+                    counter = addSendStats(counter);
+                    //print from the global counter
+                    //printSendStats(LoadTest.messagesSent, LoadTest.messageSize, LoadTest.messageSendTime);
+                    printSendStats(LoadTest.messagesSent, LoadTest.messageSize);
+                    
+                }
+
+            }
+        }catch ( Exception x ) {
+            log.error("Captured error while sending:"+x.getMessage());
+            if ( debug ) log.error("",x);
+            printSendStats(LoadTest.messagesSent, LoadTest.messageSize);
+        }
+        endTest();
+    }
+
+    
+
+    /**
+     * memberAdded
+     *
+     * @param member Member
+     * @todo Implement this org.apache.catalina.tribes.MembershipListener
+     *   method
+     */
+    public void memberAdded(Member member) {
+        log.info("Member added:"+member);
+        synchronized (mutex) {
+            mutex.notifyAll();
+        }
+    }
+
+    /**
+     * memberDisappeared
+     *
+     * @param member Member
+     * @todo Implement this org.apache.catalina.tribes.MembershipListener
+     *   method
+     */
+    public void memberDisappeared(Member member) {
+        log.info("Member disappeared:"+member);
+    }
+    
+    public boolean accept(Serializable msg, Member mbr){ 
+       return (msg instanceof LoadMessage) || (msg instanceof ByteMessage);
+    }
+    
+    public void messageReceived(Serializable msg, Member mbr){ 
+        if ( receiveStart == 0 ) receiveStart = System.currentTimeMillis();
+        if ( debug ) {
+            if ( msg instanceof LoadMessage ) {
+                printArray(((LoadMessage)msg).getMessage());
+            }
+        }
+        
+        if ( msg instanceof ByteMessage && !(msg instanceof LoadMessage)) {
+            LoadMessage tmp = new LoadMessage();
+            tmp.setMessage(((ByteMessage)msg).getMessage());
+            msg = tmp;
+            tmp = null;
+        }
+        
+        
+        bytesReceived+=((LoadMessage)msg).getMessage().length;
+        mBytesReceived+=((float)((LoadMessage)msg).getMessage().length)/1024f/1024f;
+        messagesReceived++;
+        if ( (messagesReceived%statsInterval)==0 || (messagesReceived==msgCount)) {
+            float bytes = (float)(((LoadMessage)msg).getMessage().length*messagesReceived);
+            float seconds = ((float)(System.currentTimeMillis()-receiveStart)) / 1000f;
+            log.info("****RECEIVE STATS-"+Thread.currentThread().getName()+"*****"+
+                     "\n\tMessage count :"+(long)messagesReceived+
+                     "\n\tTotal bytes   :"+(long)bytes+
+                     "\n\tTotal mbytes  :"+(long)mBytesReceived+
+                     "\n\tTime since 1st:"+seconds+" seconds"+
+                     "\n\tBytes/second  :"+(bytes/seconds)+
+                     "\n\tMBytes/second :"+(mBytesReceived/seconds)+"\n");
+
+        }
+    }
+    
+    
+    public static void printArray(byte[] data) {
+        System.out.print("{");
+        for (int i=0; i<data.length; i++ ) {
+            System.out.print(data[i]);
+            System.out.print(",");
+        }
+        System.out.println("} size:"+data.length);
+    }
+
+    
+    
+    //public static class LoadMessage implements Serializable  {
+    public static class LoadMessage extends ByteMessage  implements Serializable {
+        
+        public static byte[] outdata = new byte[size];
+        public static Random r = new Random(System.currentTimeMillis());
+        public static int getMessageSize (LoadMessage msg) {
+            int messageSize = msg.getMessage().length;
+            if ( ((Object)msg) instanceof ByteMessage ) return messageSize;
+            try {
+                messageSize  = XByteBuffer.serialize(new LoadMessage()).length;
+                log.info("Average message size:" + messageSize + " bytes");
+            } catch (Exception x) {
+                log.error("Unable to calculate test message size.", x);
+            }
+            return messageSize;
+        }
+        static {
+            r.nextBytes(outdata);
+        }
+        
+        protected byte[] message = getMessage();
+        
+        public LoadMessage() {
+        }
+        
+        public byte[] getMessage() {
+            if ( message == null ) {
+                message = outdata;
+            }
+            return message;
+        }
+        
+        public void setMessage(byte[] data) {
+            this.message = data;
+        }
+    }
+    
+    public static void usage() {
+        System.out.println("Tribes Load tester.");
+        System.out.println("The load tester can be used in sender or received mode or both");
+        System.out.println("Usage:\n\t"+
+                           "java LoadTest [options]\n\t"+
+                           "Options:\n\t\t"+
+                           "[-mode receive|send|both]  \n\t\t"+
+                           "[-startoptions startflags (default is Channel.DEFAULT) ]  \n\t\t"+
+                           "[-debug]  \n\t\t"+
+                           "[-count messagecount]  \n\t\t"+
+                           "[-stats statinterval]  \n\t\t"+
+                           "[-pause nrofsecondstopausebetweensends]  \n\t\t"+
+                           "[-threads numberofsenderthreads]  \n\t\t"+
+                           "[-size messagesize]  \n\t\t"+
+                           "[-sendoptions channeloptions]  \n\t\t"+
+                           "[-break (halts execution on exception)]\n"+
+                           "[-shutdown (issues a channel.stop() command after send is completed)]\n"+
+                           "\tChannel options:"+
+                           ChannelCreator.usage()+"\n\n"+
+                           "Example:\n\t"+
+                           "java LoadTest -port 4004\n\t"+
+                           "java LoadTest -bind 192.168.0.45 -port 4005\n\t"+
+                           "java LoadTest -bind 192.168.0.45 -port 4005 -mbind 192.168.0.45 -count 100 -stats 10\n");
+    }
+    
+    public static void main(String[] args) throws Exception {
+        boolean send = true;
+        boolean debug = false;
+        long pause = 0;
+        int count = 1000000;
+        int stats = 10000;
+        boolean breakOnEx = false;
+        int threads = 1;
+        boolean shutdown = false;
+        int startoptions = Channel.DEFAULT;
+        int channelOptions = Channel.SEND_OPTIONS_DEFAULT;
+        if ( args.length == 0 ) {
+            args = new String[] {"-help"};
+        }
+        for (int i = 0; i < args.length; i++) {
+            if ("-threads".equals(args[i])) {
+                threads = Integer.parseInt(args[++i]);
+            } else if ("-count".equals(args[i])) {
+                count = Integer.parseInt(args[++i]);
+                System.out.println("Sending "+count+" messages.");
+            } else if ("-pause".equals(args[i])) {
+                pause = Long.parseLong(args[++i])*1000;
+            } else if ("-break".equals(args[i])) {
+                breakOnEx = true;
+            } else if ("-shutdown".equals(args[i])) {
+                shutdown = true;
+            } else if ("-stats".equals(args[i])) {
+                stats = Integer.parseInt(args[++i]);
+                System.out.println("Stats every "+stats+" message");
+            } else if ("-sendoptions".equals(args[i])) {
+                channelOptions = Integer.parseInt(args[++i]);
+                System.out.println("Setting send options to "+channelOptions);
+            } else if ("-startoptions".equals(args[i])) {
+                startoptions = Integer.parseInt(args[++i]);
+                System.out.println("Setting start options to "+startoptions);
+            } else if ("-size".equals(args[i])) {
+                size = Integer.parseInt(args[++i])-4;
+                System.out.println("Message size will be:"+(size+4)+" bytes");
+            } else if ("-mode".equals(args[i])) {
+                if ( "receive".equals(args[++i]) ) send = false;
+            } else if ("-debug".equals(args[i])) {
+                debug = true;
+            } else if ("-help".equals(args[i])) 
+            {
+                usage();
+                System.exit(1);
+            }
+        }
+        
+        ManagedChannel channel = (ManagedChannel)ChannelCreator.createChannel(args);
+        
+        LoadTest test = new LoadTest(channel,send,count,debug,pause,stats,breakOnEx);
+        test.channelOptions = channelOptions;
+        LoadMessage msg = new LoadMessage();
+        
+        messageSize = LoadMessage.getMessageSize(msg);
+        channel.addChannelListener(test);
+        channel.addMembershipListener(test);
+        channel.start(startoptions);
+        Runtime.getRuntime().addShutdownHook(new Shutdown(channel));
+        while ( threads > 1 ) {
+            Thread t = new Thread(test);
+            t.setDaemon(true);
+            t.start();
+            threads--;
+            test = new LoadTest(channel,send,count,debug,pause,stats,breakOnEx);
+            test.channelOptions = channelOptions;
+        }
+        test.run();
+        if ( shutdown && send ) channel.stop(channel.DEFAULT);
+        System.out.println("System test complete, sleeping to let threads finish.");
+        Thread.sleep(60*1000*60);
+    } 
+    
+    public static class Shutdown extends Thread {
+        ManagedChannel channel = null;
+        public Shutdown(ManagedChannel channel) {
+            this.channel = channel;
+        }
+        
+        public void run() {
+            System.out.println("Shutting down...");
+            SystemExit exit = new SystemExit(5000);
+            exit.setDaemon(true);
+            exit.start();
+            try {
+                channel.stop(channel.DEFAULT);
+                
+            }catch ( Exception x ) {
+                x.printStackTrace();
+            }
+            System.out.println("Channel stopped.");
+        }
+    }
+    public static class SystemExit extends Thread {
+        private long delay;
+        public SystemExit(long delay) {
+            this.delay = delay;
+        }
+        public void run () {
+            try {
+                Thread.sleep(delay);
+            }catch ( Exception x ) {
+                x.printStackTrace();
+            }
+            System.exit(0);
+
+        }
+    }
+    
 }

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/LoadTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/LoadTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/TestNioSender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/TestNioSender.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/TribesTestSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/TribesTestSuite.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/ChannelStartStop.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/ChannelStartStop.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/ChannelStartStop.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/ChannelStartStop.java Mon Oct 23 20:11:45 2006
@@ -1,119 +1,119 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- */
-package org.apache.catalina.tribes.test.channel;
-
-import org.apache.catalina.tribes.group.GroupChannel;
-import junit.framework.TestCase;
-
-/**
- * @author Filip Hanik
- * @version 1.0
- */
-public class ChannelStartStop extends TestCase {
-    GroupChannel channel = null;
-    protected void setUp() throws Exception {
-        super.setUp();
-        channel = new GroupChannel();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        try {channel.stop(channel.DEFAULT);}catch (Exception ignore){}
-    }
-    
-    public void testDoubleFullStart() throws Exception {
-        int count = 0;
-        try {
-            channel.start(channel.DEFAULT);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        try {
-            channel.start(channel.DEFAULT);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        assertEquals(count,2);
-        channel.stop(channel.DEFAULT);
-    }
-
-    public void testDoublePartialStart() throws Exception {
-        //try to double start the RX 
-        int count = 0;
-        try {
-            channel.start(channel.SND_RX_SEQ);
-            channel.start(channel.MBR_RX_SEQ);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        try {
-            channel.start(channel.MBR_RX_SEQ);
-            count++;
-        } catch ( Exception x){/*expected*/}
-        assertEquals(count,1);
-        channel.stop(channel.DEFAULT);
-        //double the membership sender
-        count = 0;
-        try {
-            channel.start(channel.SND_RX_SEQ);
-            channel.start(channel.MBR_TX_SEQ);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        try {
-            channel.start(channel.MBR_TX_SEQ);
-            count++;
-        } catch ( Exception x){/*expected*/}
-        assertEquals(count,1);
-        channel.stop(channel.DEFAULT);
-        
-        count = 0;
-        try {
-            channel.start(channel.SND_RX_SEQ);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        try {
-            channel.start(channel.SND_RX_SEQ);
-            count++;
-        } catch ( Exception x){/*expected*/}
-        assertEquals(count,1);
-        channel.stop(channel.DEFAULT);
-
-        count = 0;
-        try {
-            channel.start(channel.SND_TX_SEQ);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        try {
-            channel.start(channel.SND_TX_SEQ);
-            count++;
-        } catch ( Exception x){/*expected*/}
-        assertEquals(count,1);
-        channel.stop(channel.DEFAULT);
-    }
-    
-    public void testFalseOption() throws Exception {
-        int flag = 0xFFF0;//should get ignored by the underlying components
-        int count = 0;
-        try {
-            channel.start(flag);
-            count++;
-        } catch ( Exception x){x.printStackTrace();}
-        try {
-            channel.start(flag);
-            count++;
-        } catch ( Exception x){/*expected*/}
-        assertEquals(count,2);
-        channel.stop(channel.DEFAULT);
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ */
+package org.apache.catalina.tribes.test.channel;
+
+import org.apache.catalina.tribes.group.GroupChannel;
+import junit.framework.TestCase;
+
+/**
+ * @author Filip Hanik
+ * @version 1.0
+ */
+public class ChannelStartStop extends TestCase {
+    GroupChannel channel = null;
+    protected void setUp() throws Exception {
+        super.setUp();
+        channel = new GroupChannel();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        try {channel.stop(channel.DEFAULT);}catch (Exception ignore){}
+    }
+    
+    public void testDoubleFullStart() throws Exception {
+        int count = 0;
+        try {
+            channel.start(channel.DEFAULT);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        try {
+            channel.start(channel.DEFAULT);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        assertEquals(count,2);
+        channel.stop(channel.DEFAULT);
+    }
+
+    public void testDoublePartialStart() throws Exception {
+        //try to double start the RX 
+        int count = 0;
+        try {
+            channel.start(channel.SND_RX_SEQ);
+            channel.start(channel.MBR_RX_SEQ);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        try {
+            channel.start(channel.MBR_RX_SEQ);
+            count++;
+        } catch ( Exception x){/*expected*/}
+        assertEquals(count,1);
+        channel.stop(channel.DEFAULT);
+        //double the membership sender
+        count = 0;
+        try {
+            channel.start(channel.SND_RX_SEQ);
+            channel.start(channel.MBR_TX_SEQ);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        try {
+            channel.start(channel.MBR_TX_SEQ);
+            count++;
+        } catch ( Exception x){/*expected*/}
+        assertEquals(count,1);
+        channel.stop(channel.DEFAULT);
+        
+        count = 0;
+        try {
+            channel.start(channel.SND_RX_SEQ);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        try {
+            channel.start(channel.SND_RX_SEQ);
+            count++;
+        } catch ( Exception x){/*expected*/}
+        assertEquals(count,1);
+        channel.stop(channel.DEFAULT);
+
+        count = 0;
+        try {
+            channel.start(channel.SND_TX_SEQ);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        try {
+            channel.start(channel.SND_TX_SEQ);
+            count++;
+        } catch ( Exception x){/*expected*/}
+        assertEquals(count,1);
+        channel.stop(channel.DEFAULT);
+    }
+    
+    public void testFalseOption() throws Exception {
+        int flag = 0xFFF0;//should get ignored by the underlying components
+        int count = 0;
+        try {
+            channel.start(flag);
+            count++;
+        } catch ( Exception x){x.printStackTrace();}
+        try {
+            channel.start(flag);
+            count++;
+        } catch ( Exception x){/*expected*/}
+        assertEquals(count,2);
+        channel.stop(channel.DEFAULT);
+    }
+
+}

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/ChannelStartStop.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/ChannelStartStop.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestChannelOptionFlag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestChannelOptionFlag.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java Mon Oct 23 20:11:45 2006
@@ -1,123 +1,123 @@
-package org.apache.catalina.tribes.test.channel;
-
-import junit.framework.TestCase;
-import java.io.Serializable;
-import java.util.Random;
-import java.util.Arrays;
-import org.apache.catalina.tribes.ChannelListener;
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.group.GroupChannel;
-import java.io.PrintStream;
-
-/**
- * <p>Title: </p> 
- * 
- * <p>Description: </p> 
- * 
- * <p>Copyright: Copyright (c) 2005</p> 
- * 
- * <p>Company: </p>
- * 
- * @author not attributable
- * @version 1.0
- */
-public class TestRemoteProcessException extends TestCase {
-    int msgCount = 10000;
-    GroupChannel channel1;
-    GroupChannel channel2;
-    Listener listener1;
-    protected void setUp() throws Exception {
-        super.setUp();
-        channel1 = new GroupChannel();
-        channel2 = new GroupChannel();
-        listener1 = new Listener();
-        channel2.addChannelListener(listener1);
-        channel1.start(GroupChannel.DEFAULT);
-        channel2.start(GroupChannel.DEFAULT);
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        channel1.stop(GroupChannel.DEFAULT);
-        channel2.stop(GroupChannel.DEFAULT);
-    }
-
-    public void testDataSendSYNCACK() throws Exception {
-        System.err.println("Starting SYNC_ACK");
-        int errC=0, nerrC=0;
-        for (int i=0; i<msgCount; i++) {
-            boolean error = Data.r.nextBoolean();
-            channel1.send(channel1.getMembers(),Data.createRandomData(error),GroupChannel.SEND_OPTIONS_SYNCHRONIZED_ACK|GroupChannel.SEND_OPTIONS_USE_ACK);
-            if ( error ) errC++; else nerrC++;
-        }
-        System.err.println("Finished SYNC_ACK");
-        assertEquals("Checking failure messages.",errC,listener1.errCnt);
-        assertEquals("Checking success messages.",nerrC,listener1.noErrCnt);
-        assertEquals("Checking all messages.",msgCount,listener1.noErrCnt+listener1.errCnt);
-        System.out.println("Listener 1 stats:");
-        listener1.printStats(System.out);
-    }
-
-    public static class Listener implements ChannelListener {
-        long noErrCnt = 0;
-        long errCnt = 0;
-        public boolean accept(Serializable s, Member m) {
-            return (s instanceof Data);
-        }
-
-        public void messageReceived(Serializable s, Member m) {
-            Data d = (Data)s;
-            if ( !Data.verify(d) ) {
-                System.err.println("ERROR");
-            } else {
-                if (d.error) {
-                    errCnt++;
-                    if ( (errCnt % 100) == 0) {
-                        printStats(System.err);
-                    }
-                    throw new IllegalArgumentException();
-                } else {
-                    noErrCnt++;
-                    if ( (noErrCnt % 100) == 0) {
-                        printStats(System.err);
-                    }
-                }
-            }
-        }
-
-        public void printStats(PrintStream stream) {
-            stream.println("NORMAL:" + noErrCnt);
-            stream.println("FAILURES:" + errCnt);
-            stream.println("TOTAL:" + (errCnt+noErrCnt));
-        }
-    }
-
-    public static class Data implements Serializable {
-        public int length;
-        public byte[] data;
-        public byte key;
-        public boolean error = false;
-        public static Random r = new Random(System.currentTimeMillis());
-        public static Data createRandomData(boolean error) {
-            int i = r.nextInt();
-            i = ( i % 127 );
-            int length = Math.abs(r.nextInt() % 65555);
-            Data d = new Data();
-            d.length = length;
-            d.key = (byte)i;
-            d.data = new byte[length];
-            Arrays.fill(d.data,d.key);
-            d.error = error;
-            return d;
-        }
-
-        public static boolean verify(Data d) {
-            boolean result = (d.length == d.data.length);
-            for ( int i=0; result && (i<d.data.length); i++ ) result = result && d.data[i] == d.key;
-            return result;
-        }
-    }
-
-
-
-}
+package org.apache.catalina.tribes.test.channel;
+
+import junit.framework.TestCase;
+import java.io.Serializable;
+import java.util.Random;
+import java.util.Arrays;
+import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.group.GroupChannel;
+import java.io.PrintStream;
+
+/**
+ * <p>Title: </p> 
+ * 
+ * <p>Description: </p> 
+ * 
+ * <p>Copyright: Copyright (c) 2005</p> 
+ * 
+ * <p>Company: </p>
+ * 
+ * @author not attributable
+ * @version 1.0
+ */
+public class TestRemoteProcessException extends TestCase {
+    int msgCount = 10000;
+    GroupChannel channel1;
+    GroupChannel channel2;
+    Listener listener1;
+    protected void setUp() throws Exception {
+        super.setUp();
+        channel1 = new GroupChannel();
+        channel2 = new GroupChannel();
+        listener1 = new Listener();
+        channel2.addChannelListener(listener1);
+        channel1.start(GroupChannel.DEFAULT);
+        channel2.start(GroupChannel.DEFAULT);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        channel1.stop(GroupChannel.DEFAULT);
+        channel2.stop(GroupChannel.DEFAULT);
+    }
+
+    public void testDataSendSYNCACK() throws Exception {
+        System.err.println("Starting SYNC_ACK");
+        int errC=0, nerrC=0;
+        for (int i=0; i<msgCount; i++) {
+            boolean error = Data.r.nextBoolean();
+            channel1.send(channel1.getMembers(),Data.createRandomData(error),GroupChannel.SEND_OPTIONS_SYNCHRONIZED_ACK|GroupChannel.SEND_OPTIONS_USE_ACK);
+            if ( error ) errC++; else nerrC++;
+        }
+        System.err.println("Finished SYNC_ACK");
+        assertEquals("Checking failure messages.",errC,listener1.errCnt);
+        assertEquals("Checking success messages.",nerrC,listener1.noErrCnt);
+        assertEquals("Checking all messages.",msgCount,listener1.noErrCnt+listener1.errCnt);
+        System.out.println("Listener 1 stats:");
+        listener1.printStats(System.out);
+    }
+
+    public static class Listener implements ChannelListener {
+        long noErrCnt = 0;
+        long errCnt = 0;
+        public boolean accept(Serializable s, Member m) {
+            return (s instanceof Data);
+        }
+
+        public void messageReceived(Serializable s, Member m) {
+            Data d = (Data)s;
+            if ( !Data.verify(d) ) {
+                System.err.println("ERROR");
+            } else {
+                if (d.error) {
+                    errCnt++;
+                    if ( (errCnt % 100) == 0) {
+                        printStats(System.err);
+                    }
+                    throw new IllegalArgumentException();
+                } else {
+                    noErrCnt++;
+                    if ( (noErrCnt % 100) == 0) {
+                        printStats(System.err);
+                    }
+                }
+            }
+        }
+
+        public void printStats(PrintStream stream) {
+            stream.println("NORMAL:" + noErrCnt);
+            stream.println("FAILURES:" + errCnt);
+            stream.println("TOTAL:" + (errCnt+noErrCnt));
+        }
+    }
+
+    public static class Data implements Serializable {
+        public int length;
+        public byte[] data;
+        public byte key;
+        public boolean error = false;
+        public static Random r = new Random(System.currentTimeMillis());
+        public static Data createRandomData(boolean error) {
+            int i = r.nextInt();
+            i = ( i % 127 );
+            int length = Math.abs(r.nextInt() % 65555);
+            Data d = new Data();
+            d.length = length;
+            d.key = (byte)i;
+            d.data = new byte[length];
+            Arrays.fill(d.data,d.key);
+            d.error = error;
+            return d;
+        }
+
+        public static boolean verify(Data d) {
+            boolean result = (d.length == d.data.length);
+            for ( int i=0; result && (i<d.data.length); i++ ) result = result && d.data[i] == d.key;
+            return result;
+        }
+    }
+
+
+
+}

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestNonBlockingCoordinator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestNonBlockingCoordinator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestTwoPhaseCommit.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestTwoPhaseCommit.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestTwoPhaseCommit.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestTwoPhaseCommit.java Mon Oct 23 20:11:45 2006
@@ -1,43 +1,43 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- */
-
-package org.apache.catalina.tribes.test.interceptors;
-
-import junit.framework.TestCase;
-
-/**
- * <p>Title: </p> 
- * 
- * <p>Description: </p> 
- * 
- * <p>Copyright: Copyright (c) 2005</p> 
- * 
- * <p>Company: </p>
- * 
- * @author not attributable
- * @version 1.0
- */
-public class TestTwoPhaseCommit extends TestCase {
-
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ */
+
+package org.apache.catalina.tribes.test.interceptors;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>Title: </p> 
+ * 
+ * <p>Description: </p> 
+ * 
+ * <p>Copyright: Copyright (c) 2005</p> 
+ * 
+ * <p>Company: </p>
+ * 
+ * @author not attributable
+ * @version 1.0
+ */
+public class TestTwoPhaseCommit extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+}

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestTwoPhaseCommit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestTwoPhaseCommit.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/io/TestSenderConnections.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/io/TestSenderConnections.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/io/TestSerialization.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/io/TestSerialization.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/MemberSerialization.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/MemberSerialization.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/MemberSerialization.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/MemberSerialization.java Mon Oct 23 20:11:45 2006
@@ -1,101 +1,101 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- */
-package org.apache.catalina.tribes.test.membership;
-
-import junit.framework.TestCase;
-import org.apache.catalina.tribes.membership.MemberImpl;
-import java.util.Arrays;
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
-public class MemberSerialization extends TestCase {
-    MemberImpl m1, m2, p1,p2;
-    byte[] payload = null;
-    protected void setUp() throws Exception {
-        super.setUp();
-        payload = new byte[333];
-        Arrays.fill(payload,(byte)1);
-        m1 = new MemberImpl("localhost",3333,1,payload);
-        m2 = new MemberImpl("localhost",3333,1);
-        payload = new byte[333];
-        Arrays.fill(payload,(byte)2);
-        p1 = new MemberImpl("127.0.0.1",3333,1,payload);
-        p2 = new MemberImpl("localhost",3331,1,payload);
-        m1.setDomain(new byte[] {1,2,3,4,5,6,7,8,9});
-        m2.setDomain(new byte[] {1,2,3,4,5,6,7,8,9});
-        m1.setCommand(new byte[] {1,2,4,5,6,7,8,9});
-        m2.setCommand(new byte[] {1,2,4,5,6,7,8,9});
-    }
-    
-    public void testCompare() throws Exception {
-        assertTrue(m1.equals(m2));
-        assertTrue(m2.equals(m1));
-        assertTrue(p1.equals(m2));
-        assertFalse(m1.equals(p2));
-        assertFalse(m1.equals(p2));
-        assertFalse(m2.equals(p2));
-        assertFalse(p1.equals(p2));
-    }
-    
-    public void testSerializationOne() throws Exception {
-        MemberImpl m = m1;
-        byte[] md1 = m.getData(false,true);
-        byte[] mda1 = m.getData(false,false);
-        assertTrue(Arrays.equals(md1,mda1));
-        assertTrue(md1==mda1);
-        mda1 = m.getData(true,true);
-        MemberImpl ma1 = MemberImpl.getMember(mda1);
-        assertTrue(compareMembers(m,ma1));
-        mda1 = p1.getData(false);
-        assertFalse(Arrays.equals(md1,mda1));
-        ma1 = MemberImpl.getMember(mda1);
-        assertTrue(compareMembers(p1,ma1));
-        
-        md1 = m.getData(true,true);
-        Thread.sleep(50);
-        mda1 = m.getData(true,true);
-        MemberImpl a1 = MemberImpl.getMember(md1);
-        MemberImpl a2 = MemberImpl.getMember(mda1);
-        assertTrue(a1.equals(a2));
-        assertFalse(Arrays.equals(md1,mda1));
-        
-        
-    }
-    
-    public boolean compareMembers(MemberImpl impl1, MemberImpl impl2) {
-        boolean result = true;
-        result = result && Arrays.equals(impl1.getHost(),impl2.getHost());
-        result = result && Arrays.equals(impl1.getPayload(),impl2.getPayload());
-        result = result && Arrays.equals(impl1.getUniqueId(),impl2.getUniqueId());
-        result = result && impl1.getPort() == impl2.getPort();
-        return result;
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ */
+package org.apache.catalina.tribes.test.membership;
+
+import junit.framework.TestCase;
+import org.apache.catalina.tribes.membership.MemberImpl;
+import java.util.Arrays;
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ * <p>Copyright: Copyright (c) 2005</p>
+ *
+ * <p>Company: </p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public class MemberSerialization extends TestCase {
+    MemberImpl m1, m2, p1,p2;
+    byte[] payload = null;
+    protected void setUp() throws Exception {
+        super.setUp();
+        payload = new byte[333];
+        Arrays.fill(payload,(byte)1);
+        m1 = new MemberImpl("localhost",3333,1,payload);
+        m2 = new MemberImpl("localhost",3333,1);
+        payload = new byte[333];
+        Arrays.fill(payload,(byte)2);
+        p1 = new MemberImpl("127.0.0.1",3333,1,payload);
+        p2 = new MemberImpl("localhost",3331,1,payload);
+        m1.setDomain(new byte[] {1,2,3,4,5,6,7,8,9});
+        m2.setDomain(new byte[] {1,2,3,4,5,6,7,8,9});
+        m1.setCommand(new byte[] {1,2,4,5,6,7,8,9});
+        m2.setCommand(new byte[] {1,2,4,5,6,7,8,9});
+    }
+    
+    public void testCompare() throws Exception {
+        assertTrue(m1.equals(m2));
+        assertTrue(m2.equals(m1));
+        assertTrue(p1.equals(m2));
+        assertFalse(m1.equals(p2));
+        assertFalse(m1.equals(p2));
+        assertFalse(m2.equals(p2));
+        assertFalse(p1.equals(p2));
+    }
+    
+    public void testSerializationOne() throws Exception {
+        MemberImpl m = m1;
+        byte[] md1 = m.getData(false,true);
+        byte[] mda1 = m.getData(false,false);
+        assertTrue(Arrays.equals(md1,mda1));
+        assertTrue(md1==mda1);
+        mda1 = m.getData(true,true);
+        MemberImpl ma1 = MemberImpl.getMember(mda1);
+        assertTrue(compareMembers(m,ma1));
+        mda1 = p1.getData(false);
+        assertFalse(Arrays.equals(md1,mda1));
+        ma1 = MemberImpl.getMember(mda1);
+        assertTrue(compareMembers(p1,ma1));
+        
+        md1 = m.getData(true,true);
+        Thread.sleep(50);
+        mda1 = m.getData(true,true);
+        MemberImpl a1 = MemberImpl.getMember(md1);
+        MemberImpl a2 = MemberImpl.getMember(mda1);
+        assertTrue(a1.equals(a2));
+        assertFalse(Arrays.equals(md1,mda1));
+        
+        
+    }
+    
+    public boolean compareMembers(MemberImpl impl1, MemberImpl impl2) {
+        boolean result = true;
+        result = result && Arrays.equals(impl1.getHost(),impl2.getHost());
+        result = result && Arrays.equals(impl1.getPayload(),impl2.getPayload());
+        result = result && Arrays.equals(impl1.getUniqueId(),impl2.getUniqueId());
+        result = result && impl1.getPort() == impl2.getPort();
+        return result;
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+}

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/MemberSerialization.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/MemberSerialization.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestDomainFilter.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestDomainFilter.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestDomainFilter.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestDomainFilter.java Mon Oct 23 20:11:45 2006
@@ -1,104 +1,104 @@
-package org.apache.catalina.tribes.test.membership;
-
-import java.util.ArrayList;
-
-import org.apache.catalina.tribes.Channel;
-import org.apache.catalina.tribes.ManagedChannel;
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.MembershipListener;
-import org.apache.catalina.tribes.group.GroupChannel;
-import junit.framework.TestCase;
-import org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor;
-import org.apache.catalina.tribes.util.UUIDGenerator;
-
-public class TestDomainFilter
-    extends TestCase {
-    private static int count = 10;
-    private ManagedChannel[] channels = new ManagedChannel[count];
-    private TestMbrListener[] listeners = new TestMbrListener[count];
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        for (int i = 0; i < channels.length; i++) {
-            channels[i] = new GroupChannel();
-            channels[i].getMembershipService().setPayload( ("Channel-" + (i + 1)).getBytes("ASCII"));
-            listeners[i] = new TestMbrListener( ("Listener-" + (i + 1)));
-            channels[i].addMembershipListener(listeners[i]);
-            DomainFilterInterceptor filter = new DomainFilterInterceptor();
-            filter.setDomain(UUIDGenerator.randomUUID(false));
-            channels[i].addInterceptor(filter);
-        }
-    }
-
-    public void clear() {
-        for (int i = 0; i < channels.length; i++) {
-            listeners[i].members.clear();
-        }
-    }
-
-    public void testMemberArrival() throws Exception {
-        //purpose of this test is to make sure that we have received all the members
-        //that we can expect before the start method returns
-        Thread[] threads = new Thread[channels.length];
-        for (int i=0; i<channels.length; i++ ) {
-            final Channel channel = channels[i];
-            Thread t = new Thread() {
-                public void run() {
-                    try {
-                        channel.start(Channel.DEFAULT);
-                    }catch ( Exception x ) {
-                        throw new RuntimeException(x);
-                    }
-                }
-            };
-            threads[i] = t;
-        }
-        for (int i=0; i<threads.length; i++ ) threads[i].start();
-        for (int i=0; i<threads.length; i++ ) threads[i].join();
-        System.out.println("All channels started.");
-        for (int i=listeners.length-1; i>=0; i-- ) assertEquals("Checking member arrival length",0,listeners[i].members.size());
-    }
-
-    protected void tearDown() throws Exception {
-
-        for (int i = 0; i < channels.length; i++) {
-            try {
-                channels[i].stop(Channel.DEFAULT);
-            } catch (Exception ignore) {}
-        }
-        super.tearDown();
-    }
-
-    public class TestMbrListener
-        implements MembershipListener {
-        public String name = null;
-        public TestMbrListener(String name) {
-            this.name = name;
-        }
-
-        public ArrayList members = new ArrayList();
-        public void memberAdded(Member member) {
-            if (!members.contains(member)) {
-                members.add(member);
-                try {
-                    System.out.println(name + ":member added[" + new String(member.getPayload(), "ASCII") + "; Thread:"+Thread.currentThread().getName()+"]");
-                } catch (Exception x) {
-                    System.out.println(name + ":member added[unknown]");
-                }
-            }
-        }
-
-        public void memberDisappeared(Member member) {
-            if (members.contains(member)) {
-                members.remove(member);
-                try {
-                    System.out.println(name + ":member disappeared[" + new String(member.getPayload(), "ASCII") + "; Thread:"+Thread.currentThread().getName()+"]");
-                } catch (Exception x) {
-                    System.out.println(name + ":member disappeared[unknown]");
-                }
-            }
-        }
-
-    }
-
-}
+package org.apache.catalina.tribes.test.membership;
+
+import java.util.ArrayList;
+
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.ManagedChannel;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.MembershipListener;
+import org.apache.catalina.tribes.group.GroupChannel;
+import junit.framework.TestCase;
+import org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor;
+import org.apache.catalina.tribes.util.UUIDGenerator;
+
+public class TestDomainFilter
+    extends TestCase {
+    private static int count = 10;
+    private ManagedChannel[] channels = new ManagedChannel[count];
+    private TestMbrListener[] listeners = new TestMbrListener[count];
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        for (int i = 0; i < channels.length; i++) {
+            channels[i] = new GroupChannel();
+            channels[i].getMembershipService().setPayload( ("Channel-" + (i + 1)).getBytes("ASCII"));
+            listeners[i] = new TestMbrListener( ("Listener-" + (i + 1)));
+            channels[i].addMembershipListener(listeners[i]);
+            DomainFilterInterceptor filter = new DomainFilterInterceptor();
+            filter.setDomain(UUIDGenerator.randomUUID(false));
+            channels[i].addInterceptor(filter);
+        }
+    }
+
+    public void clear() {
+        for (int i = 0; i < channels.length; i++) {
+            listeners[i].members.clear();
+        }
+    }
+
+    public void testMemberArrival() throws Exception {
+        //purpose of this test is to make sure that we have received all the members
+        //that we can expect before the start method returns
+        Thread[] threads = new Thread[channels.length];
+        for (int i=0; i<channels.length; i++ ) {
+            final Channel channel = channels[i];
+            Thread t = new Thread() {
+                public void run() {
+                    try {
+                        channel.start(Channel.DEFAULT);
+                    }catch ( Exception x ) {
+                        throw new RuntimeException(x);
+                    }
+                }
+            };
+            threads[i] = t;
+        }
+        for (int i=0; i<threads.length; i++ ) threads[i].start();
+        for (int i=0; i<threads.length; i++ ) threads[i].join();
+        System.out.println("All channels started.");
+        for (int i=listeners.length-1; i>=0; i-- ) assertEquals("Checking member arrival length",0,listeners[i].members.size());
+    }
+
+    protected void tearDown() throws Exception {
+
+        for (int i = 0; i < channels.length; i++) {
+            try {
+                channels[i].stop(Channel.DEFAULT);
+            } catch (Exception ignore) {}
+        }
+        super.tearDown();
+    }
+
+    public class TestMbrListener
+        implements MembershipListener {
+        public String name = null;
+        public TestMbrListener(String name) {
+            this.name = name;
+        }
+
+        public ArrayList members = new ArrayList();
+        public void memberAdded(Member member) {
+            if (!members.contains(member)) {
+                members.add(member);
+                try {
+                    System.out.println(name + ":member added[" + new String(member.getPayload(), "ASCII") + "; Thread:"+Thread.currentThread().getName()+"]");
+                } catch (Exception x) {
+                    System.out.println(name + ":member added[unknown]");
+                }
+            }
+        }
+
+        public void memberDisappeared(Member member) {
+            if (members.contains(member)) {
+                members.remove(member);
+                try {
+                    System.out.println(name + ":member disappeared[" + new String(member.getPayload(), "ASCII") + "; Thread:"+Thread.currentThread().getName()+"]");
+                } catch (Exception x) {
+                    System.out.println(name + ":member disappeared[unknown]");
+                }
+            }
+        }
+
+    }
+
+}

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestDomainFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestDomainFilter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestMemberArrival.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestMemberArrival.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestTcpFailureDetector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/membership/TestTcpFailureDetector.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketNioReceive.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketNioReceive.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketNioSend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketNioSend.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketNioValidateSend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketNioValidateSend.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketReceive.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketReceive.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketSend.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketSend.java?view=diff&rev=467214&r1=467213&r2=467214
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketSend.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketSend.java Mon Oct 23 20:11:45 2006
@@ -1,53 +1,53 @@
-package org.apache.catalina.tribes.test.transport;
-
-import java.io.OutputStream;
-import java.net.Socket;
-import java.text.DecimalFormat;
-import org.apache.catalina.tribes.membership.MemberImpl;
-import org.apache.catalina.tribes.io.XByteBuffer;
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.io.ChannelData;
-import org.apache.catalina.tribes.Channel;
-import java.math.BigDecimal;
-
-public class SocketSend {
-
-    public static void main(String[] args) throws Exception {
-        
-        
-        Member mbr = new MemberImpl("localhost", 9999, 0);
-        ChannelData data = new ChannelData();
-        data.setOptions(Channel.SEND_OPTIONS_BYTE_MESSAGE);
-        data.setAddress(mbr);
-        byte[] buf = new byte[8192 * 4];
-        data.setMessage(new XByteBuffer(buf,false));
-        buf = XByteBuffer.createDataPackage(data);
-        int len = buf.length;
-        System.out.println("Message size:"+len+" bytes");
-        BigDecimal total = new BigDecimal((double)0);
-        BigDecimal bytes = new BigDecimal((double)len);
-        Socket socket = new Socket("localhost",9999);
-        System.out.println("Writing to 9999");
-        OutputStream out = socket.getOutputStream();
-        long start = 0;
-        double mb = 0;
-        boolean first = true;
-        int count = 0;
-        DecimalFormat df = new DecimalFormat("##.00");
-        while ( count<100000 ) {
-            if ( first ) { first = false; start = System.currentTimeMillis();}
-            out.write(buf,0,buf.length);
-            mb += ( (double) buf.length) / 1024 / 1024;
-            total = total.add(bytes);
-            if ( ((++count) % 10000) == 0 ) {
-                long time = System.currentTimeMillis();
-                double seconds = ((double)(time-start))/1000;
-                System.out.println("Throughput "+df.format(mb/seconds)+" MB/seconds messages "+count+", total "+mb+" MB, total "+total+" bytes.");
-            }
-        }
-        out.flush(); 
-        System.out.println("Complete, sleeping 5 seconds");
-        Thread.sleep(5000);
-
-    }
-}
+package org.apache.catalina.tribes.test.transport;
+
+import java.io.OutputStream;
+import java.net.Socket;
+import java.text.DecimalFormat;
+import org.apache.catalina.tribes.membership.MemberImpl;
+import org.apache.catalina.tribes.io.XByteBuffer;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.io.ChannelData;
+import org.apache.catalina.tribes.Channel;
+import java.math.BigDecimal;
+
+public class SocketSend {
+
+    public static void main(String[] args) throws Exception {
+        
+        
+        Member mbr = new MemberImpl("localhost", 9999, 0);
+        ChannelData data = new ChannelData();
+        data.setOptions(Channel.SEND_OPTIONS_BYTE_MESSAGE);
+        data.setAddress(mbr);
+        byte[] buf = new byte[8192 * 4];
+        data.setMessage(new XByteBuffer(buf,false));
+        buf = XByteBuffer.createDataPackage(data);
+        int len = buf.length;
+        System.out.println("Message size:"+len+" bytes");
+        BigDecimal total = new BigDecimal((double)0);
+        BigDecimal bytes = new BigDecimal((double)len);
+        Socket socket = new Socket("localhost",9999);
+        System.out.println("Writing to 9999");
+        OutputStream out = socket.getOutputStream();
+        long start = 0;
+        double mb = 0;
+        boolean first = true;
+        int count = 0;
+        DecimalFormat df = new DecimalFormat("##.00");
+        while ( count<100000 ) {
+            if ( first ) { first = false; start = System.currentTimeMillis();}
+            out.write(buf,0,buf.length);
+            mb += ( (double) buf.length) / 1024 / 1024;
+            total = total.add(bytes);
+            if ( ((++count) % 10000) == 0 ) {
+                long time = System.currentTimeMillis();
+                double seconds = ((double)(time-start))/1000;
+                System.out.println("Throughput "+df.format(mb/seconds)+" MB/seconds messages "+count+", total "+mb+" MB, total "+total+" bytes.");
+            }
+        }
+        out.flush(); 
+        System.out.println("Complete, sleeping 5 seconds");
+        Thread.sleep(5000);
+
+    }
+}

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketSend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketSend.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketTribesReceive.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketTribesReceive.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketValidateReceive.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/transport/SocketValidateReceive.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



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