File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/main/java/net/tascalate/concurrent Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -526,7 +526,14 @@ public static <T> Promise<T> failAfter(Duration duration) {
526526 public static <T > Promise <T > failAfter (long delay , TimeUnit timeUnit ) {
527527 return failAfter ( toDuration (delay , timeUnit ) );
528528 }
529-
529+
530+ public static Promise <Void > poll (Runnable codeBlock , Executor executor , RetryPolicy retryPolicy ) {
531+ Promise <Object > wrappedResult = pollOptional (
532+ () -> { codeBlock .run (); return Optional .of (new Object ()); },
533+ executor , retryPolicy
534+ );
535+ return dependent (wrappedResult ).thenApply (v -> null , true );
536+ }
530537
531538 public static <T > Promise <T > poll (Callable <? extends T > codeBlock , Executor executor , RetryPolicy retryPolicy ) {
532539 Promise <ObjectRef <T >> wrappedResult = pollOptional (
You can’t perform that action at this time.
0 commit comments