jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1514479 - in /jmeter/trunk: src/core/org/apache/jmeter/samplers/BatchSampleSender.java xdocs/changes.xml
Date Thu, 15 Aug 2013 20:42:36 GMT
Author: pmouawad
Date: Thu Aug 15 20:42:36 2013
New Revision: 1514479

URL: http://svn.apache.org/r1514479
Log:
Bug 55423 - BatchSampleSender: Reduce locking granularity by moving listener.processBatch
outside of synchronized block
Bugzilla Id: 55423

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
    jmeter/trunk/xdocs/changes.xml

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=1514479&r1=1514478&r2=1514479&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java Thu Aug 15 20:42:36
2013
@@ -143,6 +143,7 @@ public class BatchSampleSender extends A
      */
     @Override
     public void sampleOccurred(SampleEvent e) {
+        List<SampleEvent> clonedStore = null;
         synchronized (sampleStore) {
             sampleStore.add(e);
             final int sampleCount = sampleStore.size();
@@ -167,18 +168,23 @@ public class BatchSampleSender extends A
             }
 
             if (sendNow){
-                try {
-                    log.debug("Firing sample");
-                    listener.processBatch(sampleStore);
-                    sampleStore.clear();
-                    if (timeThresholdMs != -1) {
-                        this.batchSendTime = now + timeThresholdMs;
-                    }
-                } catch (RemoteException err) {
-                    log.error("sampleOccurred", err);
-                }                
+                clonedStore = (ArrayList<SampleEvent>)((ArrayList<SampleEvent>)sampleStore).clone();
+                sampleStore.clear();
+                if (timeThresholdMs != -1) {
+                    this.batchSendTime = now + timeThresholdMs;
+                }
             }
         } // synchronized(sampleStore)
+        
+        if (clonedStore != null){
+            try {
+                log.debug("Firing sample");
+                listener.processBatch(clonedStore);
+                clonedStore.clear();
+            } catch (RemoteException err) {
+                log.error("sampleOccurred", err);
+            }  
+        }
     }
     
     /**

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1514479&r1=1514478&r2=1514479&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Aug 15 20:42:36 2013
@@ -365,6 +365,7 @@ Previously the default was 1, which coul
 <li><bugzilla>55175</bugzilla> - HTTPHC4Impl refactoring to allow better
inheritance. Contributed by Philippe Mouawad</li>
 <li><bugzilla>55236</bugzilla> - Templates - provide button to reload template
details.</li>
 <li><bugzilla>55237</bugzilla> - Template system should support relative
fileName entries.</li>
+<li><bugzilla>55423</bugzilla> - BatchSampleSender: Reduce locking granularity
by moving listener.processBatch outside of synchronized block</li>
 </ul>
 
 <h2>Non-functional changes</h2>



Mime
View raw message