public static < U > Task < U > withRetryPolicy ( String name , RetryPolicy policy , Function1 < Integer , Task < U > > taskFunction ) { RetriableTask < U > retriableTask = new RetriableTask <> ( name , policy , taskFunction ) ; Task < U > retryTaskWrapper = Task . async ( name + " retriableTask" , retriableTask :: run ) ; retryTaskWrapper . getShallowTraceBuilder ( ) . setTaskType ( TaskType . WITH_RETRY . getName ( ) ) ; return retryTaskWrapper ; }
A helper for creating task wrapper with associated retry policy .