SHARE
TWEET

Untitled

a guest Aug 17th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.   * Provide alternative method to execute when future failed
  3.   */
  4. def fallbackTo(): Unit = {
  5.   val f: Future[String] = downloadBlob("ftp://blobs/8671").fallbackTo {
  6.     println(s"fetch from ftp")
  7.     // fetch blob via ftp
  8.     fetchBlob("ftp://blobs/8671")
  9.   }
  10.   println(Await.result(f, 10.seconds))
  11. }
  12.  
  13. /*
  14.  * output
  15. fetch from ftp
  16. cmFoYXNhayBsYWJz
  17. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top