jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1214179 - /jmeter/trunk/src/core/org/apache/jmeter/samplers/
Date Wed, 14 Dec 2011 11:42:26 GMT
Author: sebb
Date: Wed Dec 14 11:42:26 2011
New Revision: 1214179

URL: http://svn.apache.org/viewvc?rev=1214179&view=rev
Log:
Standardise logging; move unused testEnded() method to parent

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/AsynchSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/DataStrippingSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/HoldSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/StandardSampleSender.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampleSender.java Wed Dec 14
11:42:26 2011
@@ -39,4 +39,9 @@ public abstract class AbstractSampleSend
 	public AbstractSampleSender() {
 		super();
 	}
+
+	public void testEnded() {
+        // Not used
+    }
+
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/AsynchSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/AsynchSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/AsynchSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/AsynchSampleSender.java Wed Dec 14 11:42:26
2011
@@ -90,15 +90,6 @@ public class AsynchSampleSender extends 
     			clientConfiguredCapacity : serverConfiguredCapacity;
     }
     
-    public void testEnded() { // probably not used in server mode
-        log.debug("Test ended()");
-        try {
-            listener.testEnded();
-        } catch (RemoteException ex) {
-            log.warn("testEnded()"+ex);
-        }
-    }
-
     public void testEnded(String host) {
         log.debug("Test Ended on " + host);
         try {

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java Wed Dec 14 11:42:26
2011
@@ -25,6 +25,7 @@ import org.apache.jorphan.logging.Loggin
 import java.util.List;
 import java.util.ArrayList;
 import java.rmi.RemoteException;
+import java.io.ObjectStreamException;
 import java.io.Serializable;
 
 /**
@@ -74,6 +75,7 @@ public class BatchSampleSender extends A
      * @param listener
      *            that the List of sample events will be sent to.
      */
+    // protected added: Bug 50008 - allow BatchSampleSender to be subclassed
     protected BatchSampleSender(RemoteSampleListener listener) {
         this.listener = listener;
         log.info("Using batching for this run."
@@ -84,6 +86,7 @@ public class BatchSampleSender extends A
    /**
     * @return the listener
     */
+    // added: Bug 50008 - allow BatchSampleSender to be subclassed
    protected RemoteSampleListener getListener() {
        return listener;
    }
@@ -91,6 +94,7 @@ public class BatchSampleSender extends A
    /**
     * @return the sampleStore
     */
+   // added: Bug 50008 - allow BatchSampleSender to be subclassed
    protected List<SampleEvent> getSampleStore() {
        return sampleStore;
    }
@@ -98,27 +102,12 @@ public class BatchSampleSender extends A
     /**
      * Checks if any sample events are still present in the sampleStore and
      * sends them to the listener. Informs the listener of the testended.
-     */
-    public void testEnded() {
-        try {
-            if (sampleStore.size() != 0) {
-                listener.processBatch(sampleStore);
-                sampleStore.clear();
-            }
-            listener.testEnded();
-        } catch (RemoteException err) {
-            log.error("testEnded()", err);
-        }
-    }
-
-    /**
-     * Checks if any sample events are still present in the sampleStore and
-     * sends them to the listener. Informs the listener of the testended.
      *
      * @param host
      *            the host that the test has ended on.
      */
     public void testEnded(String host) {
+        log.info("Test Ended on " + host);
         try {
             if (sampleStore.size() != 0) {
                 listener.processBatch(sampleStore);
@@ -196,4 +185,15 @@ public class BatchSampleSender extends A
     	return isClientConfigured() ?
     			clientConfiguredNumSamplesThreshold: serverConfiguredNumSamplesThreshold;
     }
+
+    /**
+     * Processed by the RMI server code; acts as testStarted().
+     * @throws ObjectStreamException  
+     */
+    private Object readResolve() throws ObjectStreamException{
+        log.info("Using batching for this run."
+                + " Thresholds: num=" + getNumSamplesThreshold()
+                + ", time=" + getTimeThresholdMs()); 
+        return this;
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/DataStrippingSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/DataStrippingSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/DataStrippingSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/DataStrippingSampleSender.java Wed Dec
14 11:42:26 2011
@@ -18,6 +18,7 @@
 
 package org.apache.jmeter.samplers;
 
+import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.rmi.RemoteException;
 
@@ -38,9 +39,6 @@ public class DataStrippingSampleSender e
     private final RemoteSampleListener listener;
     private final SampleSender decoratedSender;
 
-    static {
-        log.info("Using DataStrippingSampleSender for this run");
-    }
     /**
      * @deprecated only for use by test code
      */
@@ -54,19 +52,18 @@ public class DataStrippingSampleSender e
     DataStrippingSampleSender(RemoteSampleListener listener) {
         this.listener = listener;
         decoratedSender = null;
+        log.info("Using DataStrippingSampleSender for this run");
     }
 
     DataStrippingSampleSender(SampleSender decorate)
     {
         this.decoratedSender = decorate;
         this.listener = null;
-    }
-
-    public void testEnded() {
-        if(decoratedSender != null) decoratedSender.testEnded();
+        log.info("Using DataStrippingSampleSender for this run");
     }
 
     public void testEnded(String host) {
+        log.info("Test Ended on " + host);
         if(decoratedSender != null) decoratedSender.testEnded(host);
     }
 
@@ -90,4 +87,12 @@ public class DataStrippingSampleSender e
         }
     }
 
+    /**
+     * Processed by the RMI server code; acts as testStarted().
+     * @throws ObjectStreamException  
+     */
+    private Object readResolve() throws ObjectStreamException{
+        log.info("Using DataStrippingSampleSender for this run");
+        return this;
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java Wed Dec 14
11:42:26 2011
@@ -67,11 +67,6 @@ public class DiskStoreSampleSender exten
         log.info("Using DiskStoreSampleSender for this test run"); // client log file
     }
 
-    /** {@inheritDoc} */
-    public void testEnded() {
-        // Not needed
-    }
-
     public void testEnded(String host) {
         log.info("Test Ended on " + host);
         singleExecutor.submit(new Runnable(){

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/HoldSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/HoldSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/HoldSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/HoldSampleSender.java Wed Dec 14 11:42:26
2011
@@ -23,6 +23,7 @@ import org.apache.jorphan.logging.Loggin
 
 import java.util.List;
 import java.util.ArrayList;
+import java.io.ObjectStreamException;
 import java.io.Serializable;
 
 /**
@@ -39,10 +40,6 @@ public class HoldSampleSender extends Ab
 
     private final RemoteSampleListener listener;
 
-    static {
-        log.info("Using Sample store for this test run");        
-    }
-
     /**
      * @deprecated only for use by test code
      */
@@ -54,34 +51,11 @@ public class HoldSampleSender extends Ab
 
     HoldSampleSender(RemoteSampleListener listener) {
         this.listener = listener;
+        log.info("Using HoldSampleSender for this test run"); // client        
     }
 
-    /** {@inheritDoc} */
-    public void testEnded() {
-        log.debug("Test ended()");
-        try {
-            synchronized (sampleStore) {
-                for (SampleEvent se : sampleStore) {
-                    listener.sampleOccurred(se);
-                }
-            }
-            listener.testEnded();
-            sampleStore.clear();
-        } catch (Throwable ex) {
-            log.warn("testEnded()", ex);
-            if (ex instanceof Error){
-                throw (Error) ex;
-            }
-            if (ex instanceof RuntimeException){
-                throw (RuntimeException) ex;
-            }
-        }
-
-    }
-
-    /** {@inheritDoc} */
     public void testEnded(String host) {
-        log.debug("Test Ended on " + host);
+        log.info("Test Ended on " + host);
         try {
             for (SampleEvent se : sampleStore) {
                 listener.sampleOccurred(se);
@@ -100,10 +74,18 @@ public class HoldSampleSender extends Ab
 
     }
 
-    /** {@inheritDoc} */
     public void sampleOccurred(SampleEvent e) {
         synchronized (sampleStore) {
             sampleStore.add(e);
         }
     }
+
+    /**
+     * Processed by the RMI server code; acts as testStarted().
+     * @throws ObjectStreamException  
+     */
+    private Object readResolve() throws ObjectStreamException{
+        log.info("Using HoldSampleSender for this test run"); // server        
+        return this;
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/StandardSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/StandardSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/StandardSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/StandardSampleSender.java Wed Dec 14
11:42:26 2011
@@ -23,6 +23,7 @@ import org.apache.jorphan.logging.Loggin
 import org.apache.jorphan.util.JMeterError;
 
 import java.rmi.RemoteException;
+import java.io.ObjectStreamException;
 import java.io.Serializable;
 
 /**
@@ -36,10 +37,6 @@ public class StandardSampleSender extend
 
     private RemoteSampleListener listener;
 
-    static {
-        log.info("Using Standard Remote Sampler for this test run");        
-    }
-
     /**
      * @deprecated only for use by test code
      */
@@ -50,20 +47,11 @@ public class StandardSampleSender extend
 
     StandardSampleSender(RemoteSampleListener listener) {
         this.listener = listener;
-    }
-
-    public void testEnded() {
-        log.info("Test ended()");
-        try {
-            listener.testEnded();
-        } catch (RemoteException ex) {
-            log.warn("testEnded()"+ex);
-        }
-
+        log.info("Using StandardSampleSender for this test run");        
     }
 
     public void testEnded(String host) {
-        log.info("Test Ended on " + host); // should this be debug?
+        log.info("Test Ended on " + host);
         try {
             listener.testEnded(host);
         } catch (RemoteException ex) {
@@ -81,4 +69,13 @@ public class StandardSampleSender extend
             log.error("sampleOccurred", err);
         }
     }
+
+    /**
+     * Processed by the RMI server code; acts as testStarted().
+     * @throws ObjectStreamException  
+     */
+    private Object readResolve() throws ObjectStreamException{
+        log.info("Using StandardSampleSender for this test run");        
+        return this;
+    }
 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java?rev=1214179&r1=1214178&r2=1214179&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java Wed Dec
14 11:42:26 2011
@@ -22,6 +22,7 @@ import org.apache.jmeter.util.JMeterUtil
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
+import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.rmi.RemoteException;
 import java.util.ArrayList;
@@ -87,25 +88,9 @@ public class StatisticalSampleSender ext
      */
     StatisticalSampleSender(RemoteSampleListener listener) {
         this.listener = listener;
-        log.info("Using statistical sampling for this run." + " Thresholds: num="
+        log.info("Using StatisticalSampleSender for this run." + " Thresholds: num="
                 + getNumSamplesThreshold() + ", time=" + getTimeThresholdMs()
                 + ". Key uses ThreadName: " + getKeyOnThreadName());        
-
-    }
-
-    /**
-     * Checks if any sample events are still present in the sampleStore and
-     * sends them to the listener. Informs the listener of the testended.
-     */
-    public void testEnded() {
-        try {
-            if (sampleStore.size() != 0) {
-                sendBatch();
-            }
-            listener.testEnded();
-        } catch (RemoteException err) {
-            log.warn("testEnded()", err);
-        }
     }
 
     /**
@@ -115,6 +100,7 @@ public class StatisticalSampleSender ext
      * @param host the hostname that the test has ended on.
      */
     public void testEnded(String host) {
+        log.info("Test Ended on " + host);
         try {
             if (sampleStore.size() != 0) {
                 sendBatch();
@@ -218,4 +204,15 @@ public class StatisticalSampleSender ext
     	return isClientConfigured() ?
     			clientConfiguredKeyOnThreadName: serverConfiguredKeyOnThreadName;
     }
+
+    /**
+     * Processed by the RMI server code; acts as testStarted().
+     * @throws ObjectStreamException  
+     */
+    private Object readResolve() throws ObjectStreamException{
+        log.info("Using StatisticalSampleSender for this run." + " Thresholds: num="
+                + getNumSamplesThreshold() + ", time=" + getTimeThresholdMs()
+                + ". Key uses ThreadName: " + getKeyOnThreadName());        
+        return this;
+    }
 }



Mime
View raw message