Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def withRetry[T](count: Int = 3)(t: => T): T =
- try
- t
- catch {
- case NonFatal(th) =>
- th.printStackTrace()
- if (count >= 0) {
- Thread.sleep(5000)
- withRetry(count - 1)(t)
- }
- else
- throw th
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement