Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
feat: add stashing helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
rockjam committed Nov 11, 2015
1 parent ce42600 commit b9ba4c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
target
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package im.actor.concurrent

import akka.actor.{ Stash, ActorRef, Actor }

trait ActorStashing {
self: Actor with Stash

protected def becomeStashing(f: ActorRef Receive): Unit =
context.become(f(sender()) orElse stashing, discardOld = false)

protected def receiveStashing(f: ActorRef Receive): Receive =
f(sender()) orElse stashing

private def stashing: Receive = {
case msg stash()
}
}

0 comments on commit b9ba4c7

Please sign in to comment.