All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dubboclub.akka.remoting.actor.dispatcher.ClientDispatcher Maven / Gradle / Ivy

There is a newer version: 0.0.4
Show newest version
package net.dubboclub.akka.remoting.actor.dispatcher;

import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.routing.ActorRefRoutee;
import akka.routing.Routee;
import akka.routing.Router;
import akka.routing.SmallestMailboxRoutingLogic;
import net.dubboclub.akka.remoting.message.ActorOperate;
import scala.collection.immutable.IndexedSeq;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by bieber on 2015/7/16.
 */
public class ClientDispatcher extends DispatchActor {

    private static final Map CLIENT_CACHE = new HashMap();

    private static final int DEFAULT_CLIENT_SIZE=3;

    @Override
    protected void generateChildActor(Class actor, Object[] constructorArgs, String actorName) {
        Router router = CLIENT_CACHE.get(actorName);
        if(router==null){
            router=new Router(new SmallestMailboxRoutingLogic());
            CLIENT_CACHE.put(actorName,router);
            for(int i=0;i routeeIterator = router.routees();
                    for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy