Merge branch 'master' into wip-1903-fix-smallest-mailbox-√
This commit is contained in:
commit
c752f86ae3
5 changed files with 46 additions and 40 deletions
|
|
@ -397,6 +397,20 @@ object Future {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Trait representing a value that may not have been computed yet.
|
||||
*
|
||||
* @define asyncCallbackWarning
|
||||
*
|
||||
* Note: the callback function may (and probably will) run in another thread,
|
||||
* and therefore should not refer to any unsynchronized state. In
|
||||
* particular, if using this method from an actor, do not access
|
||||
* the state of the actor from the callback function.
|
||||
* [[akka.dispatch.Promise]].`completeWith`,
|
||||
* [[akka.pattern.PipeToSupport.PipeableFuture]].`pipeTo`,
|
||||
* and [[akka.dispatch.Future]].`fallbackTo` are some methods to consider
|
||||
* using when possible, to avoid concurrent callbacks.
|
||||
*/
|
||||
sealed trait Future[+T] extends Await.Awaitable[T] {
|
||||
|
||||
protected implicit def executor: ExecutionContext
|
||||
|
|
@ -449,6 +463,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* immediately. Multiple
|
||||
* callbacks may be registered; there is no guarantee that they will be
|
||||
* executed in a particular order.
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
def onComplete[U](func: Either[Throwable, T] ⇒ U): this.type
|
||||
|
||||
|
|
@ -461,6 +477,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* case Bar ⇒ target ! "bar"
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def onSuccess[U](pf: PartialFunction[T, U]): this.type = onComplete {
|
||||
case Right(r) if pf isDefinedAt r ⇒ pf(r)
|
||||
|
|
@ -475,6 +493,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* case NumberFormatException ⇒ target ! "wrong format"
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def onFailure[U](pf: PartialFunction[Throwable, U]): this.type = onComplete {
|
||||
case Left(ex) if pf isDefinedAt ex ⇒ pf(ex)
|
||||
|
|
@ -518,6 +538,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* Future(6 / 0) recover { case e: NotFoundException ⇒ 0 } // result: exception
|
||||
* Future(6 / 2) recover { case e: ArithmeticException ⇒ 0 } // result: 3
|
||||
* </pre>
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def recover[A >: T](pf: PartialFunction[Throwable, A]): Future[A] = {
|
||||
val p = Promise[A]()
|
||||
|
|
@ -541,6 +563,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* val f = Future { Int.MaxValue }
|
||||
* Future (6 / 0) recoverWith { case e: ArithmeticException => f } // result: Int.MaxValue
|
||||
* }}}
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
def recoverWith[U >: T](pf: PartialFunction[Throwable, Future[U]]): Future[U] = {
|
||||
val p = Promise[U]()
|
||||
|
|
@ -568,6 +592,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* case Right(v) => dealWithSuccess(v)
|
||||
* }
|
||||
* }}}
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
def andThen[U](pf: PartialFunction[Either[Throwable, T], U]): Future[T] = {
|
||||
val p = Promise[T]()
|
||||
|
|
@ -587,6 +613,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* c: String <- actor ? 7 // returns "14"
|
||||
* } yield b + "-" + c
|
||||
* </pre>
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def map[A](f: T ⇒ A): Future[A] = {
|
||||
val future = Promise[A]()
|
||||
|
|
@ -639,6 +667,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* c: String <- actor ? 7 // returns "14"
|
||||
* } yield b + "-" + c
|
||||
* </pre>
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def flatMap[A](f: T ⇒ Future[A]): Future[A] = {
|
||||
val p = Promise[A]()
|
||||
|
|
@ -661,6 +691,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
|
||||
/**
|
||||
* Same as onSuccess { case r => f(r) } but is also used in for-comprehensions
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def foreach[U](f: T ⇒ U): Unit = onComplete {
|
||||
case Right(r) ⇒ f(r)
|
||||
|
|
@ -669,6 +701,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
|
||||
/**
|
||||
* Used by for-comprehensions
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def withFilter(p: T ⇒ Boolean) = new FutureWithFilter[T](this, p)
|
||||
|
||||
|
|
@ -683,6 +717,8 @@ sealed trait Future[+T] extends Await.Awaitable[T] {
|
|||
* Returns a new Future that will hold the successful result of this Future if it matches
|
||||
* the given predicate, if it doesn't match, the resulting Future will be a failed Future
|
||||
* with a MatchError, of if this Future fails, that failure will be propagated to the returned Future
|
||||
*
|
||||
* $asyncCallbackWarning
|
||||
*/
|
||||
final def filter(pred: T ⇒ Boolean): Future[T] = {
|
||||
val p = Promise[T]()
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package akka
|
||||
|
||||
package object serialization {
|
||||
type JsValue = _root_.dispatch.json.JsValue
|
||||
val JsValue = _root_.dispatch.json.JsValue
|
||||
val Js = _root_.dispatch.json.Js
|
||||
val JsonSerialization = sjson.json.JsonSerialization
|
||||
val DefaultProtocol = sjson.json.DefaultProtocol
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package akka.serialization
|
||||
|
||||
object Compression {
|
||||
|
||||
object LZF {
|
||||
import voldemort.store.compress.lzf._
|
||||
def compress(bytes: Array[Byte]): Array[Byte] = LZFEncoder encode bytes
|
||||
def uncompress(bytes: Array[Byte]): Array[Byte] = LZFDecoder decode bytes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -420,11 +420,11 @@ object Dependencies {
|
|||
|
||||
val actorTests = Seq(
|
||||
Test.junit, Test.scalatest, Test.commonsMath, Test.mockito,
|
||||
Test.scalacheck, protobuf, jacksonMapper, sjson
|
||||
Test.scalacheck, protobuf, jacksonMapper
|
||||
)
|
||||
|
||||
val remote = Seq(
|
||||
netty, protobuf, sjson, h2Lzf, Test.junit, Test.scalatest,
|
||||
netty, protobuf, Test.junit, Test.scalatest,
|
||||
Test.zookeeper, Test.log4j // needed for ZkBarrier in multi-jvm tests
|
||||
)
|
||||
|
||||
|
|
@ -440,7 +440,7 @@ object Dependencies {
|
|||
|
||||
val mailboxes = Seq(Test.scalatest, Test.junit)
|
||||
|
||||
val fileMailbox = Seq(Test.scalatest, Test.junit)
|
||||
val fileMailbox = Seq(commonsIo, Test.scalatest, Test.junit)
|
||||
|
||||
val beanstalkMailbox = Seq(beanstalk, Test.junit)
|
||||
|
||||
|
|
@ -459,7 +459,7 @@ object Dependencies {
|
|||
</dependencies>
|
||||
}
|
||||
|
||||
val zookeeperMailbox = Seq(zkClient, zookeeper, Test.junit)
|
||||
val zookeeperMailbox = Seq(zkClient, zookeeper, commonsIo, Test.junit)
|
||||
|
||||
val spring = Seq(springBeans, springContext, Test.junit, Test.scalatest)
|
||||
|
||||
|
|
@ -505,7 +505,6 @@ object Dependency {
|
|||
val commonsIo = "commons-io" % "commons-io" % "2.0.1" // ApacheV2
|
||||
val commonsPool = "commons-pool" % "commons-pool" % "1.5.6" // ApacheV2
|
||||
val guice = "org.guiceyfruit" % "guice-all" % "2.0" // ApacheV2
|
||||
val h2Lzf = "voldemort.store.compress" % "h2-lzf" % "1.0" // ApacheV2
|
||||
val jacksonCore = "org.codehaus.jackson" % "jackson-core-asl" % V.Jackson // ApacheV2
|
||||
val jacksonMapper = "org.codehaus.jackson" % "jackson-mapper-asl" % V.Jackson // ApacheV2
|
||||
val jettyUtil = "org.eclipse.jetty" % "jetty-util" % V.Jetty // Eclipse license
|
||||
|
|
@ -519,7 +518,6 @@ object Dependency {
|
|||
val rabbit = "com.rabbitmq" % "amqp-client" % V.Rabbit // Mozilla Public License
|
||||
val redis = "net.debasishg" % "redisclient_2.9.1" % "2.4.0" // ApacheV2
|
||||
val scalaStm = "org.scala-tools" % "scala-stm_2.9.1" % V.ScalaStm // Modified BSD (Scala)
|
||||
val sjson = "net.debasishg" % "sjson_2.9.1" % "0.15" // ApacheV2
|
||||
val slf4jApi = "org.slf4j" % "slf4j-api" % V.Slf4j // MIT
|
||||
val springBeans = "org.springframework" % "spring-beans" % V.Spring // ApacheV2
|
||||
val springContext = "org.springframework" % "spring-context" % V.Spring // ApacheV2
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
#
|
||||
# Release script for Akka.
|
||||
#
|
||||
# To run this script you need a user account on akka.io and contributor access
|
||||
# To run this script you need a user account on repo.akka.io and contributor access
|
||||
# to github.com/akka/akka.
|
||||
#
|
||||
# If your username on akka.io is different from your local username then you can
|
||||
# configure ssh to always associate a particular username with akka.io by adding
|
||||
# If your username on repo.akka.io is different from your local username then you can
|
||||
# configure ssh to always associate a particular username with repo.akka.io by adding
|
||||
# the following to .ssh/config:
|
||||
# Host akka.io
|
||||
# User <username on akka.io>
|
||||
# Host repo.akka.io
|
||||
# User <username on repo.akka.io>
|
||||
|
||||
# defaults
|
||||
declare -r default_server="akka.io"
|
||||
declare -r default_server="repo.akka.io"
|
||||
declare -r default_path="/akka/www"
|
||||
|
||||
# settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue