문제

Context: I want to write scalding job(hadoop) to crawl pages and I want to set timeout on url extraction(without timeout on URLConnection, I want generic solution for other timeout cases) i.e. map function.

I'm think about futures which are killed after some timout with all resources released since it is memory critical code. Not sure what to use in scala API.

도움이 되었습니까?

해결책

While Akka was suggested--and is superior to the following solution--Scala does have its own, built in Actor model much like Akka which can do you want you want. Examples can be found here:

http://www.scala-lang.org/node/242

You'll probably want either reactWithin or receiveWithin, the documentation for which can be found here:

http://www.scala-lang.org/api/current/scala/actors/TIMEOUT$.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top