jboner/akka — pull request #170 by casualjim (2011-12-16 10:27:16+00:00)
Title: Fixes a number of issues with the concurrent socket actor

I've been using akka-zeromq in our project but I keep running into a zeromq bug

https://zeromq.jira.com/browse/LIBZMQ-292

So when using the global executor based dispatcher I run into this pretty frequently:
± ivan@gladrags:~MOJOLLY_HOME/backchat-borg
git:(feature/loadbalancing) ✗ ! » sbt test
[info] Loading global plugins from /Users/ivan/.sbt/0.11.0/plugins
[info] Loading project definition from /Users/ivan/projects/mojolly/backchat-borg/project
[info] Set current project to backchat-borg (in build file:/Users/ivan/projects/mojolly/backchat-borg/)
Assertion failed: ok (mailbox.cpp:79)
[1] 22371 abort sbt test

This is caused by concurrent access to the socket, so I've changed the dispatcher to a thread based dispatcher and that seems to work as then the socket is always accessed from the same thread, in 2.0 the pinned feature can be used.

http://zguide.zeromq.org/page:all#Multithreading-with-MQ

I've also made sure that the polling loop now uses a future with the supplied dispatcher for the polling of the socket instead of blocking the actor.