scala - Using locks on Akka Actors -
i have actor goes (assume receive method overridden somewhere else):
class myclass extends actor { def method1() = { ... } def method2() = { ... } def method3() = { this.synchronized { .... .... } } }
what happens if have final field defined in actor as:
private val locktype = new anyref
i can use lock synchronize method3? difference? understanding using reference lock on method make reference unavailable until lock released.
in above case, use lock can function independently of reference , lock when action on method3 made, while reference still available other threads?
there's no need synchronization inside of actor. actor ever process single message @ time.
Comments
Post a Comment