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


C# SiloAddress.Equals方法代码示例

本文整理汇总了C#中SiloAddress.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# SiloAddress.Equals方法的具体用法?C# SiloAddress.Equals怎么用?C# SiloAddress.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SiloAddress的用法示例。


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

示例1: TryGetSiloName

 internal bool TryGetSiloName(SiloAddress siloAddress, out string siloName)
 {
     if (siloAddress.Equals(MyAddress))
     {
         siloName = SiloName;
         return true;
     }
     return localNamesTableCopy.TryGetValue(siloAddress, out siloName);
 }
开发者ID:sbambach,项目名称:orleans,代码行数:9,代码来源:MembershipOracleData.cs

示例2: GetApproximateSiloStatus

 // ONLY access localTableCopy and not the localTable, to prevent races, as this method may be called outside the turn.
 internal SiloStatus GetApproximateSiloStatus(SiloAddress siloAddress)
 {
     var status = SiloStatus.None;
     if (siloAddress.Equals(MyAddress))
     {
         status = CurrentStatus;
     }
     else
     {
         if (!localTableCopy.TryGetValue(siloAddress, out status))
         {
             if (CurrentStatus.Equals(SiloStatus.Active))
                 if (logger.IsVerbose) logger.Verbose(ErrorCode.Runtime_Error_100209, "-The given siloAddress {0} is not registered in this MembershipOracle.", siloAddress.ToLongString());
             status = SiloStatus.None;
         }
     }
     if (logger.IsVerbose3) logger.Verbose3("-GetApproximateSiloStatus returned {0} for silo: {1}", status, siloAddress.ToLongString());
     return status;
 }
开发者ID:sbambach,项目名称:orleans,代码行数:20,代码来源:MembershipOracleData.cs

示例3: SiloStatusChangeNotification

 public void SiloStatusChangeNotification(SiloAddress updatedSilo, SiloStatus status)
 {
     // This silo's status has changed
     if (updatedSilo.Equals(myAddress))
     {
         if (status.IsTerminating())
         {
             Stop();
         }
     }
     else // Status change for some other silo
     {
         if (status.IsTerminating())
         {
             RemoveServer(updatedSilo);
         }
         else if (status.Equals(SiloStatus.Active))      // do not do anything with SiloStatus.Created or SiloStatus.Joining -- wait until it actually becomes active
         {
             AddServer(updatedSilo);
         }
     }
 }
开发者ID:Rejendo,项目名称:orleans,代码行数:22,代码来源:VirtualBucketsRingProvider.cs

示例4: BreakOutstandingMessagesToDeadSilo

 public void BreakOutstandingMessagesToDeadSilo(SiloAddress deadSilo)
 {
     foreach (var callback in callbacks)
     {
         if (deadSilo.Equals(callback.Value.Message.TargetSilo))
         {
             callback.Value.OnTargetSiloFail();
         }
     }
 }
开发者ID:randa1,项目名称:orleans,代码行数:10,代码来源:OutsideRuntimeClient.cs

示例5: PickKey

 private uint PickKey(SiloAddress responsibleSilo)
 {
     int iteration = 10000;
     for (int i = 0; i < iteration; i++)
     {
         double next = random.NextDouble();
         uint randomKey = (uint)((double)RangeFactory.RING_SIZE * next);
         SiloAddress s = Primary.Silo.TestHookup.ConsistentRingProvider.GetPrimaryTargetSilo(randomKey);
         if (responsibleSilo.Equals(s))
             return randomKey;
     }
     throw new Exception(String.Format("Could not pick a key that silo {0} will be responsible for. Primary.Ring = \n{1}",
         responsibleSilo, Primary.Silo.TestHookup.ConsistentRingProvider));
 }
开发者ID:sbambach,项目名称:orleans,代码行数:14,代码来源:ConsistentRingProviderTests_Silo.cs

示例6: SiloStatusChangeNotification

        public void SiloStatusChangeNotification(SiloAddress updatedSilo, SiloStatus status)
        {
            // ignore joining events and also events on myself.
            if (updatedSilo.Equals(LocalSilo)) return;

            // We deactivate those activations when silo goes either of ShuttingDown/Stopping/Dead states,
            // since this is what Directory is doing as well. Directory removes a silo based on all those 3 statuses,
            // thus it will only deliver a "remove" notification for a given silo once to us. Therefore, we need to react the fist time we are notified.
            // We may review the directory behaiviour in the future and treat ShuttingDown differently ("drain only") and then this code will have to change a well.
            if (!status.IsTerminating()) return;

            var activationsToShutdown = new List<ActivationData>();
            try
            {
                // scan all activations in activation directory and deactivate the ones that the removed silo is their primary partition owner.
                lock (activations)
                {
                    foreach (var activation in activations)
                    {
                        try
                        {
                            var activationData = activation.Value;
                            if (!directory.GetPrimaryForGrain(activationData.Grain).Equals(updatedSilo)) continue;

                            lock (activationData)
                            {
                                // adapted from InsideGarinClient.DeactivateOnIdle().
                                activationData.ResetKeepAliveRequest();
                                activationsToShutdown.Add(activationData);
                            }
                        }
                        catch (Exception exc)
                        {
                            logger.Error(ErrorCode.Catalog_SiloStatusChangeNotification_Exception,
                                String.Format("Catalog has thrown an exception while executing SiloStatusChangeNotification of silo {0}.", updatedSilo.ToStringWithHashCode()), exc);
                        }
                    }
                }
                logger.Info(ErrorCode.Catalog_SiloStatusChangeNotification,
                    String.Format("Catalog is deactivating {0} activations due to a failure of silo {1}, since it is a primary directory partiton to these grain ids.",
                        activationsToShutdown.Count, updatedSilo.ToStringWithHashCode()));
            }
            finally
            {
                // outside the lock.
                if (activationsToShutdown.Count > 0)
                {
                    DeactivateActivations(activationsToShutdown).Ignore();
                }
            }
        }
开发者ID:kucheruk,项目名称:orleans,代码行数:51,代码来源:Catalog.cs

示例7: GetSiloStatus

 private SiloStatus GetSiloStatus(SiloAddress siloAddress)
 {
     if (siloAddress.Equals(MyAddress))
         return CurrentStatus;
     
     MembershipEntry data;
     return !localTable.TryGetValue(siloAddress, out data) ? SiloStatus.None : data.Status;
 }
开发者ID:sbambach,项目名称:orleans,代码行数:8,代码来源:MembershipOracleData.cs

示例8: IsSiloNextInTheRing

 private bool IsSiloNextInTheRing(SiloAddress siloAddr, uint hash, bool excludeMySelf)
 {
     return siloAddr.GetConsistentHashCode() >= hash && (!siloAddr.Equals(MyAddress) || !excludeMySelf);
 }
开发者ID:jdom,项目名称:orleans,代码行数:4,代码来源:ConsistentRingProvider.cs


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