When are threads created for Scala actor's reacts?

后端 未结 4 1275
伪装坚强ぢ
伪装坚强ぢ 2021-02-15 14:37

After reading about using react in actors in Scala, I thought react\'s would share the same thread given there weren\'t multiple react\'s

4条回答
  •  春和景丽
    2021-02-15 15:09

    Don't assume a separate thread per Actor. The Scala machinery creates a pool of worker threads and only grows that pool if the size of 'blocked' Actors is greater than the pool size. When your actor calls receive, it's in a blocked state until it receives its message.

提交回复
热议问题