wszystkie wpisy 2012 Java
Java · Snippet · 2012-08-07 · 1 min

How to add balancer in scala 2.9 and akka 2.0.2

In Akka 2.0.2 authors change a procedure to set a load balance. Example to set router:

val system = ActorSystem("HarvestSystem")
val router = system.actorOf(Props[SiteTestActor].withRouter(RoundRobinRouter(nrOfInstances = testSiteWorkes)))

implicit val timeout = Timeout (10 seconds)

val countUrl=index.values.size
val countDownUrl = new CountDownLatch(countUrl)

var cnt=0
index.values.foreach(url =>{

Sys.info("HarvestActor::"+actorName,"Start site test "+cnt+": "+url.toString,4)
cnt+=1

val futureTest=router ask SiteTestRequest(url.toString,testKeyWord,countDownUrl)

Następny wpis →

Access to variable of another object – reflect method

2012-08-10 · 2 min czytania