Exemplo n.º 1
0
  /**
   * Invoked upon receiving a MERGE event from the MERGE layer. Starts the merge protocol. See
   * description of protocol in DESIGN.
   *
   * @param views A List of <em>different</em> views detected by the merge protocol
   */
  public void merge(Map<Address, View> views) {
    if (isMergeInProgress()) {
      if (log.isTraceEnabled())
        log.trace(gms.local_addr + ": merge is already running (merge_id=" + merge_id + ")");
      return;
    }

    // we need the merge *coordinators* not merge participants because not everyone can lead a merge
    // !
    Collection<Address> coords = Util.determineMergeCoords(views);
    Collection<Address> merge_participants = Util.determineMergeParticipants(views);
    Membership tmp =
        new Membership(coords); // establish a deterministic order, so that coords can elect leader
    tmp.sort();
    Address merge_leader = tmp.elementAt(0);
    if (log.isDebugEnabled()) log.debug("determining merge leader from " + merge_participants);
    if (merge_leader.equals(gms.local_addr)) {
      if (log.isDebugEnabled())
        log.debug(
            "I ("
                + gms.local_addr
                + ") will be the leader. Starting the merge task for "
                + merge_participants);
      merge_task.start(views);
    } else {
      if (log.isDebugEnabled())
        log.debug(
            "I ("
                + gms.local_addr
                + ") am not the merge leader, "
                + "waiting for merge leader ("
                + merge_leader
                + ") to initiate merge");
    }
  }
Exemplo n.º 2
0
 void cancelMerge(MergeId id) {
   if (setMergeId(id, null)) {
     merge_task.stop();
     merge_rsps.reset();
     gms.getViewHandler().resume(id);
   }
 }
Exemplo n.º 3
0
 void cancelMerge(MergeId id) {
   if (setMergeId(id, null)) {
     merge_task.stop();
     stopMergeKiller();
     merge_rsps.reset();
     gms.getViewHandler().resume();
     gms.getDownProtocol().down(new Event(Event.RESUME_STABLE));
   }
 }
Exemplo n.º 4
0
 void stop() {
   merge_task.stop();
 }
Exemplo n.º 5
0
 boolean isMergeTaskRunning() {
   return merge_task.isRunning();
 }