alexanderjarvis/Play-DubSub — pull request #1 by pvillega (2013-04-07 13:19:05+00:00)
Title: Fix for Netty Issue

Hi,

I attach a fix for the Netty await() exception that raises when using the plugin in Dev mode.

The fix moves the conflicting code out of the initialization of the plugin so it doesn't trigger the exception. The system will be initialized later, when the calls to await are not an issue any more.

There is a downside to this change: to be able to use the Subscribe messages, a call to DubSubPlugin.system is required way before we want to access it.

I can't give full details on why as I'm not 100% sure, but in the websocket example (where I've been testing this) the Subscribe process happens in preStart of the ChatRoom actor and it seems that Akka initializes the DubSubSystem asynchronously, and the time it takes for Akka to start it means the Subscribe message is somehow lost.

That said, it may not be this and I may be completely wrong. In any case the system val must be called once for it to work as expected. I did so at Application.index just as a quick test, but there should be a better place for it.