Representation of asynchronous communication protocols in Scala and Akka

University essay from Programvara och system; Tekniska högskolan

Abstract: This thesis work investigates how to represent protocols for asynchronous communication in the Scala programming language and the Akka actor framework, to be run on Java Virtual Machine (JVM). Further restrictions from the problem domain - the coexistence of multiple protocol instances sharing the same Java thread - imply that neither an asynchronous call waiting for response nor anything else can block the underlying Java threads. A common way to represent asynchronous communication protocols is to use state machines. This thesis seeks a way to shrink the size of and to reduce the complexity of the protocol implementations by representing sequences of asynchronous communication calls (i.e. sequences of sent and received messages) as a type of procedure. The idea is find a way to make the procedures that contain asynchronous calls look like synchronous communication procedures by hiding the asynchronous details. In other words, the resulting procedure code should show what to do and not so much focus on how to overcome the impediment of the asynchronous calls. With the help of an asynchronous communication protocol toy example, this report shows how such an protocol can be implemented with a combination of a state machine and a procedure representation in Scala and Akka. The procedure representation hides away the asynchronous details by using the Scala capability to use CPS-transformed delimited continuations. As a sub-problem, this thesis also shows how to safely schedule asynchronous communication timeouts with help of Scala and Akka within the restrictions of the thesis problem domain.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)