当前位置: 首页>>代码示例>>C#>>正文


C# ActivationId类代码示例

本文整理汇总了C#中ActivationId的典型用法代码示例。如果您正苦于以下问题:C# ActivationId类的具体用法?C# ActivationId怎么用?C# ActivationId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ActivationId类属于命名空间,在下文中一共展示了ActivationId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAddress

        public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status = MultiClusterStatus.Owned)
        {
            // Silo part is not mandatory
            if (grain == null) throw new ArgumentNullException("grain");

            return new ActivationAddress(silo, grain, activation, status);
        }
开发者ID:PaulNorth,项目名称:orleans,代码行数:7,代码来源:ActivationAddress.cs

示例2: GetAddress

        public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation)
        {
            // Silo part is not mandatory
            if (grain == null) throw new ArgumentNullException("grain");

            return new ActivationAddress(silo, grain, activation);
        }
开发者ID:osjimenez,项目名称:orleans,代码行数:7,代码来源:ActivationAddress.cs

示例3: ActivationAddress

 private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status)
 {
     Silo = silo;
     Grain = grain;
     Activation = activation;
     Status = status;
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:7,代码来源:ActivationAddress.cs

示例4: AddSingleActivation

 public ActivationAddress AddSingleActivation(GrainId grain, ActivationId act, SiloAddress silo)
 {
     SingleInstance = true;
     if (Instances.Count > 0)
     {
         var item = Instances.First();
         return ActivationAddress.GetAddress(item.Value.SiloAddress, grain, item.Key);
     }
     else
     {
         Instances.Add(act, new ActivationInfo(silo));
         VersionTag = rand.Next();
         return ActivationAddress.GetAddress(silo, grain, act);
     }
 }
开发者ID:sbambach,项目名称:orleans,代码行数:15,代码来源:GrainDirectoryPartition.cs

示例5: AddSingleActivation

 public ActivationAddress AddSingleActivation(GrainId grain, ActivationId act, SiloAddress silo, MultiClusterStatus registrationStatus = MultiClusterStatus.Owned)
 {
     SingleInstance = true;
     if (Instances.Count > 0)
     {
         var item = Instances.First();
         return ActivationAddress.GetAddress(item.Value.SiloAddress, grain, item.Key);
     }
     else
     {
         Instances.Add(act, new ActivationInfo(silo, registrationStatus));
         VersionTag = rand.Next();
         return ActivationAddress.GetAddress(silo, grain, act, registrationStatus);
     }
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:15,代码来源:GrainDirectoryPartition.cs

示例6: AddActivation

 public bool AddActivation(ActivationId act, SiloAddress silo)
 {
     if (SingleInstance && (Instances.Count > 0) && !Instances.ContainsKey(act))
     {
         throw new InvalidOperationException(
             "Attempting to add a second activation to an existing grain in single activation mode");
     }
     IActivationInfo info;
     if (Instances.TryGetValue(act, out info))
     {
         if (info.SiloAddress.Equals(silo))
         {
             // just refresh, no need to generate new VersionTag
             return false;
         }
     }
     Instances[act] = new ActivationInfo(silo);
     VersionTag = rand.Next();
     return true;
 }
开发者ID:sbambach,项目名称:orleans,代码行数:20,代码来源:GrainDirectoryPartition.cs

示例7: CacheOrUpdateRemoteClusterRegistration

        public void CacheOrUpdateRemoteClusterRegistration(GrainId grain, ActivationId oldActivation, ActivationAddress otherClusterAddress)
        {
            lock (lockable)
            {
                if (partitionData.ContainsKey(grain))
                {
                    partitionData[grain].CacheOrUpdateRemoteClusterRegistration(grain, oldActivation,
                        otherClusterAddress.Activation, otherClusterAddress.Silo);

                }
                else
                {
                    AddSingleActivation(grain, otherClusterAddress.Activation, otherClusterAddress.Silo,
                        GrainDirectoryEntryStatus.Cached);
                }
            }
        }
开发者ID:vobradovich,项目名称:orleans,代码行数:17,代码来源:GrainDirectoryPartition.cs

示例8: DeactivateOnIdle

        public void DeactivateOnIdle(ActivationId id)
        {
            ActivationData data;
            if (!Catalog.TryGetActivationData(id, out data)) return; // already gone

            data.ResetKeepAliveRequest(); // DeactivateOnIdle method would undo / override any current “keep alive” setting, making this grain immideately avaliable for deactivation.
            Catalog.DeactivateActivationOnIdle(data);
        }
开发者ID:PaulNorth,项目名称:orleans,代码行数:8,代码来源:InsideRuntimeClient.cs

示例9: RemoveActivation

 /// <summary>
 /// Removes an activation of the given grain from the partition
 /// </summary>
 /// <param name="grain"></param>
 /// <param name="activation"></param>
 /// <param name="force"></param>
 internal void RemoveActivation(GrainId grain, ActivationId activation, bool force)
 {
     lock (lockable)
     {
         if (partitionData.ContainsKey(grain) && partitionData[grain].RemoveActivation(activation, force))
         {
             partitionData.Remove(grain);
         }
     }
     if (log.IsVerbose3) log.Verbose3("Removing activation for grain {0}", grain.ToString());
 }
开发者ID:sbambach,项目名称:orleans,代码行数:17,代码来源:GrainDirectoryPartition.cs

示例10: IsReentrantGrain

 internal bool IsReentrantGrain(ActivationId running)
 {
     ActivationData target;
     GrainTypeData data;
     return TryGetActivationData(running, out target) &&
         target.GrainInstance != null &&
         GrainTypeManager.TryGetData(TypeUtils.GetFullName(target.GrainInstanceType), out data) &&
         data.IsReentrant;
 }
开发者ID:kucheruk,项目名称:orleans,代码行数:9,代码来源:Catalog.cs

示例11: CanInterleave

 internal bool CanInterleave(ActivationId running, Message message)
 {
     ActivationData target;
     GrainTypeData data;
     return TryGetActivationData(running, out target) &&
         target.GrainInstance != null &&
         GrainTypeManager.TryGetData(TypeUtils.GetFullName(target.GrainInstanceType), out data) &&
         (data.IsReentrant || data.MayInterleave((InvokeMethodRequest)message.BodyObject));
 }
开发者ID:Carlm-MS,项目名称:orleans,代码行数:9,代码来源:Catalog.cs

示例12: LookUpActivations

        /// <summary>
        /// Returns a list of activations (along with the version number of the list) for the given grain.
        /// If the grain is not found, null is returned.
        /// </summary>
        /// <param name="grain"></param>
        /// <returns></returns>
        internal AddressesAndTag LookUpActivations(GrainId grain)
        {
            var result = new AddressesAndTag();
            ActivationId[] activationIds;
            IActivationInfo[] activationInfos;
            const int arrayReusingThreshold = 100;
            int grainInfoInstancesCount;

            lock (lockable)
            {
                IGrainInfo graininfo;
                if (!partitionData.TryGetValue(grain, out graininfo))
                {
                    return result;
                }

                result.VersionTag = graininfo.VersionTag;

                grainInfoInstancesCount = graininfo.Instances.Count;
                if (grainInfoInstancesCount < arrayReusingThreshold)
                {
                    if ((activationIds = activationIdsHolder) == null)
                    {
                        activationIdsHolder = activationIds = new ActivationId[arrayReusingThreshold];
                    }

                    if ((activationInfos = activationInfosHolder) == null)
                    {
                        activationInfosHolder = activationInfos = new IActivationInfo[arrayReusingThreshold];
                    }
                }
                else
                {
                    activationIds = new ActivationId[grainInfoInstancesCount];
                    activationInfos = new IActivationInfo[grainInfoInstancesCount];
                }


                graininfo.Instances.Keys.CopyTo(activationIds, 0);
                graininfo.Instances.Values.CopyTo(activationInfos, 0);
            }

            result.Addresses = new List<ActivationAddress>(grainInfoInstancesCount);
            for (var i = 0; i < grainInfoInstancesCount; i++)
            {
                var activationInfo = activationInfos[i];
                if (IsValidSilo(activationInfo.SiloAddress))
                {
                    result.Addresses.Add(ActivationAddress.GetAddress(activationInfo.SiloAddress, grain, activationIds[i]));
                }

                activationInfos[i] = null;
                activationIds[i] = null;
            }

            return result;
        }
开发者ID:osjimenez,项目名称:orleans,代码行数:63,代码来源:GrainDirectoryPartition.cs

示例13: AddActivation

        /// <summary>
        /// Adds a new activation to the directory partition
        /// </summary>
        /// <param name="grain"></param>
        /// <param name="activation"></param>
        /// <param name="silo"></param>
        /// <returns>The version associated with this directory mapping</returns>
        internal virtual int AddActivation(GrainId grain, ActivationId activation, SiloAddress silo)
        {
            if (!IsValidSilo(silo))
            {
                return GrainInfo.NO_ETAG;
            }

            IGrainInfo grainInfo;
            lock (lockable)
            {
                if (!partitionData.TryGetValue(grain, out grainInfo))
                {
                    partitionData[grain] = grainInfo = new GrainInfo();
                }

                grainInfo.AddActivation(activation, silo);
            }

            if (log.IsVerbose3) log.Verbose3("Adding activation for grain {0}", grain.ToString());
            return grainInfo.VersionTag;
        }
开发者ID:osjimenez,项目名称:orleans,代码行数:28,代码来源:GrainDirectoryPartition.cs

示例14: UpdateClusterRegistrationStatus

 public bool UpdateClusterRegistrationStatus(GrainId grain, ActivationId activationId, MultiClusterStatus registrationStatus, MultiClusterStatus? compareWith = null)
 {
     lock (lockable)
     {
         if (partitionData.ContainsKey(grain))
         {
             return partitionData[grain].UpdateClusterRegistrationStatus(activationId, registrationStatus, compareWith);
         }
         return false;
     }
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:11,代码来源:GrainDirectoryPartition.cs

示例15: UpdateClusterRegistrationStatus

 public bool UpdateClusterRegistrationStatus(GrainId grain, ActivationId activationId, GrainDirectoryEntryStatus registrationStatus, GrainDirectoryEntryStatus? compareWith = null)
 {
     lock (lockable)
     {
         IGrainInfo graininfo;
         if (partitionData.TryGetValue(grain, out graininfo))
         {
             return graininfo.UpdateClusterRegistrationStatus(activationId, registrationStatus, compareWith);
         }
         return false;
     }
 }
开发者ID:vobradovich,项目名称:orleans,代码行数:12,代码来源:GrainDirectoryPartition.cs


注:本文中的ActivationId类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。