Esempio n. 1
0
        // own actor.
        // update the actor
        // and watch operations on the actor
        private void ActorEnter(Region region, long id, Dictionary <int, ByteString> properties)
        {
            /* this lock is not necessary */            //lock( _region_actor )
            {
                // find actor
                // if actor is found, update its properties and replace the dest region.
                // because before sending the message, the same actor may change region several times,
                // the latest dest region will be the true that the actor truely enters.
                ActorUtils.RegionActorPair rap = null;
                if (_region_actor.TryGetValue(id, out rap))
                {
                    // copy properties
                    ActorUtils.CopyProperties(properties, rap.actor.Ptypes, rap.actor.Pdatas);

                    // set new dest
                    // replace the region was set
                    rap.dest = region;
                }
                // else insert the actor.
                else
                {
                    rap       = new ActorUtils.RegionActorPair();
                    rap.actor = ActorUtils.CreateActor(id, properties);
                    rap.dest  = region;

                    _region_actor.Add(id, rap);
                }
            }
        }
Esempio n. 2
0
 // update properties
 public void ActorUpdate(Region region, long id, Dictionary <int, ByteString> properties)
 {
     /* this lock is not necessary */            //lock( _message )
     {
         Actor a = ActorUtils.FindActor(id, _message.UpdateActors);
         if (null == a)
         {
             a = ActorUtils.CreateActor(id, properties);
             _message.UpdateActors.Add(a);
         }
         else
         {
             ActorUtils.CopyProperties(properties, a.Ptypes, a.Pdatas);
         }
     }
 }