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

Commit

Permalink
Merge upgrade to Akka 2.2.1 [from crdueck](#14)
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit fbbbf94f4a66e9eff087d8e655935611d4b32165
Author: Lloyd Meta <lloydmeta@gmail.com>
Date:   Thu Sep 19 08:42:22 2013 +0900

    Update Props instantiation to 2.2.1 syntax and revert to Await

commit 1ed97c6
Author: crdueck <chris@chris-OptiPlex-760.(none)>
Date:   Wed Sep 18 14:22:24 2013 -0400

    update to Akka 2.2.1

commit 7909efd
Author: crdueck <chris@chris-OptiPlex-760.(none)>
Date:   Wed Sep 18 14:20:45 2013 -0400

    remove sbt-idea plugin
  • Loading branch information
lloydmeta committed Sep 18, 2013
1 parent 0d09bc0 commit 73ff27c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,6 +5,7 @@
*~

#sbt
/project/plugins.sbt
/project/target/
/project/project/target

Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Expand Up @@ -12,8 +12,8 @@ resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/release

libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "1.9.1" % "test",
"com.typesafe.akka" %% "akka-testkit" % "2.1.4",
"com.typesafe.akka" %% "akka-agent" % "2.1.4",
"com.typesafe.akka" %% "akka-testkit" % "2.2.1" % "test",
"com.typesafe.akka" %% "akka-agent" % "2.2.1",
"com.typesafe" %% "scalalogging-slf4j" % "1.0.1",
"org.slf4j" % "slf4j-api" % "1.7.1",
"ch.qos.logback" % "logback-classic" % "1.0.3"
Expand Down Expand Up @@ -62,4 +62,4 @@ pomExtra := (
<url>http://beachape.com</url>
</developer>
</developers>
)
)
1 change: 0 additions & 1 deletion project/plugins.sbt

This file was deleted.

Expand Up @@ -13,7 +13,7 @@ object CallbackActor {
* Factory method for props required to spawn a MonitorActor
* @return Props for spawning an actor
*/
def apply() = Props(new CallbackActor)
def apply() = Props(classOf[CallbackActor])
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/main/scala/com/beachape/filemanagement/MonitorActor.scala
Expand Up @@ -12,6 +12,7 @@ import scala.language.existentials
import scala.language.postfixOps
import akka.routing.SmallestMailboxRouter
import com.beachape.filemanagement.Messages._
import scala.concurrent.Await

/**
* Companion object for creating Monitor actor instances
Expand All @@ -26,7 +27,7 @@ object MonitorActor {
*/
def apply(concurrency: Int = 5) = {
require(concurrency > 1, s"Callback concurrency requested is $concurrency but it should at least be 1")
Props(new MonitorActor(concurrency))
Props(classOf[MonitorActor], concurrency)
}
}

Expand All @@ -40,6 +41,7 @@ class MonitorActor(concurrency: Int = 5) extends Actor with Logging with Recursi

implicit val timeout = Timeout(10 seconds)
implicit val system = context.system
implicit val ec = context.dispatcher

// Round-robin of callback performers helps control concurrency
val callbackActorsRoundRobin = context.actorOf(
Expand Down Expand Up @@ -181,7 +183,7 @@ class MonitorActor(concurrency: Int = 5) extends Actor with Logging with Recursi
def callbacksForPath(eventType: WatchEvent.Kind[Path], path: Path): Option[Callbacks] = {
eventTypeCallbackRegistryMap.
get(eventType).
flatMap(registryAgent => registryAgent.await.callbacksForPath(path))
flatMap(registryAgent => Await.result(registryAgent.future, 10 seconds).callbacksForPath(path))
}

/**
Expand Down

0 comments on commit 73ff27c

Please sign in to comment.