geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [10/51] [partial] incubator-geode git commit: GEODE-77 removing the old jgroups subproject
Date Fri, 21 Aug 2015 21:22:34 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/DESIGN
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/DESIGN b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/DESIGN
deleted file mode 100644
index e8b8627..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/DESIGN
+++ /dev/null
@@ -1,478 +0,0 @@
-$Id: DESIGN,v 1.3 2005/07/16 10:21:02 belaban Exp $
-
-			    Design Issues
-			    =============
-
-
-
-Digest returned to client
--------------------------
-
-The digest returned to clients determines the seqnos they have to
-expect from other group members. If, in the absence of a
-retransmission protocol, a client gets back a lower seqno for a member
-P than is actually the case, the client will never make any progress,
-because lower seqnos need to be delivered before those with higher
-values. Therefore the client would hang (again, in the absence of
-retransmission).
-
-The problem at hand is in the coordinator, when a new member joins:
-the coordinator returns its own digest, which contains the highest
-seqnos from all current members (including itself) seen so far. It
-also includes the new member, with a seqno of 0 (starting
-seqno). Let's assume the coordinator has a seqno of 35. Now, the new
-view is mcast before the call (HandleJoin) returns to the client
-(containing the digest). The client therefore gets a wrong seqno for
-the coordinator. The 2 scenarios are described below:
-
-A: The coordinator gets its digest and then mcasts the view. The seqno
-for the coordinator in the digest returned to the client would
-therefore be 35. The client will expect the next message from the
-coordinator to be a message labeled with seqno=35. However, the
-coordinator mcasts the new view, therefore incrementing its seqno to
-36. The client discards this mcast, because it is not yet operational
-(it is only operational after setting the digest returned from the
-coordinator). Therefore the client will have a missing seqno=35 when
-it received seqno=36 or higher, which will cause it not to deliver any
-message higher than 35 until 35 is finally received. In the absence
-of retransmission, this would effectively hang the client.
-
-
-B: The coordinator mcasts the new view and then gets the digest. Here,
-the hope is that the mcast is sent *and* received before the
-GET_DIGEST event returns. Currently this is the case. However, in slow
-machine, the GET_DIGEST might actually return before the view mcast is
-received, giving us a seqno=35 again, compared to seqno=36 in the
-former case.
-
-
-Since the latter case is highly timing-dependent, we chose to adopt
-case #1. The kludge in case #1 is that, in order to avoid the client
-getting a lower seqno, we actually have to increment the coordinator's
-seqno by 1 in the digest returned to the client. This is done towards
-the end of the client's Join() method.
-
-
-'Highest delivered' vs. 'highest deliverable'
----------------------------------------------
-
-Currently, we always return the highest delivered message seqno from
-NakReceiverWindow rather than the highest deliverable seqno. This
-would leade to discrepancies if for example a consumer did not consume
-messages, or did not consume them fast enough. However, in PBCAST, the
-HandleUpMessage() ensures that, as soon as it adds a message, it tried
-to remove as many as possible. Therefore, deliverable messages are
-always consumed, making highest deliverable == highest delivered.
-
-
-Local messages
---------------
-
-Assumption is that messages sent to self or mcast to the group are
-always received by self. If this is not the case, the PBCAST layer
-would have to store not only received messages, but also sent ones.
-(This is currently not the case, would be an easy change).
-
-
-Garbage collection lag-behind
------------------------------
-
-When a gossip is received by a member, the member asks for
-retransmission of yet unseen messages (if necessary) and removes
-itself from the not-seen list of the gossip. Then it re-broadcasts the
-gossip (if not yet re-broadcast previously). 
-
-When the member removes itself from the not-seen list, and the list is
-subsequently empty, this means that the gossip has been seen by all
-the members. Therefore, all messages lower than the ones in the
-gossip's message digest can be discarded.
-
-However, as the removal from the not-seen list only signals gossip
-reception, but not actual reception of the requested missing messages,
-we cannot really be sure that those messages have really been
-received.
-
-Therefore, the strategy adopted here is to introduce some 'lag', which
-is the number of messages that we should wait before really
-garbage-collecting messages in the digest. This number is subtracted
-from the digest's highest seqnos, so if for example the received
-digest is [P:25, Q:3, R:100] and the lag is 10, then we would
-garbage-collect messages lower than P:15, R:90 and none of Q's
-messages.
-
-The lag value can be set differently for different protocol stacks,
-therefore we could determine a number of members that are
-"late-join-handlers" (see Birman et al). Those members would have a
-high lag values, to make sure that at least some of the group members
-have almost all of the messages ready, e.g. for new joiners who want
-to catch up. As a matter of fact the late-join-handlers may choose to
-store their message digests in stable storage, e.g. a database.
-
-
-GET_DIGEST vs. GET_DIGEST_STATE event
--------------------------------------
-
-The latter is used by the STATE_TRANSFER layer to fetch the digest
-from the PBCAST layer. However, as GMS (below STATE_TRANSFER) also
-uses the GET_DIGEST family of events, there would be
-interference. E.g. when STATE_TRANSFER sends down a GET_DIGEST event
-and waits for the GET_DIGEST_OK event, it will never receive it
-because GMS catches and handles it, and does not pass it up, although
-it was not destined for GMS, but for STATE_TRANSFER. This is the
-reason why there is yet another event GET_DIGEST_STATE. Clearly a
-kludge, the better solution would be to tag an event with its sending
-protocol, have the receiver construct a response event from it, and
-have every receiver of the response discriminate according to its own
-identity. Similar scheme as the one used for sending messages.
-
-
-
-Handling of received gossips (PBCAST.handleGossip() method)
------------------------------------------------------------
-
-First make sure that the sender of the gossip is not null. If it was
-null, we wouldn't be able to ask it for retransmission of missing
-messages. We check for this right at the beginning of the method, so
-we can return immediately and don't have to do all the processing if
-the sender is null.
-
-Then a check is made whether the sender really is a member. If it is
-not, we return as well. There are 2 cases when this can happen: (a)
-when a member left the group and (b) when a new member joined, but the
-membership is not yet updated because the current member has not yet
-received the new membership list. In the first case, we can safely
-discard the gossip because we won't need any of the messages of the
-dead member. Gossips sent by dead members will only be in the system
-for a short time, until everybody has received them. In the second
-case, which is assumed to be very rare, a new member S has joined the
-group, received its digest from the coordinator and, before the
-coordinator's new view was received by a member P, that member
-receives a gossip from S. This is highly unlikely, but P will just
-discard S's gossip. This is not a problem, because S will continue
-sending gossips, and at some point will be a member, therefore its
-gossips will not be dropped any longer.
-
-Now, we check whether the gossip has been received before. We keep a
-list of gossips received (bounded cache in which the oldest gossips
-are removed before adding a new one). If the gossip has been seen
-before, it is discarded and the method returns. Otherwise we add the
-gossip to the end of the list. Since a gossip was already received, we
-already removed ourself from the not-seen list (see below) and re-sent
-the gossip, so we don't need to handle it again. This also prevents
-network flooding by gossips, e.g. caused by spurious retransmission
-requests, all to the same sender (the one who sent the gossip).
-
-
-Now we compare the digest received as part of the gossip for messages
-(from any senders) that we haven't seen yet. If there are any missing
-message, we send a retransmission request (a hashtable of senders and
-the messages missing from those senders) to the sender of the gossip.
-
-Next, we check who has already seen this gossip. If the not-seen list
-is empty (after removing ourselves, because we have now seen the
-gossip), we can assume that every other member in the group has
-received the messages in the gossip's digest, and therfore garbage
-collect the messages seen by all members. If the not-seen list is
-empty, we also do not need to resend this gossip, because everybody
-has already seen it. Therefore, the method returns.
-
-
-If there are still members in the not-seen list, we pick a random
-subset of those members and resend the gossip to them.
-
-
-Great care has to be taken not to flood the network. For example, if
-the group size is big and the gossips are resent to 30% of the members
-in a relatively short time interval (gossip_interval), then the
-network might easily become flooded. This is because every receiver
-potentially resends the gossip to another 30% of the members and
-because each receiver might request retransmission from a single
-sender of a gossip, which might lead to a message implosion problem.
-
-On the todo list for JavaGroups is therefore a mechanism which
-dynamically adjusts the subset percentage and the gossip interval with
-increasing or decreasing group size. Another additional line of
-defense is to have a bounded buffer in PBCAST to which all
-PBCAST-related messages (e.g. gossips, xmit-reqs, xmit-rsps) are
-added. When the buffer is full, new requests will just be
-discarded. This prevents flooding of both the buffers and the network
-(e.g. by not forwarding gossips). Regular unicast messages are passed
-up the stack, and multicast messages are directly handled (higher
-priority than gossips).
-
-
-
-Dynamic adjustment of gossip_interval in PBCAST
------------------------------------------------
-
-The gossip_interval (frequency with which gossips are sent by each
-member) can optionally be determined dynamically by JavaGroups as a
-function of the group size.
-
-We assume that almost every gossip reaches every other member
-(definitely if use_mcast_for_gossip is true). Therefore a gossip is
-used by each member which received it to adjust the time it hasn't
-heard from the members which have received the same gossip. This is
-done by resetting the times for all members which are in the gossip's
-path, i.e. the seen_list.
-
-The desired average gossip time (desired_avg_gossip) defines the
-average time between gossip receptions for a member. E.g. if it is set
-to 30 seconds, then the member will receive a gossip every 30 seconds
-on average. The gossip_interval is computed as follows:
-
-gossip_interval = Random(desired_avg_gossip * 2 * num_mbrs)
-
-For example: if the desired average gossip reception time is 30 secs,
-and we have 10 members in the group, then the gossip_interval will be
-randomly chosen from the range [1 - 600secs]. The average random value
-will be 300secs. Divided by 10 members, the average gossip reception
-will be 30 secs.
-
-The gossip_interval is determined anew before each gossip, so that
-members vary their gossip_interval.
-
-Thus, gossip_interval increases with group size.
-
-The following rules govern whether static or dynamic determination of
-gossip_interval will be used:
-
-- if dynamic: dynamic computation of gossip_interval
-  --> gossip_interval is ignored
-  --> desired_avg_gossip and number of members is used to determine
-      gossip_interval
-
-- if dynamic=false: static use of gossip_interval
-  --> gossip_interval is set
-
-
-
-
-Tracing
--------
-
-Most diagnostic output is through JavaGroups.Common.Trace, e.g. 
-
-     Trace.println("FD.run()", Trace.WARN, "could not ping " + dest);
-
-The Trace.setOutput() methods enable to switch tracing on/off, so the
-above message will be written (e.g. to a file) or not. However, if we
-don't want any output, the 2 strings "FD.run()" and "could not ping"
-will still be created, which results in a lot of garbage.
-
-Therefore, the convention was adopted in the Protocols and
-Protocols/pbcast directories to check for the boolean flag 'trace'
-first, and only if it is true, to actually call
-Trace.println(). Therefore the above example can be rewritten as
-
-     if(trace)
-         Trace.println("FD.run()", Trace.WARN, "could not ping " + dest);
-
-The 2 strings will only be created if 'trace' is true, which saves a
-lot of accumulated creation time and memory when JavaGroups needs to
-be run without tracing enabled.
-
-Note that code that will only be executed in exceptional cases does
-not necessarily be preceeded by the "if(trace)" conditional statement,
-e.g.
-
-     try {
-        // try out something
-     }
-     catch(Exception ex) { // should never be reached
-         Trace.println("FD.PingDest()", Trace.DEBUG, ex.printStackTrace());
-     }  
-
-To balance the need to avoid excesssive string creation on the one
-hand and the overhead and adverse effect of trace statements on
-readability, as a rule of thumb, the "if(trace)" statement should be
-used in places where a big number of strings would be generated if
-trace is disabled.
-
-
-
-Membership Updating for JOIN/LEAVE requests
--------------------------------------------
-
-When many members join a group at the same time, there were
-inconsistent views mcast by the coordinator (P). The reason was that P
-made a *copy* of its membership M1, added the new member and mcast the
-new membership M2 to all members. P would only update its membership
-upon reception of M2. However, if there were client JOINs before
-receiving M2, P would compute the new membership based on its (old)
-M1, which would not take into account members who joined between M1
-and M2.
-
-Solution: P updates its membership locally before mcasting the new
-membership. As soon as M2 is received, the membership will be set to
-M2 (which is the same).
-
-
-There is a little twist on the above solution: when a coordinator P
-receives a number of simultaneous JOIN requests (e.g. from A, B, C),
-the membership will be {P, A, B, C} after C's request has been
-processed. However, if we then receive the view for the first join,
-which is {P, A}, the membership would be reset to {P, A}. Further JOIN
-requests received before view {P, A, B, C} would operate on {P, A}
-instead of the correct {P, A, B, C}.
-
-Solution: a temporary membership list keeps track of the unofficial
-membership. This is one hasn't yet been made official by means of a
-view change, but which keeps joining members which are not yet
-contained in the official membership.
-
-[bela Nov 22 2003]: implemented the same mechanism for LEAVE requests
-(using a 'leaving' list in pbcast.GMS)
-
-
-
-Last Message dropped in NAKACK
-------------------------------
-
-When a negative acknowledgment scheme (NACK or NAK) is used, senders
-send monotonically increasing sequence numbers (seqnos) and receivers
-expect them in the same sequence. If a gap is detected at a receiver
-R, R will send a retransmit request to the sender of that
-message. However, there is a problem: if a receiver R does not receive
-the last message M sent by P, and P does not send more messages, then
-R will not know that P sent M and therefore not request
-retransmission. This will be the case until P sends another message
-M'. At this point, R will request retransmission of M from P and only
-deliver M' after M has been received. Since this may never be the
-case, or take a long time, the following solution has been adopted:
-the STABLE layer includes an array of the highest seqnos received for
-each member. When a gossip has been received from each member, the
-stability vector will be sent by the STABLE layer up the stack to the
-NAKACK layer. The NAKACK protocol will then do its garbage collection
-based on the stability vector received. In addition, it will also
-check whether it has a copy of the highest messages for each sender,
-as indicated in the stability vector. If it doesn't, it will request
-retransmission of the missing message(s). A retransmission would only
-occur if (a) a message was not received and (b) it was the last
-message.
-
-
-
-MERGE2 protocol
----------------
-
-This is a description of the new merge protocol, consisting of the
-MERGE2 protocol and the pbcast.GMS and pbcast.Coord/Part/Client
-modules.
-
-The MERGE2 protocol periodically fetches the initial membership (using
-the FIND_INITIAL_MBRS event, handled e.g. by the PING protocol). When
-it discovers that there is more than 1 coordinator, it sends a MERGE
-event up the stack with the list of coordinators as argument. For
-details see the javadoc for MERGE2.
-
-Changes to the group membership protocol were made in the pbcast
-directory. Those modifications will be backported to the main protocol
-directory. The following discussion refers to the changes in pbcast.
-
-Overview:
-First a merge leader is determined. This is done by lexical sorting of
-the coordinators' addresses and taking the first one. Because this is
-deterministic, and the outcome the same at all coordinators, we don't
-need an additional round of messaging for leader election.
-The leader then sends MERGE_REQ to all coordinators. Each coordinator
-returns its view and digest. The leader merges them into one
-view/digest. This data is subsequently sent to each coordinator, who
-in turn rebroadcasts it to the members of its subgroup. Each member
-(including the coordinator) will then install the (same) new digest
-and view, thus agreeing on the membership and forming one single
-group. On view installation, each coordinator checks whether it is
-still coordinator (of the new group), and becomes participant if not
-so.
-It is possible that, during a merge, members send messages (e.g. after
-the digest has been returned). The digest would obviously contain
-lower sequence numbers than actually send. For example, member P's
-digest entry shows P's highest seqno to be 14, but it actually send 15
-and 16 after the digest was returned. In this case, there may be
-retransmissions of messages 15 and 16 from P.
-
-The following section describes the implementation in pseudo code.
-
-When GMS receives a MERGE event, it calls
-impl.Merge(evt.GetArg()). Only the coordinators react.
-
-CoordGmsImpl.Merge():
-- Returns if merge already in progress
-- Else: set merging to true, create merge id
-- Determine merge leader
-- If leader: start MergeTask (needs to be done asynchronously to avoid
-  blocking)
-
-
-MergeTask:
-- Send MERGE_REQ (with merge id) to other coords and wait for all
-  responses (including self)
-- Remove the rejected or missing MERGE_RSPS from list of coordinators
-- If resulting list is empty (containing only self): abort thread, set
-  merging to false
-- Else:
-    - Merge all digests. Should be mutually exclusive (different
-      subgroups). If not, take maximum of all digests
-    - Establish new view (max of all ViewIds + 1)
-    - Establish new membership (merge all members and sort)
-    - New coordinator is first member of new membership
-    - Send INSTALL_MERGE_VIEW to all coordinators
-- Terminate MergeTask
-
-Reception of MERGE_REQ (HandleMerge():
-- If merging is false: return MERGE_RSP with rejected=true
-- Else:
-  - Set merging to true
-  - Set merge id
-  - Set timer. If timer goes off, cancel merge (to prevent hangs if
-    merge leader dies)
-  - Get digest and view
-  - Return MERGE_RSP with digest/view to sender
-
-Reception of INSTALL_MERGE_VIEW:
-- If merging == true and merge ids are the same:
-  - Cast view (MergeView) to all members of subgroup (including view and digest)
-
-Reception of MergeView:
-- If digest: merge digest with current digest
-- Install view
-- If not coord anymore: become participant
-- Send VIEW_CHANGE (with MergeView as parameter) up the stack
-- Set merging to false
-
-
-
-
-pbcast.STABLE protocol
-----------------------
-
-- Every member maintains a digest: the highest seqno *delivered* for each member, e.g.
-  A:22, B:2, C:19. This means the highest delivered messages were 22 for A, 2 for B and 19 for C.
-  Note that the highest delivered message is always <= the highest *see* (or *received*) message
-- Periodically (or after having received a certain number of bytes), every member multicasts its digest
-- When another member receives the digest, it updates its own digest such that the minimum of its own
-  seqnos per member and the seqnos from the other digest becomes the new seqnos
-- Every member also maintains a heard_from list, which is initialized to all members
-- When a digest is received, we update our own digest, then remove the sender from the heard_from list
-- When the heard_from list is empty, because we have heard from all the members, we send our digest as
-  a *stability* message. This is done in a randomly staggered fashion so that we can avoid everyone
-  sending their stability digest at the same time. When a member receives a stability digest, it cancels
-  the sending of its own stability digest
-- When a member receives a STABILITY message, it can be sure that everyone agreed on it, and therefore
-  removes all seqnos <= the ones in the stability digest
-- One problem is that everyone needs to agree, we cannot have unilateral action. The result could be that
-  someone removes messages from its store that have not yet been seen by everyone, therefore it cannot
-  serve those messages when a retransmission is requested
-  One way in which this can happen is as follows:
-  - 2 members: A,B
-  - A receives a stable message from  B, and removes B from its heard_from list
-  - A sets its own digest, but this time it has 3 members ! (A,B,C)
-  - A removes itself from the heard_from list, and since that list is now empty, it sends a
-    stability message {A,B,C}. However, B has *not* agreed on C's highest delivered seqnos, so this is
-    unilateral action and may cause the above problem.
-    Solution: when any member receives a digest that doesn't have the exact same members,
-    it does the following:
-    - Reset the heard_from list
-    - This will ensure that (a) no stable message is sent and (b) no stability message is sent
-
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java
deleted file mode 100644
index 607928b..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: Digest.java,v 1.17 2005/10/03 13:25:26 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols.pbcast;
-
-import java.util.concurrent.ConcurrentHashMap;
-import com.gemstone.org.jgroups.util.GemFireTracer;
-import com.gemstone.org.jgroups.Address;
-import com.gemstone.org.jgroups.Global;
-import com.gemstone.org.jgroups.JChannel;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.util.Streamable;
-import com.gemstone.org.jgroups.util.Util;
-import com.gemstone.org.jgroups.util.VersionedStreamable;
-
-import java.io.*;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * A message digest, which is used by the PBCAST layer for gossiping (also used by NAKACK for
- * keeping track of current seqnos for all members). It contains pairs of senders and a range of seqnos
- * (low and high), where each sender is associated with its highest and lowest seqnos seen so far.  That
- * is, the lowest seqno which was not yet garbage-collected and the highest that was seen so far and is
- * deliverable (or was already delivered) to the application.  A range of [0 - 0] means no messages have
- * been received yet. 
- * <p> April 3 2001 (bela): Added high_seqnos_seen member. It is used to disseminate
- * information about the last (highest) message M received from a sender P. Since we might be using a
- * negative acknowledgment message numbering scheme, we would never know if the last message was
- * lost. Therefore we periodically gossip and include the last message seqno. Members who haven't seen
- * it (e.g. because msg was dropped) will request a retransmission. See DESIGN for details.
- * @author Bela Ban
- */
-public class Digest implements Externalizable, VersionedStreamable {
-    /** Map key is Address, value is Entry> */
-    Map    senders=null;
-    protected static final GemFireTracer log=GemFireTracer.getLog(Digest.class);
-    static final boolean warn=log.isWarnEnabled();
-
-
-
-
-    public Digest() {
-    } // used for externalization
-
-    public Digest(int size) {
-        senders=createSenders(size);
-    }
-
-
-    @Override // GemStoneAddition
-    public boolean equals(Object obj) {
-        if(obj == null)
-            return false;
-        if (!(obj instanceof Digest)) return false; // GemStoneAddition
-        Digest other=(Digest)obj;
-        if(senders == null && other.senders == null)
-            return true;
-        if (senders == null) return false; // GemStoneAddition
-        return senders.equals(other.senders);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see java.lang.Object#hashCode()
-     * 
-     * Note that we just need to make sure that equal objects return equal
-     * hashcodes; nothing really elaborate is done here.
-     */
-    @Override // GemStoneAddition
-    public int hashCode() { // GemStoneAddition
-      int result = 0;
-      if (senders != null) {
-        result += senders.hashCode();
-      }
-      return result;
-    }
-
-
-
-    public void add(Address sender, long low_seqno, long high_seqno) {
-        add(sender, low_seqno, high_seqno, -1);
-    }
-
-
-    public void add(Address sender, long low_seqno, long high_seqno, long high_seqno_seen) {
-        add(sender, new Entry(low_seqno, high_seqno, high_seqno_seen));
-    }
-
-    private void add(Address sender, Entry entry) {
-        if(sender == null || entry == null) {
-            if(log.isErrorEnabled())
-                log.error(ExternalStrings.Digest_SENDER__0__OR_ENTRY__1_IS_NULL_WILL_NOT_ADD_ENTRY, new Object[] {sender, entry});
-            return;
-        }
-        Object retval=senders.put(sender, entry);
-        if(retval != null && warn)
-            log.warn("entry for " + sender + " was overwritten with " + entry);
-    }
-
-
-    public void add(Digest d) {
-        if(d != null) {
-            Map.Entry entry;
-            Address key;
-            Entry val;
-            for(Iterator it=d.senders.entrySet().iterator(); it.hasNext();) {
-                entry=(Map.Entry)it.next();
-                key=(Address)entry.getKey();
-                val=(Entry)entry.getValue();
-                add(key, val.low_seqno, val.high_seqno, val.high_seqno_seen);
-            }
-        }
-    }
-
-    public void replace(Digest d) {
-        if(d != null) {
-            Map.Entry entry;
-            Address key;
-            Entry val;
-            clear();
-            for(Iterator it=d.senders.entrySet().iterator(); it.hasNext();) {
-                entry=(Map.Entry)it.next();
-                key=(Address)entry.getKey();
-                val=(Entry)entry.getValue();
-                add(key, val.low_seqno, val.high_seqno, val.high_seqno_seen);
-            }
-        }
-    }
-
-    public Entry get(Address sender) {
-        return (Entry)senders.get(sender);
-    }
-
-    public boolean set(Address sender, long low_seqno, long high_seqno, long high_seqno_seen) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry == null)
-            return false;
-        entry.low_seqno=low_seqno;
-        entry.high_seqno=high_seqno;
-        entry.high_seqno_seen=high_seqno_seen;
-        return true;
-    }
-
-    /**
-     * Adds a digest to this digest. This digest must have enough space to add the other digest; otherwise an error
-     * message will be written. For each sender in the other digest, the merge() method will be called.
-     */
-    public void merge(Digest d) {
-        if(d == null) {
-            if(log.isErrorEnabled()) log.error(ExternalStrings.Digest_DIGEST_TO_BE_MERGED_WITH_IS_NULL);
-            return;
-        }
-        Map.Entry entry;
-        Address sender;
-        Entry val;
-        for(Iterator it=d.senders.entrySet().iterator(); it.hasNext();) {
-            entry=(Map.Entry)it.next();
-            sender=(Address)entry.getKey();
-            val=(Entry)entry.getValue();
-            if(val != null) {
-                merge(sender, val.low_seqno, val.high_seqno, val.high_seqno_seen);
-            }
-        }
-    }
-
-
-    /**
-     * Similar to add(), but if the sender already exists, its seqnos will be modified (no new entry) as follows:
-     * <ol>
-     * <li>this.low_seqno=min(this.low_seqno, low_seqno)
-     * <li>this.high_seqno=max(this.high_seqno, high_seqno)
-     * <li>this.high_seqno_seen=max(this.high_seqno_seen, high_seqno_seen)
-     * </ol>
-     * If the sender doesn not exist, a new entry will be added (provided there is enough space)
-     */
-    public void merge(Address sender, long low_seqno, long high_seqno, long high_seqno_seen) {
-        if(sender == null) {
-            if(log.isErrorEnabled()) log.error(ExternalStrings.Digest_SENDER__NULL);
-            return;
-        }
-        Entry entry=(Entry)senders.get(sender);
-        if(entry == null) {
-            add(sender, low_seqno, high_seqno, high_seqno_seen);
-        }
-        else {
-            if(low_seqno < entry.low_seqno)
-                entry.low_seqno=low_seqno;
-            if(high_seqno > entry.high_seqno)
-                entry.high_seqno=high_seqno;
-            if(high_seqno_seen > entry.high_seqno_seen)
-                entry.high_seqno_seen=high_seqno_seen;
-        }
-    }
-
-
-
-    public boolean contains(Address sender) {
-        return senders.containsKey(sender);
-    }
-
-
-    /**
-     * Compares two digests and returns true if the senders are the same, otherwise false.
-     * @param other
-     * @return True if senders are the same, otherwise false.
-     */
-    public boolean sameSenders(Digest other) {
-        if(other == null) return false;
-        if(this.senders == null || other.senders == null) return false;
-        if(this.senders.size() != other.senders.size()) return false;
-
-        Set my_senders=senders.keySet(), other_senders=other.senders.keySet();
-        return my_senders.equals(other_senders);
-    }
-
-
-    /** 
-     * Increments the sender's high_seqno by 1.
-     */
-    public void incrementHighSeqno(Address sender) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry == null)
-            return;
-        entry.high_seqno++;
-    }
-
-
-    public int size() {
-        return senders.size();
-    }
-
-
-
-
-    /**
-     * Resets the seqnos for the sender at 'index' to 0. This happens when a member has left the group,
-     * but it is still in the digest. Resetting its seqnos ensures that no-one will request a message
-     * retransmission from the dead member.
-     */
-    public void resetAt(Address sender) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry != null)
-            entry.reset();
-    }
-
-
-    public void clear() {
-        senders.clear();
-    }
-
-    public long lowSeqnoAt(Address sender) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry == null)
-            return -1;
-        else
-            return entry.low_seqno;
-    }
-
-
-    public long highSeqnoAt(Address sender) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry == null)
-            return -1;
-        else
-            return entry.high_seqno;
-    }
-
-
-    public long highSeqnoSeenAt(Address sender) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry == null)
-            return -1;
-        else
-            return entry.high_seqno_seen;
-    }
-
-
-    public void setHighSeqnoAt(Address sender, long high_seqno) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry != null)
-            entry.high_seqno=high_seqno;
-    }
-
-    public void setHighSeqnoSeenAt(Address sender, long high_seqno_seen) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry != null)
-            entry.high_seqno_seen=high_seqno_seen;
-    }
-
-    public void setHighestDeliveredAndSeenSeqnos(Address sender, long high_seqno, long high_seqno_seen) {
-        Entry entry=(Entry)senders.get(sender);
-        if(entry != null) {
-            entry.high_seqno=high_seqno;
-            entry.high_seqno_seen=high_seqno_seen;
-        }
-    }
-
-
-    public Digest copy() {
-        Digest ret=new Digest(senders.size());
-        Map.Entry entry;
-        Entry tmp;
-        for(Iterator it=senders.entrySet().iterator(); it.hasNext();) {
-            entry=(Map.Entry)it.next();
-            tmp=(Entry)entry.getValue();
-            ret.add((Address)entry.getKey(), tmp.low_seqno, tmp.high_seqno, tmp.high_seqno_seen);
-        }
-        return ret;
-    }
-
-
-    @Override // GemStoneAddition
-    public String toString() {
-        StringBuffer sb=new StringBuffer();
-        boolean first=true;
-        if(senders == null) return "[]";
-        Map.Entry entry;
-        Address key;
-        Entry val;
-
-        for(Iterator it=senders.entrySet().iterator(); it.hasNext();) {
-            entry=(Map.Entry)it.next();
-            key=(Address)entry.getKey();
-            val=(Entry)entry.getValue();
-            if(!first) {
-                sb.append(", ");
-            }
-            else {
-                first=false;
-            }
-            sb.append(key).append(": ").append('[').append(val.low_seqno).append(" : ");
-            sb.append(val.high_seqno);
-            if(val.high_seqno_seen >= 0)
-                sb.append(" (").append(val.high_seqno_seen).append(")");
-            sb.append("]");
-        }
-        return sb.toString();
-    }
-
-
-    public String printHighSeqnos() {
-        StringBuffer sb=new StringBuffer();
-        boolean first=true;
-        Map.Entry entry;
-        Address key;
-        Entry val;
-
-        for(Iterator it=senders.entrySet().iterator(); it.hasNext();) {
-            entry=(Map.Entry)it.next();
-            key=(Address)entry.getKey();
-            val=(Entry)entry.getValue();
-            if(!first) {
-                sb.append(", ");
-            }
-            else {
-                sb.append('[');
-                first=false;
-            }
-            sb.append(key).append("#").append(val.high_seqno);
-        }
-        sb.append(']');
-        return sb.toString();
-    }
-
-
-    public String printHighSeqnosSeen() {
-       StringBuffer sb=new StringBuffer();
-        boolean first=true;
-        Map.Entry entry;
-        Address key;
-        Entry val;
-
-        for(Iterator it=senders.entrySet().iterator(); it.hasNext();) {
-            entry=(Map.Entry)it.next();
-            key=(Address)entry.getKey();
-            val=(Entry)entry.getValue();
-            if(!first) {
-                sb.append(", ");
-            }
-            else {
-                sb.append('[');
-                first=false;
-            }
-            sb.append(key).append("#").append(val.high_seqno_seen);
-        }
-        sb.append(']');
-        return sb.toString();
-    }
-
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        toData(out);
-    }
-
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        fromData(in);
-    }
-
-    public void writeTo(DataOutputStream out) throws IOException {
-      toData(out);
-    }
-    
-    public void toData(DataOutput out) throws IOException {
-        out.writeShort(senders.size());
-        Map.Entry entry;
-        Address key;
-        Entry val;
-        for(Iterator it=senders.entrySet().iterator(); it.hasNext();) {
-            entry=(Map.Entry)it.next();
-            key=(Address)entry.getKey();
-            val=(Entry)entry.getValue();
-            JChannel.getGfFunctions().writeObject(key, out);
-            out.writeLong(val.low_seqno);
-            out.writeLong(val.high_seqno);
-            out.writeLong(val.high_seqno_seen);
-        }
-    }
-
-
-    public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException {
-      try {
-        fromData(in);
-      } catch (ClassNotFoundException e) {
-        InstantiationException ex = new InstantiationException("Unable to instantiate during deserialization");
-        ex.initCause(e);
-        throw ex;
-      }
-    }
-    
-    public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-        short size=in.readShort();
-        senders=createSenders(size);
-        Address key;
-        for(int i=0; i < size; i++) {
-            key=JChannel.getGfFunctions().readObject(in);
-            long low_seqno = in.readLong();
-            long high_seqno = in.readLong();
-            long high_seqno_seen = in.readLong();
-            add(key, low_seqno, high_seqno, high_seqno_seen);
-        }
-    }
-
-
-    public long serializedSize(short version) {
-        long retval=Global.SHORT_SIZE; // number of elements in 'senders'
-        if(senders.size() > 0) {
-            Address addr=(Address)senders.keySet().iterator().next();
-            int len=addr.size(version) +
-                    2 * Global.BYTE_SIZE; // presence byte, IpAddress vs other address
-            len+=3 * Global.LONG_SIZE; // 3 longs in one Entry
-            retval+=len * senders.size();
-        }
-        return retval;
-    }
-
-    private Map createSenders(int size) {
-        return new ConcurrentHashMap(size);
-    }
-
-
-    /**
-     * Class keeping track of the lowest and highest sequence numbers delivered, and the highest
-     * sequence numbers received, per member
-     */
-    public static class Entry  {
-        public long low_seqno, high_seqno, high_seqno_seen=-1;
-
-        public Entry(long low_seqno, long high_seqno, long high_seqno_seen) {
-            this.low_seqno=low_seqno;
-            this.high_seqno=high_seqno;
-            this.high_seqno_seen=high_seqno_seen;
-        }
-
-        public Entry(long low_seqno, long high_seqno) {
-            this.low_seqno=low_seqno;
-            this.high_seqno=high_seqno;
-        }
-
-        public Entry(Entry other) {
-            if(other != null) {
-                low_seqno=other.low_seqno;
-                high_seqno=other.high_seqno;
-                high_seqno_seen=other.high_seqno_seen;
-            }
-        }
-
-        @Override // GemStoneAddition
-        public boolean equals(Object obj) {
-            if (obj == null || !(obj instanceof Entry)) return false; // GemStoneAddition
-            Entry other=(Entry)obj;
-            return low_seqno == other.low_seqno && high_seqno == other.high_seqno && high_seqno_seen == other.high_seqno_seen;
-        }
-        
-        /*
-         * (non-Javadoc)
-         * @see java.lang.Object#hashCode()
-         * 
-         * Note that we just need to make sure that equal objects return equal
-         * hashcodes; nothing really elaborate is done here.
-         */
-        @Override // GemStoneAddition
-        public int hashCode() { // GemStoneAddition
-          int result = 0;
-          result += this.low_seqno;
-          result += this.high_seqno;
-          result += this.high_seqno_seen;
-          return result;
-        }
-
-        @Override // GemStoneAddition
-        public String toString() {
-            return new StringBuffer("low=").append(low_seqno).append(", high=").append(high_seqno).
-                    append(", highest seen=").append(high_seqno_seen).toString();
-        }
-
-        public void reset() {
-            low_seqno=high_seqno=0;
-            high_seqno_seen=-1;
-        }
-    }
-
-
-    @Override
-    public short[] getSerializationVersions() {
-      return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java.old
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java.old b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java.old
deleted file mode 100644
index 470257a..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/Digest.java.old
+++ /dev/null
@@ -1,558 +0,0 @@
-// $Id: Digest.java,v 1.9 2005/07/08 11:28:25 belaban Exp $
-
-package org.jgroups.protocols.pbcast;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jgroups.Address;
-import org.jgroups.util.Streamable;
-import org.jgroups.util.Util;
-
-import java.io.*;
-
-
-/**
- * A message digest, which is used e.g. by the PBCAST layer for gossiping (also used by NAKACK for
- * keeping track of current seqnos for all members). It contains pairs of senders and a range of seqnos
- * (low and high), where each sender is associated with its highest and lowest seqnos seen so far.  That
- * is, the lowest seqno which was not yet garbage-collected and the highest that was seen so far and is
- * deliverable (or was already delivered) to the application.  A range of [0 - 0] means no messages have
- * been received yet. <p> April 3 2001 (bela): Added high_seqnos_seen member. It is used to disseminate
- * information about the last (highest) message M received from a sender P. Since we might be using a
- * negative acknowledgment message numbering scheme, we would never know if the last message was
- * lost. Therefore we periodically gossip and include the last message seqno. Members who haven't seen
- * it (e.g. because msg was dropped) will request a retransmission. See DESIGN for details.
- * @author Bela Ban
- */
-public class Digest implements Externalizable, Streamable {
-    Address[] senders=null;
-    long[]    low_seqnos=null;       // lowest seqnos seen
-    long[]    high_seqnos=null;      // highest seqnos seen so far *that are deliverable*, initially 0
-    long[]    high_seqnos_seen=null; // highest seqnos seen so far (not necessarily deliverable), initially -1
-    int       index=0;               // current index of where next member is added
-    protected static final Log log=LogFactory.getLog(Digest.class);
-
-
-    public Digest() {
-    } // used for externalization
-
-    public Digest(int size) {
-        reset(size);
-    }
-
-
-    public boolean equals(Object obj) {
-        if(obj == null)
-            return false;
-        Digest other=(Digest)obj;
-        if(sameSenders(other) == false)
-            return false;
-
-        if(!Util.match(low_seqnos, other.low_seqnos))
-            return false;
-        if(!Util.match(high_seqnos, other.high_seqnos))
-            return false;
-        if(!Util.match(high_seqnos_seen, other.high_seqnos_seen))
-            return false;
-
-        return true;
-    }
-
-
-
-
-    public void add(Address sender, long low_seqno, long high_seqno) {
-        if(index >= senders.length) {
-            if(log.isErrorEnabled()) log.error("index " + index +
-                    " out of bounds, please create new Digest if you want more members !");
-            return;
-        }
-        if(sender == null) {
-            if(log.isErrorEnabled()) log.error("sender is null, will not add it !");
-            return;
-        }
-        senders[index]=sender;
-        low_seqnos[index]=low_seqno;
-        high_seqnos[index]=high_seqno;
-        high_seqnos_seen[index]=-1;
-        index++;
-    }
-
-
-    public void add(Address sender, long low_seqno, long high_seqno, long high_seqno_seen) {
-        if(index >= senders.length) {
-            if(log.isErrorEnabled()) log.error("index " + index +
-                    " out of bounds, please create new Digest if you want more members !");
-            return;
-        }
-        if(sender == null) {
-            if(log.isErrorEnabled()) log.error("sender is null, will not add it !");
-            return;
-        }
-        senders[index]=sender;
-        low_seqnos[index]=low_seqno;
-        high_seqnos[index]=high_seqno;
-        high_seqnos_seen[index]=high_seqno_seen;
-        index++;
-    }
-
-
-    public void add(Digest d) {
-        Address sender;
-        long low_seqno, high_seqno, high_seqno_seen;
-
-        if(d != null) {
-            for(int i=0; i < d.size(); i++) {
-                sender=d.senderAt(i);
-                low_seqno=d.lowSeqnoAt(i);
-                high_seqno=d.highSeqnoAt(i);
-                high_seqno_seen=d.highSeqnoSeenAt(i);
-                add(sender, low_seqno, high_seqno, high_seqno_seen);
-            }
-        }
-    }
-
-
-    /**
-     * Adds a digest to this digest. This digest must have enough space to add the other digest; otherwise an error
-     * message will be written. For each sender in the other digest, the merge() method will be called.
-     */
-    public void merge(Digest d) {
-        Address sender;
-        long low_seqno, high_seqno, high_seqno_seen;
-
-        if(d == null) {
-            if(log.isErrorEnabled()) log.error("digest to be merged with is null");
-            return;
-        }
-        for(int i=0; i < d.size(); i++) {
-            sender=d.senderAt(i);
-            low_seqno=d.lowSeqnoAt(i);
-            high_seqno=d.highSeqnoAt(i);
-            high_seqno_seen=d.highSeqnoSeenAt(i);
-            merge(sender, low_seqno, high_seqno, high_seqno_seen);
-        }
-    }
-
-
-    /**
-     * Similar to add(), but if the sender already exists, its seqnos will be modified (no new entry) as follows:
-     * <ol>
-     * <li>this.low_seqno=min(this.low_seqno, low_seqno)
-     * <li>this.high_seqno=max(this.high_seqno, high_seqno)
-     * <li>this.high_seqno_seen=max(this.high_seqno_seen, high_seqno_seen)
-     * </ol>
-     * If the sender doesn not exist, a new entry will be added (provided there is enough space)
-     */
-    public void merge(Address sender, long low_seqno, long high_seqno, long high_seqno_seen) {
-        int i;
-        long my_low_seqno, my_high_seqno, my_high_seqno_seen;
-        if(sender == null) {
-            if(log.isErrorEnabled()) log.error("sender == null");
-            return;
-        }
-        i=getIndex(sender);
-        if(i == -1) {
-            add(sender, low_seqno, high_seqno, high_seqno_seen);
-            return;
-        }
-
-        my_low_seqno=lowSeqnoAt(i);
-        my_high_seqno=highSeqnoAt(i);
-        my_high_seqno_seen=highSeqnoSeenAt(i);
-        if(low_seqno < my_low_seqno)
-            setLowSeqnoAt(i, low_seqno);
-        if(high_seqno > my_high_seqno)
-            setHighSeqnoAt(i, high_seqno);
-        if(high_seqno_seen > my_high_seqno_seen)
-            setHighSeqnoSeenAt(i, high_seqno_seen);
-    }
-
-
-    public int getIndex(Address sender) {
-        int ret=-1;
-
-        if(sender == null) return ret;
-        for(int i=0; i < senders.length; i++)
-            if(sender.equals(senders[i]))
-                return i;
-        return ret;
-    }
-
-
-    public boolean contains(Address sender) {
-        return getIndex(sender) != -1;
-    }
-
-
-    /**
-     * Compares two digests and returns true if the senders are the same, otherwise false
-     * @param other
-     * @return
-     */
-    public boolean sameSenders(Digest other) {
-        Address a1, a2;
-        if(other == null) return false;
-        if(this.senders == null || other.senders == null) return false;
-        if(this.senders.length != other.senders.length) return false;
-        for(int i=0; i < this.senders.length; i++) {
-            a1=this.senders[i];
-            a2=other.senders[i];
-            if(a1 == null && a2 == null) continue;
-            if(a1 != null && a2 != null && a1.equals(a2))
-                continue;
-            else
-                return false;
-        }
-        return true;
-    }
-
-    /** Increment the sender's high_seqno by 1 */
-    public void incrementHighSeqno(Address sender) {
-        if(sender == null) return;
-        for(int i=0; i < senders.length; i++) {
-            if(senders[i] != null && senders[i].equals(sender)) {
-                high_seqnos[i]=high_seqnos[i] + 1;
-                break;
-            }
-        }
-    }
-
-
-    public int size() {
-        return senders.length;
-    }
-
-
-    public Address senderAt(int index) {
-        if(index < size())
-            return senders[index];
-        else {
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-            return null;
-        }
-    }
-
-
-    /**
-     * Resets the seqnos for the sender at 'index' to 0. This happens when a member has left the group,
-     * but it is still in the digest. Resetting its seqnos ensures that no-one will request a message
-     * retransmission from the dead member.
-     */
-    public void resetAt(int index) {
-        if(index < size()) {
-            low_seqnos[index]=0;
-            high_seqnos[index]=0;
-            high_seqnos_seen[index]=-1;
-        }
-        else
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-    }
-
-
-    public void reset(int size) {
-        senders=new Address[size];
-        low_seqnos=new long[size];
-        high_seqnos=new long[size];
-        high_seqnos_seen=new long[size];
-        for(int i=0; i < size; i++)
-            high_seqnos_seen[i]=-1;
-        index=0;
-    }
-
-
-    public long lowSeqnoAt(int index) {
-        if(index < size())
-            return low_seqnos[index];
-        else {
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-            return 0;
-        }
-    }
-
-
-    public long highSeqnoAt(int index) {
-        if(index < size())
-            return high_seqnos[index];
-        else {
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-            return 0;
-        }
-    }
-
-    public long highSeqnoSeenAt(int index) {
-        if(index < size())
-            return high_seqnos_seen[index];
-        else {
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-            return 0;
-        }
-    }
-
-
-    public long highSeqnoAt(Address sender) {
-        long ret=-1;
-        int i;
-
-        if(sender == null) return ret;
-        i=getIndex(sender);
-        if(i == -1)
-            return ret;
-        else
-            return high_seqnos[i];
-    }
-
-
-    public long highSeqnoSeenAt(Address sender) {
-        long ret=-1;
-        int i;
-
-        if(sender == null) return ret;
-        i=getIndex(sender);
-        if(i == -1)
-            return ret;
-        else
-            return high_seqnos_seen[i];
-    }
-
-    public void setLowSeqnoAt(int index, long low_seqno) {
-        if(index < size()) {
-            low_seqnos[index]=low_seqno;
-        }
-        else
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-    }
-
-
-    public void setHighSeqnoAt(int index, long high_seqno) {
-        if(index < size()) {
-            high_seqnos[index]=high_seqno;
-        }
-        else
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-    }
-
-    public void setHighSeqnoSeenAt(int index, long high_seqno_seen) {
-        if(index < size()) {
-            high_seqnos_seen[index]=high_seqno_seen;
-        }
-        else
-            if(log.isErrorEnabled()) log.error("index " + index + " is out of bounds");
-    }
-
-
-    public void setHighSeqnoAt(Address sender, long high_seqno) {
-        int i=getIndex(sender);
-        if(i < 0)
-            return;
-        else
-            setHighSeqnoAt(i, high_seqno);
-    }
-
-    public void setHighSeqnoSeenAt(Address sender, long high_seqno_seen) {
-        int i=getIndex(sender);
-        if(i < 0)
-            return;
-        else
-            setHighSeqnoSeenAt(i, high_seqno_seen);
-    }
-
-
-    public Digest copy() {
-        Digest ret=new Digest(senders.length);
-
-        // changed due to JDK bug (didn't work under JDK 1.4.{1,2} under Linux, JGroups bug #791718
-        // ret.senders=(Address[])senders.clone();
-        if(senders != null)
-            System.arraycopy(senders, 0, ret.senders, 0, senders.length);
-
-        ret.low_seqnos=(long[])low_seqnos.clone();
-        ret.high_seqnos=(long[])high_seqnos.clone();
-        ret.high_seqnos_seen=(long[])high_seqnos_seen.clone();
-        return ret;
-    }
-
-
-    public String toString() {
-        StringBuffer sb=new StringBuffer();
-        boolean first=true;
-        if(senders == null) return "[]";
-        for(int i=0; i < senders.length; i++) {
-            if(!first) {
-                sb.append(", ");
-            }
-            else {
-                sb.append('[');
-                first=false;
-            }
-            sb.append(senders[i]).append(": ").append('[').append(low_seqnos[i]).append(" : ");
-            sb.append(high_seqnos[i]);
-            if(high_seqnos_seen[i] >= 0)
-                sb.append(" (").append(high_seqnos_seen[i]).append(")]");
-        }
-        sb.append(']');
-        return sb.toString();
-    }
-
-
-    public String printHighSeqnos() {
-        StringBuffer sb=new StringBuffer();
-        boolean first=true;
-        for(int i=0; i < senders.length; i++) {
-            if(!first) {
-                sb.append(", ");
-            }
-            else {
-                sb.append('[');
-                first=false;
-            }
-            sb.append(senders[i]);
-            sb.append('#');
-            sb.append(high_seqnos[i]);
-        }
-        sb.append(']');
-        return sb.toString();
-    }
-
-
-    public String printHighSeqnosSeen() {
-        StringBuffer sb=new StringBuffer();
-        boolean first=true;
-        for(int i=0; i < senders.length; i++) {
-            if(!first) {
-                sb.append(", ");
-            }
-            else {
-                sb.append('[');
-                first=false;
-            }
-            sb.append(senders[i]);
-            sb.append('#');
-            sb.append(high_seqnos_seen[i]);
-        }
-        sb.append(']');
-        return sb.toString();
-    }
-
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(senders);
-
-        if(low_seqnos == null)
-            out.writeInt(0);
-        else {
-            out.writeInt(low_seqnos.length);
-            for(int i=0; i < low_seqnos.length; i++)
-                out.writeLong(low_seqnos[i]);
-        }
-
-        if(high_seqnos == null)
-            out.writeInt(0);
-        else {
-            out.writeInt(high_seqnos.length);
-            for(int i=0; i < high_seqnos.length; i++)
-                out.writeLong(high_seqnos[i]);
-        }
-
-        if(high_seqnos_seen == null)
-            out.writeInt(0);
-        else {
-            out.writeInt(high_seqnos_seen.length);
-            for(int i=0; i < high_seqnos_seen.length; i++)
-                out.writeLong(high_seqnos_seen[i]);
-        }
-
-        out.writeInt(index);
-    }
-
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        int num;
-
-        senders=(Address[])in.readObject();
-
-        num=in.readInt();
-        if(num == 0)
-            low_seqnos=null;
-        else {
-            low_seqnos=new long[num];
-            for(int i=0; i < low_seqnos.length; i++)
-                low_seqnos[i]=in.readLong();
-        }
-
-
-        num=in.readInt();
-        if(num == 0)
-            high_seqnos=null;
-        else {
-            high_seqnos=new long[num];
-            for(int i=0; i < high_seqnos.length; i++)
-                high_seqnos[i]=in.readLong();
-        }
-
-        num=in.readInt();
-        if(num == 0)
-            high_seqnos_seen=null;
-        else {
-            high_seqnos_seen=new long[num];
-            for(int i=0; i < high_seqnos_seen.length; i++)
-                high_seqnos_seen[i]=in.readLong();
-        }
-
-        index=in.readInt();
-    }
-
-    public void writeTo(DataOutputStream out) throws IOException {
-        out.writeInt(senders == null? 0 : senders.length);
-        for(int i=0; i < senders.length; i++) {
-            Address sender=senders[i];
-            Util.writeAddress(sender, out);
-        }
-        writeArray(low_seqnos, out);
-        writeArray(high_seqnos, out);
-        writeArray(high_seqnos_seen, out);
-        out.writeInt(index);
-    }
-
-    private void writeArray(long[] arr, DataOutputStream out) throws IOException {
-        int len=arr != null? arr.length : 0;
-        out.writeInt(len);
-        if(len > 0) {
-            for(int i=0; i < arr.length; i++) {
-                out.writeLong(arr[i]);
-            }
-        }
-    }
-
-    private long[] readArray(DataInputStream in) throws IOException {
-        int b=in.readInt();
-        if(b == 0)
-            return null;
-        long[] retval=new long[b];
-        for(int i=0; i < b; i++)
-            retval[i]=in.readLong();
-        return retval;
-    }
-
-    public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException {
-        int b=in.readInt();
-        if(b > 0) {
-            senders=new Address[b];
-            Address sender;
-            for(int i=0; i < b; i++) {
-                sender=Util.readAddress(in);
-                senders[i]=sender;
-            }
-        }
-        low_seqnos=readArray(in);
-        high_seqnos=readArray(in);
-        high_seqnos_seen=readArray(in);
-        index=in.readInt();
-    }
-
-
-    public long serializedSize() {
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/FD.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/FD.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/FD.java
deleted file mode 100644
index 5764589..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/pbcast/FD.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: FD.java,v 1.9 2005/08/11 12:43:46 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols.pbcast;
-
-
-import com.gemstone.org.jgroups.Address;
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.Message;
-import com.gemstone.org.jgroups.SuspectMember;
-import com.gemstone.org.jgroups.View;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.util.Util;
-import com.gemstone.org.jgroups.util.GemFireTracer;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Vector;
-
-
-/**
- * Passive failure detection protocol. It assumes a pbcast protocol, which uses rounds of gossiping for
- * reliable message delivery. Gossip protocols typically involve all the members sending gossips in regular
- * intervals. This protocol therefore works as follows: it allocates a timestamp for each member and updates
- * the timestamp whenever it receives a message from a sender P. Any type of message is accepted from P. For
- * example, PBCAST regularly sends the following messages:
- * <ul>
- * <li>regular mcast message from P
- * <li>regular ucast message from P
- * <li>gossip from P
- * <li>retransmit request from P
- * <li>retransmit response from P
- * </ul>
- *
- * @author Bela Ban
- */
-public class FD extends Protocol implements Runnable {
-    Address local_addr=null;
-    
-    // GemStoneAddition must be accessed synchronized on checker_lock
-    Thread checker=null;   // checks timestamps for timeout, generates SUSPECT event
-    final Object checker_lock=new Object();
-    long timeout=6000;   // number of millisecs to wait for a member to be suspected
-    // (should be higher than the gossip_interval value in PBCAST
-    final Hashtable members=new Hashtable(11); // keys=Addresses (members), vals=Entries (timestamp)
-    final Vector suspected_mbrs=new Vector(11); // currently suspected members (dynamically updated)
-
-
-    static class Entry  {
-        long timestamp;
-
-        Entry(long timestamp) {
-            this.timestamp=timestamp;
-        }
-
-        @Override // GemStoneAddition  
-        public String toString() {
-            return Long.toString(timestamp);
-        }
-    }
-
-
-    @Override // GemStoneAddition  
-    public String getName() {
-        return "FD";
-    }
-
-
-    @Override // GemStoneAddition  
-    public boolean setProperties(Properties props) {
-        String str;
-
-        super.setProperties(props);
-        str=props.getProperty("timeout");
-        if(str != null) {
-            timeout=Long.parseLong(str);
-            props.remove("timeout");
-        }
-
-        if(props.size() > 0) {
-            log.error(ExternalStrings.FD_FDSETPROPERTIES_THE_FOLLOWING_PROPERTIES_ARE_NOT_RECOGNIZED__0, props);
-            
-            return false;
-        }
-        return true;
-    }
-
-
-    @Override // GemStoneAddition  
-    public void stop() {
-        stopChecker();
-    }
-
-    @Override // GemStoneAddition  
-    public void up(Event evt) {
-        Message msg;
-        Address sender;
-
-        switch(evt.getType()) {
-
-            case Event.SET_LOCAL_ADDRESS:
-                local_addr=(Address)evt.getArg();
-                break;
-
-            case Event.MSG:
-                msg=(Message)evt.getArg();
-                sender=msg.getSrc();
-                updateSender(sender);
-                break;
-        }
-
-        passUp(evt);   // pass up to the layer above us
-    }
-
-
-    @Override // GemStoneAddition  
-    public void down(Event evt) {
-        View v;
-        Vector mbrs;
-        Address mbr;
-
-        switch(evt.getType()) {
-
-            case Event.VIEW_CHANGE:
-                v=(View)evt.getArg();
-                mbrs=v.getMembers();
-                passDown(evt);
-                synchronized (members) { // GemStoneAddition
-                for(Enumeration e=members.keys(); e.hasMoreElements();) {
-                    mbr=(Address)e.nextElement();
-                    if(!mbrs.contains(mbr)) {
-                        members.remove(mbr);
-                    }
-                }
-                members.remove(local_addr);
-                if(members.size() > 0 /* && checker == null GemStoneAddition */)
-                    startChecker();
-                }
-                return;
-
-                // generated by PBCAST, contains list of members a gossip has visited. we can safely reset their counter
-            case Event.HEARD_FROM:
-                updateSenders((Vector)evt.getArg());
-                return;  // don't pass down
-        }
-
-        passDown(evt);
-    }
-
-
-    public void run() {
-        Address mbr;
-        long timestamp, diff;
-
-        for (;;) { // GemStoneAddition -- remove coding anti-pattern
-          if (Thread.currentThread().isInterrupted()) break; // GemStoneAddition
-          synchronized (members) { // GemStoneAddition
-            if (members.size() == 0) // GemStoneAddition
-              break;
-            for(Enumeration e=members.keys(); e.hasMoreElements();) {
-                mbr=(Address)e.nextElement();
-                timestamp=((Entry)members.get(mbr)).timestamp;
-                diff=System.currentTimeMillis() - timestamp;
-                if(diff >= timeout) {
-                    if(log.isInfoEnabled()) log.info(ExternalStrings.FD_SUSPECTING__0, mbr);
-                    passUp(new Event(Event.SUSPECT, new SuspectMember(local_addr, mbr)));
-                    if(!suspected_mbrs.contains(mbr))
-                        suspected_mbrs.addElement(mbr);
-                }
-            } // for
-          } // synchronized
-            try { // GemStoneAddition
-              Util.sleep(timeout);
-            }
-            catch (InterruptedException e) {
-              break; // exit loop and thread
-            }
-        }
-        synchronized (checker_lock) { // GemStoneAddition
-          checker=null;
-        }
-    }
-
-
-    void startChecker() {
-        synchronized(checker_lock) {
-            if(checker == null) {
-                checker=new Thread(GemFireTracer.GROUP, this, "FD.CheckerThread");
-                checker.setDaemon(true);
-                checker.start();
-            }
-        }
-    }
-
-    void stopChecker() {
-        Thread tmp;
-        synchronized(checker_lock) {
-            if(checker != null && checker.isAlive()) {
-                tmp=checker;
-                checker=null;
-                tmp.interrupt();
-                try {
-                    tmp.join(timeout);
-                }
-                catch(InterruptedException ex) {
-                  Thread.currentThread().interrupt(); // GemStoneAddition
-                  // propagate to caller
-                }
-                if(tmp.isAlive())
-                    if(warn) log.warn("interrupted checker thread is still alive !");
-            }
-            checker=null;
-        }
-    }
-
-
-    void updateSender(Address mbr) {
-        Entry entry;
-        long curr_time;
-
-        if(mbr == null) {
-            if(log.isDebugEnabled()) log.debug("member " + mbr + " not found");
-            return;
-        }
-
-        if(suspected_mbrs.size() > 0 && suspected_mbrs.contains(mbr)) {
-            passUp(new Event(Event.UNSUSPECT, mbr));
-            suspected_mbrs.remove(mbr);
-        }
-
-        if(mbr.equals(local_addr))
-            return;
-        curr_time=System.currentTimeMillis();
-        synchronized (members) { // GemStoneAddition
-          entry=(Entry)members.get(mbr);
-          if(entry != null)
-            entry.timestamp=curr_time;
-          else
-            members.put(mbr, new Entry(curr_time));
-        }
-    }
-
-
-    void updateSenders(Vector v) {
-        Address mbr;
-        if(v == null) return;
-        for(int i=0; i < v.size(); i++) {
-            mbr=(Address)v.elementAt(i);
-            updateSender(mbr);
-        }
-    }
-
-
-    String printTimestamps() {
-        StringBuffer sb=new StringBuffer();
-        Address mbr;
-
-        synchronized(members) {
-            for(Enumeration e=members.keys(); e.hasMoreElements();) {
-                mbr=(Address)e.nextElement();
-                sb.append("\n" + mbr + ": " + (System.currentTimeMillis() - ((Entry)members.get(mbr)).timestamp));
-            }
-        }
-        return sb.toString();
-    }
-
-
-}


Mime
View raw message