jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1783507 - /jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java
Date Sat, 18 Feb 2017 11:08:18 GMT
Author: fschumacher
Date: Sat Feb 18 11:08:18 2017
New Revision: 1783507

URL: http://svn.apache.org/viewvc?rev=1783507&view=rev
Log:
Use lambda syntax instead of 'new Runnable'

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java

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=1783507&r1=1783506&r2=1783507&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/DiskStoreSampleSender.java Sat Feb 18
11:08:18 2017
@@ -71,15 +71,13 @@ public class DiskStoreSampleSender exten
     @Override
     public void testEnded(String host) {
         log.info("Test Ended on {}", host);
-        singleExecutor.submit(new Runnable(){
-            @Override
-            public void run() {
-                try {
-                    oos.close(); // ensure output is flushed
-                } catch (IOException e) {
-                    log.error("Failed to close data file.", e);
-                }                
-            }});
+        singleExecutor.submit(() -> {
+            try {
+                oos.close(); // ensure output is flushed
+            } catch (IOException e) {
+                log.error("Failed to close data file.", e);
+            }
+        });
         singleExecutor.shutdown(); // finish processing samples
         try {
             if (!singleExecutor.awaitTermination(3, TimeUnit.SECONDS)) {
@@ -128,18 +126,13 @@ public class DiskStoreSampleSender exten
     public void sampleOccurred(final SampleEvent e) {
         // sampleOccurred is called from multiple threads; not safe to write from multiple
threads.
         // also decouples the file IO from sample generation
-        singleExecutor.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        oos.writeObject(e);
-                    } catch (IOException err) {
-                        log.error("sampleOccurred", err);
-                    }                
-                }
-            
+        singleExecutor.submit(() -> {
+            try {
+                oos.writeObject(e);
+            } catch (IOException err) {
+                log.error("sampleOccurred", err);
             }
-        );
+        });
     }
 
     /**
@@ -156,17 +149,15 @@ public class DiskStoreSampleSender exten
         try {
             temporaryFile = File.createTempFile("SerialisedSampleSender", ".ser");
             temporaryFile.deleteOnExit();
-            singleExecutor.submit(new Runnable(){
-                @Override
-                public void run() {
-                    OutputStream anOutputStream;
-                    try {
-                        anOutputStream = new FileOutputStream(temporaryFile);
-                        oos = new ObjectOutputStream(anOutputStream);
-                    } catch (IOException e) {
-                        log.error("Failed to create output Stream", e);
-                    }
-                }});
+            singleExecutor.submit(() -> {
+                OutputStream anOutputStream;
+                try {
+                    anOutputStream = new FileOutputStream(temporaryFile);
+                    oos = new ObjectOutputStream(anOutputStream);
+                } catch (IOException e) {
+                    log.error("Failed to create output Stream", e);
+                }
+            });
         } catch (IOException e) {
             log.error("Failed to create output file", e);
         }



Mime
View raw message