Created
November 16, 2015 13:09
-
-
Save daniele-pecora/8c7fd0e09cba9ed31829 to your computer and use it in GitHub Desktop.
Revisions
-
Daniele Pecora renamed this gist
Nov 16, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ /** * Using javas {@link java.util.concurrent.ExecutorService ExecutorService} to run an action concurrently */ public class MyConcurrentJob{ public void justDoIt(){ Runnable action = () -> { -
Daniele Pecora created this gist
Nov 16, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ import java.util.concurrent.Executors; /** * Using javas {@link java.util.concurrent.ExecutorService ExecutorService} to run an action concurrently */ public class MyJob{ public void justDoIt(){ Runnable action = () -> { try { // do whatever you like to do here... System.out.println("I'm doing somethin' concurrently..."); } catch (Exception e) { e.printStacktrace(); } }; Executors.newSingleThreadExecutor().execute(action); } }