Permalink
Browse files

...

  • Loading branch information...
1 parent d5a1907 commit 1e15c10770525d03d55bd69d7256e399497a4f9c @henrikengstrom committed Sep 1, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 service/src/main/scala/com/typesafe/akkademo/service/BettingService.scala
@@ -27,18 +27,18 @@ class BettingService extends Actor with ActorLogging {
context.system.scheduler.schedule(2 seconds, 2 seconds, self, HandleUnprocessedBets)
def receive = {
- case RegisterProcessor =>
+ case RegisterProcessor
log.info("processor registered")
processor = Some(sender)
- case bet: Bet =>
+ case bet: Bet
val playerBet = processBet(bet)
- for (p <- processor) p ! playerBet
- case RetrieveBets =>
+ for (p processor) p ! playerBet
+ case RetrieveBets
log.info("retrieving bets perhaps... processor defined? -> " + processor.isDefined)
- for (p <- processor) p.tell(RetrieveBets, sender)
- case ConfirmationMessage(id) => handleProcessedBet(id)
- case HandleUnprocessedBets => handleUnprocessedBets()
- case r: RemoteServerClientDisconnected =>
+ for (p processor) p.tell(RetrieveBets, sender)
+ case ConfirmationMessage(id) handleProcessedBet(id)
+ case HandleUnprocessedBets handleUnprocessedBets()
+ case r: RemoteServerClientDisconnected
log.info("processor unregistered")
processor = None
}
@@ -62,6 +62,6 @@ class BettingService extends Actor with ActorLogging {
// Please make sure you understand that I can do this since the processor repository is idempotent!
log.info("handling unprocessed bets (size): " + bets.size)
- if (processor.isDefined) bets.keys.foreach { k => for (p <- processor) p ! PlayerBet(k, bets(k)) }
+ if (processor.isDefined) bets.keys.foreach { k for (p processor) p ! PlayerBet(k, bets(k)) }
}
}

0 comments on commit 1e15c10

Please sign in to comment.