Change sender and senderfuture to Either
This commit is contained in:
parent
784ca9e750
commit
2593fd3ab3
9 changed files with 49 additions and 66 deletions
|
|
@ -84,8 +84,14 @@ import se.scalablesolutions.akka.dispatch.CompletableFuture
|
|||
def receive = {
|
||||
case Get =>
|
||||
val ref = dataFlow.value.get
|
||||
if (ref.isDefined) reply(ref.get)
|
||||
else readerFuture = senderFuture
|
||||
if (ref.isDefined)
|
||||
reply(ref.get)
|
||||
else {
|
||||
readerFuture = replyTo match {
|
||||
case Some(Right(future)) => Some(future)
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
case Set(v) => if (readerFuture.isDefined) readerFuture.get.completeWithResult(v)
|
||||
case Exit => exit
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue