org.jgroups.protocols.pbcast
Class Merger

java.lang.Object
  extended by org.jgroups.protocols.pbcast.Merger

public class Merger
extends java.lang.Object

Handles merging. Called by CoordGmsImpl and ParticipantGmsImpl

Author:
Bela Ban

Field Summary
protected  BoundedList<MergeId> merge_id_history
           
 
Constructor Summary
Merger(GMS gms)
           
 
Method Summary
protected  void _handleMergeRequest(Address sender, MergeId merge_id, java.util.Collection<? extends Address> mbrs)
           
 MergeId getMergeId()
          Only used for testing, might get removed any time.
 java.lang.String getMergeIdAsString()
           
 java.lang.String getMergeIdHistory()
           
 void handleDigestResponse(Address sender, Digest digest)
           
 void handleMergeCancelled(MergeId merge_id)
           
 void handleMergeRequest(Address sender, MergeId merge_id, java.util.Collection<? extends Address> mbrs)
          Get the view and digest and send back both (MergeData) in the form of a MERGE_RSP to the sender.
 void handleMergeResponse(MergeData data, MergeId merge_id)
           
 void handleMergeView(MergeData data, MergeId merge_id)
          If merge_id is not equal to this.merge_id then discard.
 boolean isMergeInProgress()
           
 boolean matchMergeId(MergeId id)
           
 void merge(java.util.Map<Address,View> views)
          Invoked upon receiving a MERGE event from the MERGE layer.
static void sanitizeViews(java.util.Map<Address,View> map)
          Removes all members from a given view which don't have us in their view (https://jira.jboss.org/browse/JGRP-1061).
protected  void sendMergeRejectedResponse(Address sender, MergeId merge_id)
           
 boolean setMergeId(MergeId expected, MergeId new_value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

merge_id_history

protected final BoundedList<MergeId> merge_id_history
Constructor Detail

Merger

public Merger(GMS gms)
Method Detail

getMergeIdAsString

public java.lang.String getMergeIdAsString()

getMergeIdHistory

public java.lang.String getMergeIdHistory()

merge

public void merge(java.util.Map<Address,View> views)
Invoked upon receiving a MERGE event from the MERGE layer. Starts the merge protocol. See description of protocol in DESIGN.

Parameters:
views - A List of different views detected by the merge protocol

handleMergeRequest

public void handleMergeRequest(Address sender,
                               MergeId merge_id,
                               java.util.Collection<? extends Address> mbrs)
Get the view and digest and send back both (MergeData) in the form of a MERGE_RSP to the sender. If a merge is already in progress, send back a MergeData with the merge_rejected field set to true.

Parameters:
sender - The address of the merge leader
merge_id - The merge ID
mbrs - The set of members from which we expect responses

_handleMergeRequest

protected void _handleMergeRequest(Address sender,
                                   MergeId merge_id,
                                   java.util.Collection<? extends Address> mbrs)
                            throws java.lang.Exception
Throws:
java.lang.Exception

handleMergeResponse

public void handleMergeResponse(MergeData data,
                                MergeId merge_id)

handleMergeView

public void handleMergeView(MergeData data,
                            MergeId merge_id)
If merge_id is not equal to this.merge_id then discard. Else cast the view/digest to all members of this group.


handleMergeCancelled

public void handleMergeCancelled(MergeId merge_id)

handleDigestResponse

public void handleDigestResponse(Address sender,
                                 Digest digest)

sanitizeViews

public static void sanitizeViews(java.util.Map<Address,View> map)
Removes all members from a given view which don't have us in their view (https://jira.jboss.org/browse/JGRP-1061). Example:
 A: AB
 B: AB
 C: ABC
 
becomes
 A: AB
 B: AB
 C: C // A and B don't have C in their views
 

Parameters:
map - A map of members and their associated views

sendMergeRejectedResponse

protected void sendMergeRejectedResponse(Address sender,
                                         MergeId merge_id)

setMergeId

public boolean setMergeId(MergeId expected,
                          MergeId new_value)

getMergeId

public MergeId getMergeId()
Only used for testing, might get removed any time. Do not use !


isMergeInProgress

public boolean isMergeInProgress()

matchMergeId

public boolean matchMergeId(MergeId id)


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.