Monday, 4 August 2014

Multi phased processing in scala

Last time in our project we had to add progress bar for visualization of long time running process. Process was made of a few phases and we had to print in which phase we currently are. In first step we conclude that we need to create a class of Progress which will be passed as an implicit parameter to our service. Then we will wrap method calls be inProgress method which will notify some e.g. akka actor about phase begin and phase end.



But this approach has some disadvantages. Firstly before we start service's operation we need to init progress with count of all phases to get know ratio of progress finish. With this approach we had to add some extra counting before operation start.