0

(sort of followup to How to make a code thread safe in scala? )

I have a scala class that can inherently be called only from one thread (let's call it class ThreadUnsafeProducer); it is, however, safe to have more threads to each access exactly one object. However, the ThreadUnsafeProducer is quite memory heavy, so I don't want each thread to have one ThreadUnsafeProducer.

I want to have a given number N of ThreadUnsafeProducer objects (ideally one for each CPU).

I have lots of threads Consumer that all share the same object SharedObject.

I want to somehow use Actors model to give messages to either SharedObject or ThreadUnsafeProducer (I am not sure which) to have a given number of concurrent ThreadUnsafeProducer running. And I am quite lost in all the Akka/Actors classes.

Community
  • 1
  • 1
Karel Bílek
  • 36,467
  • 31
  • 94
  • 149

1 Answers1

0

I recently found Akka Routing classes

http://doc.akka.io/docs/akka/2.0/scala/routing.html

It looks really nice and exactly what I need. If it works it would be beautiful.

Karel Bílek
  • 36,467
  • 31
  • 94
  • 149