mardi 21 avril 2015

implementation of multithreading and synchronization in scala [on hold]

How to create threads in Scala as in java, i used following ? without using java syntax as given in scala school

    val pool = Executors.newFixedThreadPool(3)
    var t=new Test   
    //Test is a SCALA class extends runnable and defines run method
    for(x<- 1 to 3)


How to apply synchronization in SCALA ? I used following in above code is it correct?

     val t=new Test

How to create synchronized block/method ? synchronized keyword is not here in scala. without using java's syntax is it possible to synchronize block and methods. by using val with objects is it correct way to synchronize an object.

Aucun commentaire:

Enregistrer un commentaire