actors

Implement timeout in actors

Hi, I am new to scala and actors. I need to implement such hypothetical situation: Server wait for messages, if it does not get any in say 10s period of time, it sends message to the Client. Otherwise it receives messages incoming. If it is inside processing some message and another message comes, it needs to be queued (I suppose that ...

Actors in Scala.net

I have recently completed some study of erlang, and was intrigued by scala for its feature set and the ease of interpolating with java (and possibly .net) applications. I am finally studying actors and was wondering if there is an actor mechanism that currently works in .net. I have looked at the libararies that come down with sbaz an...

What are messages in actor programming?

This question describes what actors are in actor programming. What are messages? How can you avoid shared state if you send an object in a message (assuming objects exist in actor programming)? ...

Wait for an Actor to exit()

How do I wait for a Scala Actor to exit()? I set up two Actors in a unit test, and send a few messages to get them started. They send a few messages back and forth and eventually both call exit(). How do I make my unit test wait for both Actors to finish up before passing? ...

Actors Mailbox Overflow. Scala

Im currently working with two actors in scala. One, the producer, produces some data and sends it to a parcer. The producer sends a HashMap[String,HashMap[Object,List[Int]]] through a message (along with this to mark the sender): parcer ! (this,data) The parser is constantly waiting for messages like so: def act(){ loop{ re...

Is there a Scala-specific way to implement periodic execution?

AKA doing something at set intervals. For example, let's say I want to scan a certain directory every 60 seconds. In Java, I would use a ScheduledExecutorService like so: Executor pool = Executors.newScheduledThreadPool(10) pool.scheduleAtFixedRate(scanner, 0, 60, TimeUnit.SECONDS) and that works fine. The thing is, I'm thinking I'...

How to make a scala actor 'wait for the signal' but don't loose any messages?

I'm trying to make an actor 'go to sleep' waiting for another actors signal. I want to do something like: def act(){ loop{ //Should I use loop here too?? if(sleepy){ react{ //SLEEPING case "Wake Up"=> sleepy=false; //just to breack the react } }else{ ...

actors with daemon-style semantics

Scala 2.8 was announced yesterday. They highlight among other things "Enhanced actors". What does "actors with daemon-style semantics" mean and where can I find more about that? ...

How Clojure's agents compare to Scala's actors?

I wrote a simulation of the Ring network topology in Scala (source here) (Scala 2.8 RC7) and Clojure (source here) (Clojure 1.1) for a comparison of Actors and Agents. While the Scala version shows almost constant message exchange rate as I increase the number of nodes in network from 100 to 1000000, the Clojure version shows message r...

RemoteActor unregister actor

I'm playing with RemoteActors. Now I wonder, what happens if I shut down an RemoteActor. The actor was made available with RemoteActor.alive and RemoteActor.register. I can't find the inverse of either of both: alive and register. How do I properly shut down an RemoteActor? Update To make it more obvious, I made a 'small' example. Ne...

RemoteActor.select - result deterministic?

I wonder if there is any determinism when calling val delegate = RemoteActor.select(). I'm asking this, because I noticed that the program doesn't terminate, when I'm sending delegates over the net. Are there any other side effects, which depend on the delegate? Are there any rules, when RemoteActor.select will return the same delega...

Scala Remote Actors - Pitfalls

While writing Scala RemoteActor code, I noticed some pitfalls: RemoteActor.classLoader = getClass().getClassLoader() has to be set in order to avoid "java.lang.ClassNotFoundException" link doesn't always work due to "a race condition for which a NetKernel (the facility responsible for forwarding messages remotely) that backs a remote ...

How do I kill a RemoteActor?

Not sure whether I am missing something. When making an actor remote, the main method does not terminate. Here is a snippet that demonstrates the problem. import scala.actors._ import scala.actors.remote._ object TestMe { def main(args : Array[String]) : Unit = { object jim extends DaemonActor { // comment out th...

How should I handle blocking operations when using scala actors?

I started learning the scala actors framework about two days ago. To make the ideas concrete in my mind, I decided to implement a TCP based echo server that could handle multiple simultaneous connections. Here is the code for the echo server (error handling not included): class EchoServer extends Actor { private var connections = 0 ...

program hangs when using multiple futures with multiple remote actors

I start two remote actors on one host which just echo whatever is sent to them. I then create another actor which sends some number of messages (using !! ) to both actors and keep a List of Future objects holding the replies from these actors. Then I loop over this List fetching the result of each Future. The problem is that most of the ...

Which Actor model library/framework for Java?

There are so many different Actor model implementations for Java (and the JVM languages). A lot of Actor libraries and frameworks have been implemented to permit Actor-style programming in Java (which doesn't have Actors built-in). I think the Actor model has big advantages, but the choices for Java are overwhelming! Can someone post t...

Zero-copy message-passing on the JVM

A faithful implementation of the actor message-passing semantics would mean that message contents are deep-copied from a logical point-of-view, even for immutable types. Deep-copying of message contents remains one the biggest bottlenecks for naïve implementations the actor model, so some implementations (ie. Kilim) support zero-copy mes...

Performance of message-passing in the Actor model

I've seen benchmarks of Actor model implementations done in terms of their actors. For example, Akka actors are very lightweight (600 bytes per actor) and millions of them can be created. However, I've never seen a benchmark done in terms of message-passing throughput. For example, given some number of actors, how many messages can pass...

How is the mailbox (message queue) implemented in Scala Actors?

Behind the scenes, how is a mailbox (an actor's message queue) implemented in Scala Actors? I thought it was MessageQueue, but it's been deprecated with the note that "this class is going to be removed in a future release". It looks like it might be in Channel, but I want the details of how the message queue itself is implemented. ...

Why can you have millions of actors in an application, but just 10,000 threads is too many?

Why can you have millions of actors in an application, but just 10,000 threads is too many? How is it that creating millions of actors is practical, but more than a couple threads is not? What can threads do that actors can't (or else we would use actors all the time!)? ...