By gst
via weblogs.java.net
Published: Sep 19 2007 / 15:10
... In Phobos proper, in addition to some bug fixes, the major new functionality we added is an actor library (please refer to the Phobos jsdocs for the details of the API). We also enabled debugging of background threads in NetBeans, so that you can put breakpoints in and step through code executed by an actor.
Clearly inspired by Erlang and Scala, the actor library allows the creation of "actors" in JavaScript, defined as named functions which asynchronously process messages sent to them. Upon reception of a message, the function is executed in a separate thread, so it doesn't have access to the usual request and response objects. Much like Google Gears tasks, actors can only communicate by sending messages to each other or by making changes to shared resources, like a database or (not too often, hopefully) a global variable. Every actor has its own mailbox; messages sent to an actor are processed in strict sequential order. All messages are JSON-encoded, which makes them look like regular objects to JavaScript code.
Tweet
SaveShareSend
Tags: frameworks, java, javascript
Add your comment