Controller for a group of actors which manages their execution.
Inheritance: FanObj
Exemplo n.º 1
0
        public static Actor make(ActorPool pool, Func receive)
        {
            Actor self = new Actor();

            make_(self, pool, receive);
            return(self);
        }
Exemplo n.º 2
0
        public static Actor makeCoalescing(ActorPool pool, Func k, Func c, Func r)
        {
            Actor self = new Actor();

            makeCoalescing_(self, pool, k, c, r);
            return(self);
        }
Exemplo n.º 3
0
        public static ActorPool make(Func itBlock)
        {
            ActorPool self = new ActorPool();

            make_(self, itBlock);
            return(self);
        }
Exemplo n.º 4
0
        public static void make_(ActorPool self, Func itBlock)
        {
            if (itBlock != null)
              {
            itBlock.enterCtor(self);
            itBlock.call(self);
            itBlock.exitCtor();
              }
              if (self.m_maxThreads < 1) throw ArgErr.make("ActorPool.maxThreads must be >= 1, not " + self.m_maxThreads).val;

              self.m_threadPool = new ThreadPool((int)self.m_maxThreads);
              self.m_scheduler = new Scheduler();
        }
Exemplo n.º 5
0
        public static void makeCoalescing_(Actor self, ActorPool pool, Func k, Func c, Func r)
        {
            if (k != null && !k.isImmutable())
            {
                throw NotImmutableErr.make("Coalescing toKey func not immutable: " + k).val;
            }

            if (c != null && !c.isImmutable())
            {
                throw NotImmutableErr.make("Coalescing coalesce func not immutable: " + c).val;
            }

            make_(self, pool, r);
            self.m_queue = new CoalescingQueue(k, c);
        }
Exemplo n.º 6
0
        public static void make_(ActorPool self, Func itBlock)
        {
            if (itBlock != null)
            {
                itBlock.enterCtor(self);
                itBlock.call(self);
                itBlock.exitCtor();
            }
            if (self.m_maxThreads < 1)
            {
                throw ArgErr.make("ActorPool.maxThreads must be >= 1, not " + self.m_maxThreads).val;
            }

            self.m_threadPool = new ThreadPool((int)self.m_maxThreads);
            self.m_scheduler  = new Scheduler();
        }
Exemplo n.º 7
0
        public static void make_(Actor self, ActorPool pool, Func receive)
        {
            // check pool
            if (pool == null)
            {
                throw NullErr.make("pool is null").val;
            }

            // check receive method
            if (receive == null && self.@typeof().qname() == "concurrent::Actor")
            {
                throw ArgErr.make("must supply receive func or subclass Actor").val;
            }
            if (receive != null && !receive.isImmutable())
            {
                throw NotImmutableErr.make("Receive func not immutable: " + receive).val;
            }

            // init
            self.m_pool    = pool;
            self.m_receive = receive;
            self.m_queue   = new Queue();
        }
Exemplo n.º 8
0
 public static ActorPool make(Func itBlock)
 {
     ActorPool self = new ActorPool();
       make_(self, itBlock);
       return self;
 }
Exemplo n.º 9
0
 public static void makeCoalescing_(Actor self, ActorPool pool, Func k, Func c)
 {
     makeCoalescing_(self, pool, k, c, null);
 }
Exemplo n.º 10
0
 public static Actor makeCoalescing(ActorPool pool, Func k, Func c)
 {
     return(makeCoalescing(pool, k, c, null));
 }
Exemplo n.º 11
0
Arquivo: Actor.cs Projeto: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public static Actor make(ActorPool pool)
 {
     return make(pool, null);
 }
Exemplo n.º 12
0
 public static void make_(ActorPool self)
 {
     make_(self, null);
 }
Exemplo n.º 13
0
Arquivo: Actor.cs Projeto: nomit007/f4
 public static void make_(Actor self, ActorPool pool)
 {
     make_(self, pool, null);
 }
Exemplo n.º 14
0
Arquivo: Actor.cs Projeto: nomit007/f4
 public static void makeCoalescing_(Actor self, ActorPool pool, Func k, Func c)
 {
     makeCoalescing_(self, pool, k, c, null);
 }
Exemplo n.º 15
0
Arquivo: Actor.cs Projeto: nomit007/f4
        public static void makeCoalescing_(Actor self, ActorPool pool, Func k, Func c, Func r)
        {
            if (k != null && !k.isImmutable())
            throw NotImmutableErr.make("Coalescing toKey func not immutable: " + k).val;

              if (c != null && !c.isImmutable())
            throw NotImmutableErr.make("Coalescing coalesce func not immutable: " + c).val;

              make_(self, pool, r);
              self.m_queue = new CoalescingQueue(k, c);
        }
Exemplo n.º 16
0
Arquivo: Actor.cs Projeto: nomit007/f4
 public static Actor makeCoalescing(ActorPool pool, Func k, Func c, Func r)
 {
     Actor self = new Actor();
       makeCoalescing_(self, pool, k, c, r);
       return self;
 }
Exemplo n.º 17
0
Arquivo: Actor.cs Projeto: nomit007/f4
 public static Actor makeCoalescing(ActorPool pool, Func k, Func c)
 {
     return makeCoalescing(pool, k, c, null);
 }
Exemplo n.º 18
0
Arquivo: Actor.cs Projeto: nomit007/f4
 public static Actor make(ActorPool pool, Func receive)
 {
     Actor self = new Actor();
       make_(self, pool, receive);
       return self;
 }
Exemplo n.º 19
0
 public static void make_(ActorPool self)
 {
     make_(self, null);
 }
Exemplo n.º 20
0
 public static void make_(Actor self, ActorPool pool)
 {
     make_(self, pool, null);
 }
Exemplo n.º 21
0
        //////////////////////////////////////////////////////////////////////////
        // Construction
        //////////////////////////////////////////////////////////////////////////

        public static Actor make(ActorPool pool)
        {
            return(make(pool, null));
        }
Exemplo n.º 22
0
Arquivo: Actor.cs Projeto: nomit007/f4
        public static void make_(Actor self, ActorPool pool, Func receive)
        {
            // check pool
              if (pool == null)
            throw NullErr.make("pool is null").val;

              // check receive method
              if (receive == null && self.@typeof().qname() == "concurrent::Actor")
            throw ArgErr.make("must supply receive func or subclass Actor").val;
              if (receive != null && !receive.isImmutable())
            throw NotImmutableErr.make("Receive func not immutable: " + receive).val;

              // init
              self.m_pool = pool;
              self.m_receive = receive;
              self.m_queue = new Queue();
        }