本文整理汇总了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);
}
示例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();
}
}
}
示例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");
}
示例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;
}
示例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);
}