File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
approvaltests-util/src/main/java/com/spun/util Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 33import com .spun .util .logger .SimpleLogger ;
44import org .lambda .actions .Action0 ;
55
6+ import java .time .Duration ;
7+
68public class LambdaThreadLauncher implements Runnable
79{
810 private final Action0 function ;
@@ -12,6 +14,9 @@ public LambdaThreadLauncher(Action0 function)
1214 {
1315 this (function , 0 );
1416 }
17+ public LambdaThreadLauncher (Action0 function , Duration delay ) {
18+ this (function , delay .toMillis ());
19+ }
1520 public LambdaThreadLauncher (Action0 function , long delay )
1621 {
1722 this .delay = delay ;
Original file line number Diff line number Diff line change 11package com .spun .util ;
22
3+ import org .lambda .actions .Action0 ;
4+
5+ import java .time .Duration ;
6+
37public class ThreadUtils
48{
59 public static void sleep (long millis )
@@ -13,6 +17,14 @@ public static void sleep(long millis)
1317 // ignore
1418 }
1519 }
20+ public static void launch (Action0 action )
21+ {
22+ launch (action , Duration .ZERO );
23+ }
24+ public static void launch (Action0 action , Duration delay )
25+ {
26+ new LambdaThreadLauncher (action , delay );
27+ }
1628 public static StackTraceElement [] getStackTrace ()
1729 {
1830 return Thread .currentThread ().getStackTrace ();
You can’t perform that action at this time.
0 commit comments