actors

Scala actor to non-actor interaction (or synchronizing messages from an actor to a servlet)

I have the following scala code: package dummy import javax.servlet.http.{HttpServlet, HttpServletRequest => HSReq, HttpServletResponse => HSResp} import scala.actors.Actor class DummyServlet extends HttpServlet { RNG.start override def doGet(req: HSReq, resp: HSResp) = { def message = <HTML><HEAD><TITLE>Rando...

Which Actor model library/framework for python and Erlang-like?

Hi all, I am looking for a easy to learn Actor library or framework for Python 2.x I have tried Candygram and Twisted but I did not like none of them. I'd like something will be easy to extend to suppero Greenlet (= stackless python). Candygram is too old. Twisted is too complicated. Gevent: it is unclear if it can support Actors mod...

How to make full use of all cores using Scala actors?

I have a high CPU/memory bound task that I would like my Scala program to execute in parallel. So, I'm using the Actors framework (using receive in a while(true) loop). I call the start method on the actor and send it thousands of messages to process. During the execution of the program (takes about an hour), only 100 - 120% of the CPU...

How is the Actor Model working compared to threads?

Is there any good and short explanation of how the Actor Model is working compared to threads? Can't a thread be seen as an actor and send messages to other threads? I see some difference, but it's not that clear for me. Can I use the Actor Model in any language by using threads differently? ...

Scala Remote Actor Message type woes

So I've been playing around with remote actors, and I've run into some difficulties with serialization exceptions. One of my message is an instance of a case class, which itself contains an instance of a list of Path classes. The Path class is defined as follows, and is essentially a collection of Point instances with a precomputed dista...

Monads and Actors

I've been trying to find anything that discusses when you should favor the use of monads over actors (in concurrency scenarios), but I've found nothing. In particular, I'm wondering about the use of the Reactive Extensions (LINQ to Events) vs. F#'s MailboxProcessor. Please give examples in addition to any philosophical reasoning you migh...

Scala actors thread control

Hello, I would like to know more about the extent it is possible to control where each Scala actor is running. I happen to be in a somewhat particular case : high reactivity is desired, a good part of the code is time-critical, and worst of all, I'm on Android. With this in mind, my main goal is : make the code as readable and straightf...

How to disribute and maintain java/scala program over a Linux cluster ?

I have a small cluster of Linux machines and an account on all of them. I have ssh access to all of them with no-password login. How can I use actors or other Scala's concurrency abstraction to achieve distribution ? What is the simplest path? Does some library can distribute the processes for me? The computers are unreliable, they can...

Scala pattern matching confusion with Option[Any]

I have the following Scala code. import scala.actors.Actor object Alice extends Actor { this.start def act{ loop{ react { case "Hello" => sender ! "Hi" case i:Int => sender ! 0 } } } } object Test { def test = { (Alice !? (100, "Hello")) match { case i:Some[Int] => println ("Int rec...

How to terminate Scala Remote Actor client?

Hi. I'm playing with Remote Actors but I'm facing some difficulties. Consider this server: object Server { def main(args: Array[String]) { val server = new Server server.start } } class Server extends Actor { RemoteActor.alive(12345) RemoteActor.register('server, this) def act() { while(tr...

React for futures

I am trying to use a divide-and-conquer (aka fork/join) approach for a number crunching problem. Here is the code: import scala.actors.Futures.future private def compute( input: Input ):Result = { if( pairs.size < SIZE_LIMIT ) { computeSequential() } else { val (input1,input2) = input.split val f1 = future( compute(inpu...

Design patterns/best practice for building Actor-based system

I am struggling to find any decent links to design patterns, best practice or good, basic architectural principles that should be used in building Actor-based apps. Those few that I know of are: Blog posts, articles, WIKIs, guides OTP Design Principles User's Guide Patterns and Best Practices for Enterprise Integration (in general, c...

How would this Scala code look in idiomatic C#?

I came across this really nice looking Scala code while researching XMPP for a .Net project we're working on: object Main { /** * @param args the command line arguments */ def main(args: Array[String]) :Unit = { new XMPPComponent( new ComponentConfig() { def secret() : String = { "secret.goes.here" ...