2011-12-15 18:19:40 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
2011-12-15 15:28:21 +01:00
|
|
|
package akka.docs.routing
|
|
|
|
|
|
|
|
|
|
import akka.routing.ActorPool
|
|
|
|
|
import akka.actor.ActorRef
|
|
|
|
|
|
|
|
|
|
//#capacityStrategy
|
|
|
|
|
trait CapacityStrategy {
|
|
|
|
|
import ActorPool._
|
|
|
|
|
|
|
|
|
|
def pressure(delegates: Seq[ActorRef]): Int
|
|
|
|
|
def filter(pressure: Int, capacity: Int): Int
|
|
|
|
|
|
|
|
|
|
protected def _eval(delegates: Seq[ActorRef]): Int =
|
|
|
|
|
filter(pressure(delegates), delegates.size)
|
|
|
|
|
}
|
|
|
|
|
//#capacityStrategy
|