Пример #1
0
 private boolean matchMergeId(MergeId id) {
   merge_lock.lock();
   try {
     return Util.match(this.merge_id, id);
   } finally {
     merge_lock.unlock();
   }
 }
Пример #2
0
 private boolean setMergeId(MergeId expected, MergeId new_value) {
   merge_lock.lock();
   try {
     boolean match = Util.match(this.merge_id, expected);
     if (match) {
       this.merge_id = new_value;
       stopMergeCanceller();
       if (this.merge_id != null) startMergeCanceller();
     }
     return match;
   } finally {
     merge_lock.unlock();
   }
 }
Пример #3
0
  public static void testMatch() {
    long[] a = {1, 2, 3};
    long[] b = {2, 3, 4};
    long[] c = null;
    long[] d = {1, 2, 3, 4};
    long[] e = {1, 2, 3};

    assert Util.match(a, a);
    assert !(Util.match(a, b));
    assert !(Util.match(a, c));
    assert !(Util.match(a, d));
    assert Util.match(a, e);
    assert Util.match(c, c);
    assert !(Util.match(c, a));
  }
Пример #4
0
 public boolean setMergeId(MergeId expected, MergeId new_value) {
   merge_lock.lock();
   try {
     boolean match = Util.match(this.merge_id, expected);
     if (match) {
       if (new_value != null && merge_id_history.contains(new_value)) return false;
       else merge_id_history.add(new_value);
       this.merge_id = new_value;
       if (this.merge_id != null) {
         // Clears the view handler queue and discards all JOIN/LEAVE/MERGE requests until after
         // the MERGE
         gms.getViewHandler().suspend();
         gms.getDownProtocol().down(new Event(Event.SUSPEND_STABLE, 20000));
         startMergeKiller();
       }
     }
     return match;
   } finally {
     merge_lock.unlock();
   }
 }