Representation of asynchronous communication protocols in Scala and Akka
Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesis
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.
Place, publisher, year, edition, pages
2013. , 148 p.
Scala, Akka, State Machine, FSM, Asynchronous, Communication, Protocol, Delimited Continuations, CPS
IdentifiersURN: urn:nbn:se:liu:diva-96660ISRN: LIU-IDA/LITH-EX-A--13/038--SEOAI: oai:DiVA.org:liu-96660DiVA: diva2:642459
Subject / course
Sandahl, Kristian, Professor