Have you profiled this to quantify the performance improvement, and if so, 
did you run it under high contention situations to be sure the locks on the 
atomic don't start to be an issue under high contention?

On Thursday, May 28, 2015 at 11:43:24 AM UTC-4, Guido Medina wrote:
>
> Hi,
>
> I have my own version of a RoundRobinRouting logic which I believe it is 
> faster and less CPU intensive due to no mod math operation, here is my 
> version in Java 8, it has though one small error because NoRoutee instance 
> if private and I don't know much Scala, so here it is a copy/proposal :
>
> public class CircularRoutingLogic implements RoutingLogic {
>
>   final AtomicInteger next = new AtomicInteger(-1);
>
>   @Override
>   public Routee select(Object message, IndexedSeq<Routee> routees) {
>     final int size = routees.size();
>
>     // null should be replaced by NoRoutee Akka/Scala instance.
>     return size == 0 ? null : routees.apply(next.accumulateAndGet(1, (index, 
> increment) -> ++index >= size ? 0 : index));
>   }
> }
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to