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


C# View.getMembers方法代码示例

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


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

示例1: handleViewChange

 /// <summary>
 /// Installs a new view within the process
 /// </summary>
 /// <param name="new_view">The new view to be installed</param>
 /// <param name="digest">The digest associated with the new view</param>
 public override void handleViewChange(View new_view, Digest digest)
 {
     ArrayList mbrs = new_view.getMembers();
     if (Trace.trace)
     {
         if (digest != null)
             Trace.info(
                 "CoordGmsImpl.handleViewChange()",
                 "view=" + new_view + ", digest=" + digest);
         else
             Trace.info(
                 "CoordGmsImpl.handleViewChange()",
                 "view=" + new_view);
     }
     if (leaving && !mbrs.Contains(gms.local_addr))
     {
         return;
     }
     gms.installView(new_view, digest);
 }
开发者ID:curasystems,项目名称:externals,代码行数:25,代码来源:CoordGmsImpl.cs

示例2: installView

        /// <summary>
        /// Sets the new view and sends a VIEW_CHANGE event up and down the stack.
        /// </summary>
        /// <param name="new_view">New View to install</param>
        public void installView(View new_view)
        {
            Address coord;
            int     rc;
            ViewId  vid=new_view.getVid();
            ArrayList  mbrs=new_view.getMembers();

            lock(members)
            {                  // serialize access to views
                ltime=Math.Max(vid.getId(), ltime);  // compute Lamport logical time

                /* Check for self-inclusion: if I'm not part of the new membership, I just discard it.
                       This ensures that messages sent in view V1 are only received by members of V1 */
                if(Trace.trace)
                    Trace.info("GMS.installView()","View to install contains: " + new_view.ToString());
                if(checkSelfInclusion(mbrs) == false)
                {
                    if(Trace.trace)
                        Trace.warn("GMS.installView()",
                            "checkSelfInclusion() failed, not a member of view " + mbrs + "; discarding view");
                    if(shun)
                    {
                        if(Trace.trace)
                            Trace.warn("GMS.installView()", "I'm being shunned, will leave and rejoin group");
                        passUp(new Event(Event.EXIT));
                    }
                    return;
                }

                // Discards view with id lower than our own. Will be installed without check if first view
                if(view_id != null)
                {
                    rc = vid.CompareTo(view_id);
                    if(rc <= 0)
                    {
                        if(Trace.trace)
                            Trace.error("GMS.installView()", "received view <= current view;" +
                                " discarding it ! (current vid: " + view_id + ", new vid: " + vid +")");
                        return;
                    }
                }

                if(Trace.trace) Trace.info("GMS.installView()", "view is " + new_view);

                // assign new_view to view_id
                view_id=vid.Copy();

                // Set the membership. Take into account joining members
                if(mbrs != null && mbrs.Count > 0)
                {
                    members.set(mbrs);
                    tmp_members.set(members);
                    foreach(Object obj in mbrs)
                    {
                        joining.Remove(obj); // remove all members in mbrs from joining
                    }
                    tmp_members.add(joining); // adjust temporary membership
                }

                // Send VIEW_CHANGE event up and down the stack:
                Event view_event=new Event(Event.VIEW_CHANGE, (View)new_view.copy());
                passDown(view_event); // needed e.g. by failure detector or UDP
                passUp(view_event);

                coord=determineCoordinator();
                if(coord != null && coord.Equals(local_addr) && !(coord.Equals(vid.getCoordAddress())))
                {
                    becomeCoordinator();
                }
                else
                {
                    if(haveCoordinatorRole() && !local_addr.Equals(coord))
                        becomeParticipant();
                }
            }
        }
开发者ID:curasystems,项目名称:externals,代码行数:80,代码来源:GMS.cs

示例3: handleViewChange

 /// <summary>
 /// All views are ignored while GMS is a client
 /// </summary>
 /// <param name="new_view">Ignored</param>
 /// <param name="digest">Ignored</param>
 public override void handleViewChange(View new_view, Digest digest)
 {
     if(Trace.trace)
             Trace.info("ClientGmsImpl.handleViewChange()", "view " + new_view.getMembers() +
                 " is discarded as we are not a participant");
 }
开发者ID:curasystems,项目名称:externals,代码行数:11,代码来源:ClientGmsImpl.cs

示例4: installView

 /* --------------------------- Private Methods ------------------------------------ */
 /// <remarks>
 /// A value of false will be returned if the new view doesn't contain the 
 /// this member.
 /// </remarks>
 /// <summary>
 /// Installs the new view returned from GMS Coord.
 /// </summary>
 /// <param name="new_view">The new <code>View</code> to install</param>
 /// <returns>True if successful, otherwise false.</returns>
 private bool installView(View new_view)
 {
     ArrayList mems=new_view.getMembers();
     if(Trace.trace) Trace.info("ClientGmsImpl.installView()", "new_view=" + new_view);
     if(gms.local_addr == null || mems == null || !mems.Contains(gms.local_addr))
     {
         Trace.error("ClientGmsImpl.installView()", "I (" + gms.local_addr +
             ") am not member of " + mems + ", will not install view");
         return false;
     }
     gms.installView(new_view);
     gms.becomeParticipant();
     gms.passUp(new Event(Event.BECOME_SERVER));
     gms.passDown(new Event(Event.BECOME_SERVER));
     return true;
 }
开发者ID:curasystems,项目名称:externals,代码行数:26,代码来源:ClientGmsImpl.cs

示例5: handleViewChange

 /// <remarks>
 /// If we are leaving, we have to wait for the view change (last msg in the current view) that
 /// excludes us before we can leave.
 /// </remarks>
 /// <summary>
 /// Installs a new view
 /// </summary>
 /// <param name="new_view">New View to install</param>
 /// <param name="digest">Digest associated with the view</param>
 public override void handleViewChange(View new_view, Digest digest)
 {
     ArrayList mbrs=new_view.getMembers();
     if(Trace.trace)
         Trace.info("ParticipantGmsImpl.handleViewChange()", "view=" + new_view);
     suspected_mbrs.Clear();
     if(leaving && !mbrs.Contains(gms.local_addr))
     {
         // received a view in which I'm not member: ignore
         return;
     }
     gms.installView(new_view, digest);
 }
开发者ID:curasystems,项目名称:externals,代码行数:22,代码来源:ParticipantGmsImpl.cs


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