Avoid AtomicInteger overflow in RoundRobinRouter. See #1610
This commit is contained in:
parent
bf367f3d4f
commit
8abcf8ce2a
1 changed files with 4 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
|||
package akka.routing
|
||||
|
||||
import akka.actor._
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import akka.util.{ Duration, Timeout }
|
||||
import akka.config.ConfigurationException
|
||||
import scala.collection.JavaConversions.iterableAsScalaIterable
|
||||
|
|
@ -264,10 +264,11 @@ trait RoundRobinLike { this: RouterConfig ⇒
|
|||
def createRoute(props: Props, context: ActorContext, ref: RoutedActorRef): Route = {
|
||||
createAndRegisterRoutees(props, context, nrOfInstances, routees)
|
||||
|
||||
val next = new AtomicInteger(0)
|
||||
val next = new AtomicLong(0)
|
||||
|
||||
def getNext(): ActorRef = {
|
||||
ref.routees(next.getAndIncrement % ref.routees.size)
|
||||
val _routees = ref.routees
|
||||
_routees((next.getAndIncrement % _routees.size).asInstanceOf[Int])
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue