Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. def withRetry[T](count: Int = 3)(t: => T): T =
  2. try
  3. t
  4. catch {
  5. case NonFatal(th) =>
  6. th.printStackTrace()
  7. if (count >= 0) {
  8. Thread.sleep(5000)
  9. withRetry(count - 1)(t)
  10. }
  11. else
  12. throw th
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement