org.jgroups.protocols.pbcast

## Class Merger

- java.lang.Object
- - org.jgroups.protocols.pbcast.Merger

-     public class Merger
      extends java.lang.Object

  Handles merging. Called by CoordGmsImpl and ParticipantGmsImpl
  Author:
    Bela Ban

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Merger(GMS gms, Log log)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MergeId` | `getMergeId()` Only used for testing, might get removed any time.
    `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.
    `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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Merger

          public Merger(GMS gms,
                Log log)

  - ### Method Detail

    - #### 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

    - #### 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)

    - #### getMergeId

          public MergeId getMergeId()

      Only used for testing, might get removed any time. Do not use !

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