I am trying to extract currency from YQL in scala. getXML mentioned below takes the rest URL and returns the xml node. In my main code i would like to call getXML again in case failure happens after a sleep of 10000 milli seconds.
Kindly advise how can be achieved as when i am trying to make a getXML inside the failure code is not compiling.
def getXML(url: String): Try[scala.xml.Node] =
{
Try(XML.loadString(Source.fromURL(new URL(url)).mkString))
}
val nodes = getXML(ccyurl) match {
case Success(node) => node
case Failure(f) => {
Thread.sleep(10000)
/****/
}
No comments:
Post a Comment