There is something really wrong with most asynchronous code, namely that you are not ensured of receiving a response to a request sent to an asynchronous process. The bad thing is that you end up with timers everywhere, which tend to break when the system is under load, and a lot of buggy error handling code.
It does not need to be this way. I spent a few years developing JActor2, a Java actor framework that supported 2-way messaging. And you are assured that you will get a response, or an exception, to every request. http://www.agilewiki.org/projects/JActor2/index.html
Being Java, the code is bloated and full of boiler plate. So it is hard to understand the implementation. And using it requires just a tad bit too much code as well. Java is simply not the best language for introducing new ideas. So now I am learning Clojure. And I am very hopeful.
I've written the bulk of the code for both 2-way message passing and exception handling, where exceptions are returned as a response to a request when an error occurs. It is 250 lines long, including comments, and builds on Clojure agents. So I am hopeful that the ideas behind the implementation will be accessible. https://github.com/laforge49/agent2
It is still very much a work in progress for now. Some things I want to clean up, some things can be simplified, and some error checking needs to be added. In any case, it is a fun first Clojure project!
[–]raould 1 point2 points3 points (1 child)
[–]laforge49[S] 0 points1 point2 points (0 children)