qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r734212 - in /qpid/trunk/qpid/java: testkit/src/main/java/org/apache/qpid/testkit/perf/ testkit/src/main/java/org/apache/qpid/testkit/soak/ tools/src/main/java/org/apache/qpid/tools/
Date Tue, 13 Jan 2009 18:32:43 GMT
Author: rajith
Date: Tue Jan 13 10:32:10 2009
New Revision: 734212

URL: http://svn.apache.org/viewvc?rev=734212&view=rev
Log:
This is related to QPID-1479
This commit contains themodifications done to the perf test classes to use the thread abstraction
patch.

Modified:
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/LatencyTest.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfConsumer.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfProducer.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedConsumer.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedProducer.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/ResourceLeakTest.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleConsumer.java
    qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleProducer.java
    qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/LatencyTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/LatencyTest.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/LatencyTest.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/LatencyTest.java
Tue Jan 13 10:32:10 2009
@@ -37,6 +37,7 @@
 import javax.jms.TextMessage;
 
 import org.apache.qpid.testkit.MessageFactory;
+import org.apache.qpid.thread.Threading;
 
 /**
  * Latency test sends an x number of messages in warmup mode and wait for a confirmation
@@ -314,19 +315,36 @@
 
     public static void main(String[] args)
     {
-        LatencyTest latencyTest = new LatencyTest();
-        latencyTest.test();
-        latencyTest.printToConsole();
-        if (System.getProperty("file") != null)
+        final LatencyTest latencyTest = new LatencyTest();        
+        Runnable r = new Runnable()
         {
-            try
+            public void run()
             {
-                latencyTest.writeToFile();
-            }
-            catch(Exception e)
-            {
-                e.printStackTrace();
+                latencyTest.test();
+                latencyTest.printToConsole();
+                if (System.getProperty("file") != null)
+                {
+                    try
+                    {
+                        latencyTest.writeToFile();
+                    }
+                    catch(Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+                }
             }
+        };
+        
+        Thread t;
+        try
+        {
+            t = Threading.getThreadFactory().createThread(r);                      
+        }
+        catch(Exception e)
+        {
+            throw new Error("Error creating latency test thread",e);
         }
+        t.start(); 
     }
 }
\ No newline at end of file

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfConsumer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfConsumer.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfConsumer.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfConsumer.java
Tue Jan 13 10:32:10 2009
@@ -27,6 +27,8 @@
 import javax.jms.MessageProducer;
 import javax.jms.TextMessage;
 
+import org.apache.qpid.thread.Threading;
+
 /**
  * PerfConsumer will receive x no of messages in warmup mode.
  * Once it receives the Start message it will then signal the PerfProducer.
@@ -242,7 +244,24 @@
 
     public static void main(String[] args)
     {
-        PerfConsumer cons = new PerfConsumer();
-        cons.test();
+        final PerfConsumer cons = new PerfConsumer();
+        Runnable r = new Runnable()
+        {
+            public void run()
+            {
+                cons.test();
+            }
+        };
+        
+        Thread t;
+        try
+        {
+            t = Threading.getThreadFactory().createThread(r);                      
+        }
+        catch(Exception e)
+        {
+            throw new Error("Error creating consumer thread",e);
+        }
+        t.start(); 
     }
 }
\ No newline at end of file

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfProducer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfProducer.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfProducer.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/perf/PerfProducer.java
Tue Jan 13 10:32:10 2009
@@ -27,6 +27,7 @@
 import javax.jms.MessageProducer;
 
 import org.apache.qpid.testkit.MessageFactory;
+import org.apache.qpid.thread.Threading;
 
 /**
  * PerfProducer sends an x no of messages in warmup mode and wait for a confirmation
@@ -201,7 +202,24 @@
 
     public static void main(String[] args)
     {
-        PerfProducer prod = new PerfProducer();
-        prod.test();
+        final PerfProducer prod = new PerfProducer();
+        Runnable r = new Runnable()
+        {
+            public void run()
+            {
+                prod.test();
+            }
+        };
+        
+        Thread t;
+        try
+        {
+            t = Threading.getThreadFactory().createThread(r);                      
+        }
+        catch(Exception e)
+        {
+            throw new Error("Error creating producer thread",e);
+        }
+        t.start();            
     }
 }
\ No newline at end of file

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedConsumer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedConsumer.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedConsumer.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedConsumer.java
Tue Jan 13 10:32:10 2009
@@ -29,6 +29,8 @@
 import javax.jms.Session;
 import javax.jms.TextMessage;
 
+import org.apache.qpid.thread.Threading;
+
 /**
  * Test Description
  * ================
@@ -67,7 +69,7 @@
             {
 
                 final Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
-                Thread t = new Thread(new Runnable()
+                Runnable r = new Runnable()
                 {
                     public void run()
                     {
@@ -131,7 +133,18 @@
 
                     }
 
-                });
+                };
+                
+                Thread t;
+                try
+                {
+                    t = Threading.getThreadFactory().createThread(r);                   
  
+                }
+                catch(Exception e)
+                {
+                    throw new Error("Error creating consumer thread",e);
+                }
+                
                 t.setName("session-" + i);
                 t.start();
             } // for loop

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedProducer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedProducer.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedProducer.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/MultiThreadedProducer.java
Tue Jan 13 10:32:10 2009
@@ -32,6 +32,7 @@
 
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.thread.Threading;
 
 /**
  * Test Description
@@ -79,7 +80,7 @@
             for (int i = 0; i < session_count; i++)
             {
                 final Session session = con.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
-                Thread t = new Thread(new Runnable()
+                Runnable r = new Runnable()
                 {
                     private Random gen = new Random();
 
@@ -142,7 +143,16 @@
 
                     }
 
-                });
+                };
+                Thread t;
+                try
+                {
+                    t = Threading.getThreadFactory().createThread(r);                   
  
+                }
+                catch(Exception e)
+                {
+                    throw new Error("Error creating producer thread",e);
+                }
                 t.setName("session-" + i);
                 t.start();
 

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/ResourceLeakTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/ResourceLeakTest.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/ResourceLeakTest.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/ResourceLeakTest.java
Tue Jan 13 10:32:10 2009
@@ -30,6 +30,7 @@
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.thread.Threading;
 
 /**
  * Test Description
@@ -131,8 +132,23 @@
 
     public static void main(String[] args)
     {
-        ResourceLeakTest test = new ResourceLeakTest();
-        test.test();
+        final ResourceLeakTest test = new ResourceLeakTest();
+        Runnable r = new Runnable(){    
+            public void run()
+            {
+                test.test();
+            }
+        };    
+        
+        Thread t;
+        try
+        {
+            t = Threading.getThreadFactory().createThread(r);                      
+        }
+        catch(Exception e)
+        {
+            throw new Error("Error creating test thread",e);
+        }
     }
 
 }

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleConsumer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleConsumer.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleConsumer.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleConsumer.java
Tue Jan 13 10:32:10 2009
@@ -29,6 +29,8 @@
 import javax.jms.Session;
 import javax.jms.TextMessage;
 
+import org.apache.qpid.thread.Threading;
+
 /**
  * Test Description
  * ================
@@ -126,9 +128,24 @@
 
     public static void main(String[] args)
     {
-        SimpleConsumer test = new SimpleConsumer();
-        test.setUp();
-        test.test();
+        final SimpleConsumer test = new SimpleConsumer();
+        Runnable r = new Runnable(){    
+            public void run()
+            {
+                test.setUp();
+                test.test();
+            }
+        };    
+        
+        Thread t;
+        try
+        {
+            t = Threading.getThreadFactory().createThread(r);                      
+        }
+        catch(Exception e)
+        {
+            throw new Error("Error creating consumer thread",e);
+        }
     }
 
 }

Modified: qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleProducer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleProducer.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleProducer.java
(original)
+++ qpid/trunk/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/soak/SimpleProducer.java
Tue Jan 13 10:32:10 2009
@@ -33,6 +33,7 @@
 
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.thread.Threading;
 
 /**
  * Test Description
@@ -138,9 +139,24 @@
 
     public static void main(String[] args)
     {
-        SimpleProducer test = new SimpleProducer();
-        test.setUp();
-        test.test();
+        final SimpleProducer test = new SimpleProducer();
+        Runnable r = new Runnable(){    
+            public void run()
+            {
+                test.setUp();
+                test.test();
+            }
+        };    
+        
+        Thread t;
+        try
+        {
+            t = Threading.getThreadFactory().createThread(r);                      
+        }
+        catch(Exception e)
+        {
+            throw new Error("Error creating producer thread",e);
+        }
     }
 
 }

Modified: qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java?rev=734212&r1=734211&r2=734212&view=diff
==============================================================================
--- qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java (original)
+++ qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/QpidBench.java Tue Jan
13 10:32:10 2009
@@ -20,23 +20,45 @@
  */
 package org.apache.qpid.tools;
 
-import java.lang.reflect.InvocationTargetException;
+import static org.apache.qpid.tools.QpidBench.Mode.BOTH;
+import static org.apache.qpid.tools.QpidBench.Mode.CONSUME;
+import static org.apache.qpid.tools.QpidBench.Mode.PUBLISH;
+
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.UUID;
-import javax.jms.*;
+
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.TextMessage;
 
 import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.transport.*;
-import org.apache.qpid.transport.network.io.IoTransport;
+import org.apache.qpid.thread.Threading;
+import org.apache.qpid.transport.DeliveryProperties;
+import org.apache.qpid.transport.ExchangeBind;
+import org.apache.qpid.transport.Header;
+import org.apache.qpid.transport.MessageAcceptMode;
+import org.apache.qpid.transport.MessageAcquireMode;
+import org.apache.qpid.transport.MessageCreditUnit;
+import org.apache.qpid.transport.MessageDeliveryMode;
+import org.apache.qpid.transport.MessageFlowMode;
+import org.apache.qpid.transport.MessageProperties;
+import org.apache.qpid.transport.MessageSubscribe;
+import org.apache.qpid.transport.MessageTransfer;
+import org.apache.qpid.transport.QueueDeclare;
+import org.apache.qpid.transport.SessionException;
+import org.apache.qpid.transport.SessionListener;
 import org.apache.qpid.util.UUIDGen;
 import org.apache.qpid.util.UUIDs;
 
-import static org.apache.qpid.tools.QpidBench.Mode.*;
-
 /**
  * QpidBench
  *
@@ -412,7 +434,7 @@
         {
         case CONSUME:
         case BOTH:
-            new Thread()
+            Runnable r = new Runnable()
             {
                 public void run()
                 {
@@ -432,7 +454,18 @@
                         throw new RuntimeException(e);
                     }
                 }
-            }.start();
+            };
+           
+            Thread t;
+            try
+            {
+                t = Threading.getThreadFactory().createThread(r);                      
+            }
+            catch(Exception e)
+            {
+                throw new Error("Error creating consumer thread",e);
+            }
+            t.start();
             break;
         }
 
@@ -440,7 +473,7 @@
         {
         case PUBLISH:
         case BOTH:
-            new Thread()
+            Runnable r = new Runnable()
             {
                 public void run()
                 {
@@ -460,7 +493,17 @@
                         throw new RuntimeException(e);
                     }
                 }
-            }.start();
+            };
+            Thread t;
+            try
+            {
+                t = Threading.getThreadFactory().createThread(r);                      
+            }
+            catch(Exception e)
+            {
+                throw new Error("Error creating publisher thread",e);
+            }
+            t.start();
             break;
         }
     }



Mime
View raw message