This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{Actor, FSM} | |
import java.util.concurrent.TimeUnit | |
sealed trait Health | |
case object Stale extends Health | |
case object Alive extends Health | |
case object Dead extends Health | |
case object HeartBeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GotoFsm extends Actor with FSM[Int, Null] { | |
notifying { | |
case Transition(_, 10) => println("Goto 10 ftw!") | |
} | |
when(0) { | |
case _ => goto(10) until 5000 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.amqp.AMQP.{ToBinary, FromBinary} | |
import rpc.RPC.{RpcClientSerializer, RpcServerSerializer} | |
import rpc.RPC | |
import akka.actor.ActorRegistry | |
object RPCExample { | |
def main(args: Array[String]) { | |
// shared between client and server | |
val connection = AMQP.newConnection() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package actor.actor | |
import akka.actor.{Actor, FSM} | |
import java.util.concurrent.TimeUnit | |
sealed trait ExampleState | |
case object A extends ExampleState | |
case object B extends ExampleState | |
case object C extends ExampleState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{Actor, FSM} | |
import java.util.concurrent.TimeUnit | |
sealed trait Health | |
case object Stale extends Health | |
case object Alive extends Health | |
case object Dead extends Health | |
case object HeartBeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package samples.fsm.lock | |
import java.util.concurrent.TimeUnit | |
import TimeUnit._ | |
import akka.actor.{ActorRegistry, FSM, Actor} | |
sealed trait LockState | |
case object Locked extends LockState | |
case object Open extends LockState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.amqp.AMQP._ | |
import akka.amqp._ | |
import akka.actor._ | |
import java.util.concurrent.{TimeUnit, CountDownLatch} | |
import util.Random | |
object LoadBalancingDemo { | |
def main(args: Array[String]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package notification | |
import com.sun.awt.AWTUtilities | |
import java.awt.geom.RoundRectangle2D | |
import org.jdesktop.animation.timing.{TimingTarget, Animator} | |
import swing._ | |
import event.MouseClicked | |
import com.efgfp.creditspy.util.GuiUtil | |
import akka.actor.{FSM, Actor} | |
import org.jdesktop.animation.timing.Animator.{Direction, RepeatBehavior} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ExtractionTest extends Application { | |
case object Message | |
case class Event(event: Any, data: Int) | |
def partialWithNormalCase: PartialFunction[Event, Int] = { | |
case Event(Message, 1) => 1 | |
case Event(Message, 2) => 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.acme.logging | |
import akka.actor.Actor | |
import akka.event.EventHandler | |
import akka.event.slf4j.{Logger, Logging} | |
class MySlf4jEventHandler extends Actor with Logging { | |
import EventHandler._ | |
self.id = ID |
OlderNewer