geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [22/51] [partial] incubator-geode git commit: GEODE-77 removing the old jgroups subproject
Date Fri, 21 Aug 2015 21:22:46 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PerfHeader.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PerfHeader.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PerfHeader.java
deleted file mode 100644
index 8e4851b..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PerfHeader.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: PerfHeader.java,v 1.9 2005/08/08 12:45:43 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-import com.gemstone.org.jgroups.util.GemFireTracer;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.Header;
-import com.gemstone.org.jgroups.Message;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.Util;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-import java.io.*;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-
-/**
- * Inserted by PERF into each message. Records the time taken by each protocol to process the message to
- * which this header is attached. Travels down through the stack and up the other stack with the message.
- *
- * @author Bela Ban
- */
-@SuppressFBWarnings(value="SE_NO_SUITABLE_CONSTRUCTOR_FOR_EXTERNALIZATION",
-    justification="GemFire does not use the PERF protocol")
-public class PerfHeader extends Header  {
-    Object sender=null;
-    Object receiver=null;
-    long start_time=0;                       // time when header was created
-    long end_time=0;                         // time when header was received
-    long network_send=0;                     // time the packet was put on the network
-    long network_recv=0;                     // time the packet was received from the network
-    long network_time=0;                     // time spent on the network (between bottom layers)
-    HashMap down=new HashMap();               // key=protocol name, val=PerfEntry
-    HashMap up=new HashMap();                 // key=protocol name, val=PerfEntry
-    final static int UP=1;
-    final static int DOWN=2;
-    final static String classname="org.jgroups.protocols.PerfHeader";
-    static long size=0;
-    private static Message msg2;
-    static GemFireTracer            log=GemFireTracer.getLog(PerfHeader.class);
-
-
-    static {
-        size=Util.sizeOf(classname);
-        if(size <= 0) size=400;
-    }
-
-
-    // Needed for externalization
-    public PerfHeader() {
-    }
-
-
-    public PerfHeader(Object sender, Object receiver) {
-        this.sender=sender;
-        this.receiver=receiver;
-        start_time=System.currentTimeMillis();
-    }
-
-
-    @Override // GemStoneAddition
-    public String toString() {
-        return "[PerfHeader]";
-    }
-
-
-    public String printContents(boolean detailed) {
-        return printContents(detailed, null);
-    }
-
-
-    public String printContents(boolean detailed, Vector prots) {
-        StringBuffer sb=new StringBuffer();
-        String key;
-        PerfEntry val;
-        Protocol p;
-
-        if(sender != null)
-            sb.append("sender=").append(sender).append('\n');
-        if(receiver != null)
-            sb.append("receiver=").append(receiver).append('\n');
-
-        if(detailed)
-            sb.append("start_time=").append(start_time).append("\nend_time=").append(end_time).append('\n');
-
-        if(end_time >= start_time)
-            sb.append("total time=").append((end_time - start_time)).append('\n');
-        else
-            sb.append("total time=n/a\n");
-
-        if(detailed) {
-            if(network_send > 0) sb.append("network_send=").append(network_send).append('\n');
-            if(network_recv > 0) sb.append("network_recv=").append(network_recv).append('\n');
-        }
-
-        if(network_time > 0)
-            sb.append("network=").append(network_time).append('\n');
-
-        sb.append("\nDOWN\n-----\n");
-        if(prots != null) {
-            for(int i=0; i < prots.size(); i++) {
-                p=(Protocol)prots.elementAt(i);
-                key=p.getName();
-                val=(PerfEntry)down.get(key);
-                sb.append(key).append(':').append('\t').append(val.printContents(detailed)).append('\n');
-            }
-        }
-        else
-            for(Iterator it=down.keySet().iterator(); it.hasNext();) {
-                key=(String)it.next();
-                val=(PerfEntry)down.get(key);
-                sb.append(key).append(':').append('\t').append(val.printContents(detailed)).append('\n');
-            }
-
-        sb.append("\nUP\n-----\n");
-        if(prots != null) {
-            for(int i=prots.size() - 1; i >= 0; i--) {
-                p=(Protocol)prots.elementAt(i);
-                key=p.getName();
-                val=(PerfEntry)up.get(key);
-                sb.append(key).append(':').append('\t').append(val.printContents(detailed)).append('\n');
-            }
-        }
-        else
-            for(Iterator it=up.keySet().iterator(); it.hasNext();) {
-                key=(String)it.next();
-                val=(PerfEntry)up.get(key);
-                sb.append(key).append(':').append('\t').append(val.printContents(detailed)).append('\n');
-            }
-
-
-        return sb.toString();
-    }
-
-
-    public void setEndTime() {
-        end_time=System.currentTimeMillis();
-    }
-
-
-    public void setReceived(String prot_name, int type) {
-        PerfEntry entry=getEntry(prot_name, type);
-        long t=System.currentTimeMillis();
-        if(entry != null)
-            entry.setReceived(t);
-    }
-
-    public void setDone(String prot_name, int type) {
-        PerfEntry entry=getEntry(prot_name, type);
-        long t=System.currentTimeMillis();
-        if(entry != null)
-            entry.setDone(t);
-    }
-
-    public void setNetworkSent() {
-        network_send=System.currentTimeMillis();
-    }
-
-
-    public void setNetworkReceived() {
-        network_recv=System.currentTimeMillis();
-        if(network_send > 0 && network_recv > network_send)
-            network_time=network_recv - network_send;
-    }
-
-
-    /**
-     * Adds a new entry to both hashtables
-     */
-    public void addEntry(String prot_name) {
-        up.put(prot_name, new PerfEntry());
-        down.put(prot_name, new PerfEntry());
-    }
-
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(sender);
-        out.writeObject(receiver);
-        out.writeLong(start_time);
-        out.writeLong(end_time);
-        out.writeLong(network_send);
-        out.writeLong(network_recv);
-        out.writeLong(network_time);
-        writeHashtable(down, out);
-        writeHashtable(up, out);
-    }
-
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        sender=in.readObject();
-        receiver=in.readObject();
-        start_time=in.readLong();
-        end_time=in.readLong();
-        network_send=in.readLong();
-        network_recv=in.readLong();
-        network_time=in.readLong();
-        down=readHashtable(in);
-        up=readHashtable(in);
-    }
-
-
-    @Override // GemStoneAddition
-    public long size(short version) {
-        return size;
-    }
-
-
-    void writeHashtable(HashMap h, ObjectOutput out) {
-        String key;
-        PerfEntry val;
-
-        try {
-            if(h == null) {
-                out.writeInt(0);
-                return;
-            }
-            out.writeInt(h.size());
-            for(Iterator it=h.entrySet()/*keySet() GemStoneAddition*/.iterator(); it.hasNext();) {
-//                key=(String)it.next();
-//                val=(PerfEntry)h.get(key);
-                Map.Entry entry = (Map.Entry)it.next(); // GemStoneAddition
-                key = (String)entry.getKey();
-                val = (PerfEntry)entry.getValue();
-                if(key == null || val == null) {
-                    System.err.println("PerfHeader.writeHashtable(): key or val is null");
-                    continue;
-                }
-                out.writeObject(key);
-                out.writeObject(val);
-            }
-        }
-        catch(Exception ex) {
-            System.err.println("PerfHeader.writeHashtable(): " + ex);
-        }
-    }
-
-
-    HashMap readHashtable(ObjectInput in) {
-        HashMap h=new HashMap();
-        int num=0;
-        String key;
-        PerfEntry val;
-
-        try {
-            num=in.readInt();
-            if(num == 0)
-                return h;
-            for(int i=0; i < num; i++) {
-                key=(String)in.readObject();
-                val=(PerfEntry)in.readObject();
-                h.put(key, val);
-            }
-        }
-        catch(Exception ex) {
-            System.err.println("PerfHeader.readHashtable(): " + ex);
-        }
-
-        return h;
-    }
-
-
-    PerfEntry getEntry(String prot_name, int type) {
-        HashMap tmp=null;
-        PerfEntry entry=null;
-
-        if(prot_name == null) return null;
-        if(type == UP)
-            tmp=up;
-        else
-            if(type == DOWN) tmp=down;
-        if(tmp == null) return null;
-        entry=(PerfEntry)tmp.get(prot_name);
-        if(entry == null)
-            log.error(ExternalStrings.PerfHeader_PERFHEADERGETENTRY_PROTOCOL__0__NOT_FOUND, prot_name);
-        return entry;
-    }
-
-
-    public static void main(String[] args) {
-        PerfHeader hdr=new PerfHeader(), hdr2;
-        Message msg;
-        ByteArrayOutputStream out_stream;
-        ByteArrayInputStream in_stream;
-        ObjectOutputStream out;
-        ObjectInputStream in;
-        byte[] out_buf, in_buf;
-
-
-        hdr.addEntry("GMS");
-        hdr.addEntry("GMS");
-        hdr.addEntry("FRAG");
-        hdr.addEntry("FRAG");
-        hdr.addEntry("UDP");
-        hdr.addEntry("UDP");
-
-
-        msg=new Message();
-        msg.putHeader("PERF", hdr);
-
-        try { // GemStoneAddition
-        hdr.setReceived("GMS", PerfHeader.DOWN);
-        Util.sleep(2);
-        hdr.setDone("GMS", PerfHeader.DOWN);
-
-        hdr.setReceived("FRAG", PerfHeader.DOWN);
-        Util.sleep(20);
-        hdr.setDone("FRAG", PerfHeader.DOWN);
-
-
-        long len=msg.size();
-        System.out.println("Size is " + len);
-
-
-        hdr.setReceived("UDP", PerfHeader.DOWN);
-        Util.sleep(12);
-        hdr.setDone("UDP", PerfHeader.DOWN);
-
-
-        Util.sleep(30);
-
-        hdr.setReceived("UDP", PerfHeader.UP);
-        hdr.setDone("UDP", PerfHeader.UP);
-
-        hdr.setReceived("FRAG", PerfHeader.UP);
-        Util.sleep(23);
-        hdr.setDone("FRAG", PerfHeader.UP);
-
-        hdr.setReceived("GMS", PerfHeader.UP);
-        Util.sleep(3);
-        hdr.setDone("GMS", PerfHeader.UP);
-
-
-        hdr.setEndTime();
-
-        System.out.println(hdr.printContents(true));
-
-        try {
-            System.out.println("Saving hdr to byte buffer");
-            out_stream=new ByteArrayOutputStream(256);
-            out=new ObjectOutputStream(out_stream);
-            out.writeObject(msg);
-            out_buf=out_stream.toByteArray();
-
-            System.out.println("Constructing hdr2 from byte buffer");
-            in_buf=out_buf; // ref
-
-            in_stream=new ByteArrayInputStream(in_buf);
-            in=new ObjectInputStream(in_stream);
-
-            msg2=(Message)in.readObject();
-            hdr2=(PerfHeader)msg2.removeHeader("PERF");
-            System.out.println(hdr2.printContents(true));
-        }
-        catch(Exception ex) {
-            log.error(ex);
-        }
-
-
-    }
-    catch (InterruptedException e) {
-      // We're in a main.  Nothing to do; just exit.
-    }
-    
-    }
-}
-
-
-/**
- * Entry specific for 1 protocol layer. Records time message was received by that layer and when message was passed on
- */
-class PerfEntry implements Externalizable {
-    long received=0;
-    long done=0;
-    long total=-1;
-
-
-    // Needed for externalization
-    public PerfEntry() {
-
-    }
-
-
-    public long getReceived() {
-        return received;
-    }
-
-    public long getDone() {
-        return done;
-    }
-
-    public long getTotal() {
-        return total;
-    }
-
-    public void setReceived(long r) {
-        received=r;
-    }
-
-    public void setDone(long d) {
-        done=d;
-        if(received > 0 && done > 0 && done >= received)
-            total=done - received;
-    }
-
-    @Override // GemStoneAddition
-    public String toString() {
-        if(total >= 0)
-            return "time: " + total;
-        else
-            return "time: n/a";
-    }
-
-
-    public String printContents(boolean detailed) {
-        StringBuffer sb=new StringBuffer();
-        if(detailed) {
-            if(received > 0) sb.append("received=").append(received);
-            if(done > 0) {
-                if(received > 0) sb.append(", ");
-                sb.append("done=").append(done);
-            }
-        }
-        if(detailed && (received > 0 || done > 0)) sb.append(", ");
-        sb.append(toString());
-        return sb.toString();
-    }
-
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(received);
-        out.writeLong(done);
-        out.writeLong(total);
-    }
-
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        received=in.readLong();
-        done=in.readLong();
-        total=in.readLong();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingHeader.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingHeader.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingHeader.java
deleted file mode 100644
index a20f497..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingHeader.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: PingHeader.java,v 1.10 2005/04/26 15:22:13 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-import com.gemstone.org.jgroups.Global;
-import com.gemstone.org.jgroups.Header;
-import com.gemstone.org.jgroups.util.Streamable;
-import com.gemstone.org.jgroups.util.Util;
-
-import java.io.*;
-
-
-public class PingHeader extends Header implements Streamable {
-    public static final byte GET_MBRS_REQ=1;   // arg = null
-    public static final byte GET_MBRS_RSP=2;   // arg = PingRsp(local_addr, coord_addr)
-
-    public byte type=0;
-    public PingRsp arg=null;
-
-    public PingHeader() {
-    } // for externalization
-
-    public PingHeader(byte type, PingRsp arg) {
-        this.type=type;
-        this.arg=arg;
-    }
-
-    @Override // GemStoneAddition
-    public long size(short version) {
-        long retval=Global.BYTE_SIZE *2; // type and presence
-        if(arg != null) {
-            retval+=arg.size(version);
-        }
-        return retval;
-    }
-
-    @Override // GemStoneAddition
-    public String toString() {
-        return "[PING: type=" + type2Str(type) + ", arg=" + arg + ']';
-    }
-
-    String type2Str(byte t) {
-        switch(t) {
-            case GET_MBRS_REQ:
-                return "GET_MBRS_REQ";
-            case GET_MBRS_RSP:
-                return "GET_MBRS_RSP";
-            default:
-                return "<unknown type (" + t + ")>";
-        }
-    }
-
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeByte(type);
-        out.writeObject(arg);
-    }
-
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        type=in.readByte();
-        arg=(PingRsp)in.readObject();
-    }
-
-    public void writeTo(DataOutputStream outstream) throws IOException {
-        outstream.writeByte(type);
-        Util.writeStreamable(arg, outstream);
-    }
-
-    public void readFrom(DataInputStream instream) throws IOException, IllegalAccessException, InstantiationException {
-        type=instream.readByte();
-        arg=(PingRsp)Util.readStreamable(PingRsp.class, instream);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingRsp.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingRsp.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingRsp.java
deleted file mode 100644
index 826eb1e..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingRsp.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: PingRsp.java,v 1.9 2005/08/08 12:45:43 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-import com.gemstone.org.jgroups.Address;
-import com.gemstone.org.jgroups.Global;
-import com.gemstone.org.jgroups.util.Streamable;
-import com.gemstone.org.jgroups.util.Util;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-
-
-public class PingRsp implements Serializable, Streamable {
-    public Address own_addr=null;
-    public Address coord_addr=null;
-    public boolean is_server=false;
-    private static final long serialVersionUID=3634334590904551586L;
-
-    public PingRsp() {
-        // externalization
-    }
-
-    public PingRsp(Address own_addr, Address coord_addr, boolean is_server) {
-        this.own_addr=own_addr;
-        this.coord_addr=coord_addr;
-        this.is_server=is_server;
-    }
-
-    @Override // GemStoneAddition
-    public boolean equals(Object obj) {
-        if (obj == null || !(obj instanceof PingRsp)) return false; // GemStoneAddition
-        PingRsp other=(PingRsp)obj;
-        return own_addr != null && other.own_addr != null && own_addr.equals(other.own_addr);
-    }
-    
-    /*
-     * (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 (this.own_addr != null) {
-        result += own_addr.hashCode();
-      }
-      return result;
-    }
-
-    public boolean isCoord() {
-        if(!is_server)
-            return false;
-        if(own_addr != null && coord_addr != null)
-            return own_addr.equals(coord_addr);
-        return false;
-    }
-
-    public int size(short version) {
-        int retval=Global.BYTE_SIZE *3; // for is_server, plus 2 presence bytes
-        retval+=2 * Global.BYTE_SIZE;   // 1 boolean for each address: IpAddress or other address ?
-        if(own_addr != null)
-            retval+=own_addr.size(version);
-        if(coord_addr != null)
-            retval+=coord_addr.size(version);
-        return retval;
-    }
-
-    public Address getAddress() {
-        return own_addr;
-    }
-
-    public Address getCoordAddress() {
-        return coord_addr;
-    }
-
-    public boolean isServer() {
-        return is_server;
-    }
-
-    @Override // GemStoneAddition
-    public String toString() {
-        return new StringBuffer("[own_addr=").append(own_addr).append(", coord_addr=").append(coord_addr).
-                append(", is_server=").append(is_server).append(']').toString();
-    }
-
-    public void writeTo(DataOutputStream outstream) throws IOException {
-        Util.writeAddress(own_addr, outstream);
-        Util.writeAddress(coord_addr, outstream);
-        outstream.writeBoolean(is_server);
-    }
-
-    public void readFrom(DataInputStream instream) throws IOException, IllegalAccessException, InstantiationException {
-        own_addr=Util.readAddress(instream);
-        coord_addr=Util.readAddress(instream);
-        is_server=instream.readBoolean();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingSender.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingSender.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingSender.java
deleted file mode 100644
index 4bf2eb3..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingSender.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-package com.gemstone.org.jgroups.protocols;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.ShunnedAddressException;
-import com.gemstone.org.jgroups.util.GemFireTracer;
-import com.gemstone.org.jgroups.util.Util;
-
-/**
- * Sends num_ping_request GET_MBRS_REQ messages, distributed over timeout ms
- * @author Bela Ban
- * @version $Id: PingSender.java,v 1.5 2005/08/11 12:43:47 belaban Exp $
- */
-public class PingSender implements Runnable {
-    // GemStoneAddition: accesses to #t must be synchronized on this.
-    Thread              t=null;
-//    long                timeout=3000; GemStoneAddition
-    double              interval;
-    int                 num_requests=1;
-    Discovery           discovery_prot;
-    protected final GemFireTracer log=GemFireTracer.getLog(this.getClass());
-    protected boolean   trace=log.isTraceEnabled();
-    private AtomicBoolean waiter_sync; // GemStoneAddition
-
-
-    public PingSender(long timeout, int num_requests, Discovery d) {
-//        this.timeout=timeout; GemStoneAddition
-        this.num_requests=num_requests;
-        this.discovery_prot=d;
-        interval=timeout / (double)num_requests;
-    }
-
-    /** GemStoneAddition - a synchronization object that is used to block
-        the waiter until the discovery protocol gives the go-ahead.
-        This is to fix bug 34274 */
-    public void setSync(AtomicBoolean waiter_sync) {
-      this.waiter_sync = waiter_sync;
-    }
-
-    public synchronized void start() {
-        if(t == null || !t.isAlive()) {
-            t=new Thread(GemFireTracer.GROUP, this, "PingSender");
-            t.setDaemon(true);
-            t.start();
-        }
-    }
-
-    public synchronized void stop() {
-        if(t != null) {
-            Thread tmp=t;
-            t=null;
-            try {tmp.interrupt();} catch(SecurityException ex) {}
-        }
-    }
-
-
-    public synchronized boolean isRunning() {
-        return t != null && t.isAlive();
-    }
-
-
-
-    public void run() {
-        RuntimeException gfe = null;
-        boolean anysuccess = false;
-        
-        for(int i=0; i < num_requests && !Thread.currentThread().isInterrupted(); i++) {
-          if (Thread.currentThread().isInterrupted()) break; // GemStoneAddition
-//            if(t == null || !t.equals(Thread.currentThread()))
-//                break;
-            if(trace)
-                log.trace("sending GET_MBRS_REQ");
-            try {
-              // GemStoneAddition
-              // bug #41355 - in case the coordinator exits during discovery,
-              // only allow accelerated discovery on the first attempt 
-              discovery_prot.sendGetMembersRequest(waiter_sync);
-              anysuccess = true; // GemStoneAddition
-              try { // GemStoneAddition
-                Util.sleep((long)interval);
-              }
-              catch (InterruptedException e) {
-                break; // exit the loop and the thread
-              }
-            }
-            catch (ShunnedAddressException ex) {
-              gfe = ex;
-            }
-            catch (RuntimeException ex) {
-              if (ex.getClass().getSimpleName().equals("GemFireConfigException")) {
-                gfe = ex;
-              } else {
-                throw ex;
-              }
-            }
-        }
-        // fix for bug 36066 - only pass up an exit event if
-        // we never contact a locator
-        if (!anysuccess) {
-          discovery_prot.passUp(new Event(Event.EXIT, gfe));
-          discovery_prot.wakeWaiter(waiter_sync);  // GemStoneAddition
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingWaiter.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingWaiter.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingWaiter.java
deleted file mode 100644
index 5db4665..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/PingWaiter.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-package com.gemstone.org.jgroups.protocols;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.Vector;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import com.gemstone.org.jgroups.Address;
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.GemFireTracer;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * Class that waits for n PingRsp'es, or m milliseconds to return the initial membership
- * @author Bela Ban
- * @version $Id: PingWaiter.java,v 1.11 2005/08/11 12:43:47 belaban Exp $
- */
-public class PingWaiter implements Runnable {
-    public static boolean TEST_HOOK_IGNORE_REQUIRED_RESPONSE = false;
-    Object tLock = new Object(); // GemStoneAddition - guards "t"
-    Thread              t=null;
-    final List          rsps=new LinkedList();
-    long                timeout=3000;
-    volatile int       num_rsps=3; // GemStoneAddition - volatile
-    Protocol            parent=null;
-    PingSender          ping_sender;
-    protected final GemFireTracer log=GemFireTracer.getLog(this.getClass());
-    private boolean     trace=log.isTraceEnabled();
-    private volatile int num_servers_received; // GemStoneAddition
-    private volatile Address coordinator; // GemStoneAddition
-    private volatile Set<Address> requiredResponses = Collections.EMPTY_SET; // GemStoneAddition
-    private volatile Set<Address> requiredResponsesReceived = new HashSet<Address>();
-
-
-    public PingWaiter(long timeout, int num_rsps, Protocol parent, PingSender ping_sender) {
-        this.timeout=timeout;
-        this.num_rsps=num_rsps;
-        this.parent=parent;
-        this.ping_sender=ping_sender;
-    }
-
-
-    void setTimeout(long timeout) {
-        this.timeout=timeout;
-    }
-
-    void setNumRsps(int num) {
-        this.num_rsps=num;
-    }
-    
-    /**
-     * GemStoneAddition - bypass get_mbrs work if the gossipserver thinks 
-     * it knows who the coordinator is.
-     * @param theCoordinator the coordinator's address
-     */
-    void setCoordinator(Address theCoordinator) {
-      this.coordinator = theCoordinator;
-      if (theCoordinator != null) {
-        this.requiredResponses = Collections.EMPTY_SET;
-      }
-    }
-
-
-    public synchronized void start() {
-        // ping_sender.start();
-      synchronized (tLock) { // GemStoneAddition
-        if(t == null || !t.isAlive()) {
-            t=new Thread(GemFireTracer.GROUP, this, "PingWaiter");
-            t.setDaemon(true);
-            t.start();
-        }
-    }
-    }
-
-    public synchronized void stop() {
-        if(ping_sender != null)
-            ping_sender.stop();
-        Thread thr = null;
-        synchronized (tLock) { // GemStoneAddition
-          thr = t;
-        }
-        if (thr != null) {
-            thr.interrupt();
-            synchronized(rsps) {
-               rsps.notifyAll();
-            }
-        }
-    }
-
-
-    public synchronized boolean isRunning() {
-      synchronized (tLock) {
-        return t != null && t.isAlive();
-      }
-    }
-    
-    public void setRequiredResponses(Set<Address> addresses) {
-      this.requiredResponses = addresses;
-      this.requiredResponsesReceived.clear();
-    }
-
-    public void addResponse(PingRsp rsp) {
-        if (rsp != null) {
-          if (TEST_HOOK_IGNORE_REQUIRED_RESPONSE) {
-            log.getLogWriter().info(ExternalStrings.DEBUG, "TEST HOOK: required responses are " + this.requiredResponses);
-            if (this.requiredResponses.contains(rsp.own_addr)) {
-              log.getLogWriter().info(ExternalStrings.DEBUG, "TEST HOOK: ignoring response from " + rsp.own_addr);
-              return;
-            }
-          }
-            if (trace)
-              log.trace("Received Ping response " + rsp);
-            synchronized(rsps) {
-                if(rsps.contains(rsp))
-                    rsps.remove(rsp); // overwrite existing element
-                rsps.add(rsp);
-                if (rsp.is_server) { // GemStoneAddition - track number of actual members responding
-                  num_servers_received++;
-                }
-                if (this.requiredResponses.contains(rsp.own_addr)) {
-                  this.requiredResponsesReceived.add(rsp.own_addr);
-                  if (trace)
-                    log.trace("Received "
-                      + this.requiredResponsesReceived.size() + " of "
-                      + this.requiredResponses.size()
-                      + " required ping responses");
-                }
-                rsps.notifyAll();
-//log.getLogWriter().warning("Added Ping response to list");
-            }
-        }
-    }
-
-    public void clearResponses() {
-        if (trace) {
-          log.trace("<PingWaiter> clearing responses for a new attempt");
-        }
-        synchronized(rsps) {
-            rsps.clear();
-            num_servers_received = 0; // GemStoneAddition
-            rsps.notifyAll();
-            this.coordinator = null;
-            this.requiredResponses = Collections.emptySet();
-            this.requiredResponsesReceived = new HashSet<Address>();
-        }
-    }
-
-
-    // GemStoneAddition - this method is too dangerous - it should synch on rsps and return a copy
-//    public List getResponses() {
-//        return rsps;
-//    }
-
-
-
-    public void run() {
-        // GemStoneAddition - debugging 34274
-        //log.info("findInitialMembers starting");
-        Vector responses=findInitialMembers();
-        //log.info("findInitialMembers found " + responses.size() + " members");
-        synchronized (tLock) {
-          t = null; // GemStoneAddition - need to null out so it can be started again in ClientGmsImpl's thread (bug 34274)
-        }
-        if(parent != null) {
-          // GemStoneAddition - make sure required responses have all been received
-          if (log.getLogWriter().fineEnabled()) {
-            log.getLogWriter().fine("PingWaiter: required responses="+this.requiredResponses
-                +"; received="+this.requiredResponsesReceived
-                +"; responses="+responses);
-          }
-          if (this.requiredResponses.size() != this.requiredResponsesReceived.size()) {
-            Set missing = new HashSet(this.requiredResponses);
-            missing.removeAll(this.requiredResponsesReceived);
-            if (log.getLogWriter().fineEnabled()) {
-              log.getLogWriter().fine("Find Initial Members failed.  missing responses = " + missing);
-            }
-            parent.passUp(new Event(Event.FIND_INITIAL_MBRS_FAILED, missing));
-          } else {
-            if (log.getLogWriter().fineEnabled()) {
-              log.getLogWriter().fine("Find Initial Members completed.");
-            }
-            parent.passUp(new Event(Event.FIND_INITIAL_MBRS_OK, responses));
-          }
-        }
-    }
-
-
-    @SuppressFBWarnings(value="TLW_TWO_LOCK_WAIT", justification="the code is correct")
-    public Vector findInitialMembers() {
-        long start_time, time_to_wait;
-
-        synchronized(rsps) {
-            if(num_servers_received >= num_rsps && rsps.size() > 0) { // GemStoneAddition - only clear if we satisfied the server count last time
-                rsps.clear();
-                num_servers_received = 0; // GemStoneAddition
-            }
-
-            AtomicBoolean sync = new AtomicBoolean();
-            
-            // GemStoneAddition - block this thread until the discovery
-            // protocol is ready for the timeout to start counting down
-            this.coordinator = null;
-            ping_sender.setSync(sync);
-            while (!sync.get()) {
-              synchronized(sync) {
-                clearResponses(); // GemStoneAddition - don't accumulate old junk
-                ping_sender.start();
-                try { sync.wait();  } catch (InterruptedException ie) {
-                  Thread.currentThread().interrupt();
-  //log.getLogWriter().warning("findInitialMembers interrupted - returning empty set");
-                  return new Vector();
-                }
-              }
-            }
-
-            start_time=System.currentTimeMillis();
-            time_to_wait=timeout;
-
-            try {
-                // GemStoneAddition - don't stop waiting until a requisite number
-                // of members is received.  Non-members don't know who their
-                // coordinator really is and will be used by the GMS as a last
-                // resort to elect a concurrently starting member.  In that case,
-                // we want the max number of responses we can get
-              Thread tTmp;
-              synchronized (tLock) { // GemStoneAddition
-                tTmp = t;
-              }
-                while((time_to_wait > 0)  &&  (tTmp != null)
-                       && ((requiredResponsesReceived.size() != requiredResponses.size())
-                            || (num_servers_received < num_rsps))) {
-                  if (this.coordinator != null) { // GemStoneAddition - shortcut get_mbrs phase
-                    PingRsp ping_rsp=new PingRsp(this.coordinator, this.coordinator, true);
-                    rsps.add(ping_rsp);
-                    this.coordinator = null;
-                    break;
-                  }
-
-                  if(trace) // +++ remove
-                        log.trace(new StringBuffer("waiting for initial members: time_to_wait=").append(time_to_wait)
-                                  .append(", got ").append(rsps.size()).append(" rsps"));
-
-                    try {
-                        rsps.wait(time_to_wait);
-                    }
-                    catch(InterruptedException intex) {
-                      Thread.currentThread().interrupt(); // GemStoneAddition
-                      break; // GemStoneAddition -- treat like timeout
-                    }
-                    catch(Exception e) {
-                        log.error(ExternalStrings.PingWaiter_GOT_AN_EXCEPTION_WAITING_FOR_RESPONSES, e);
-                    }
-                    time_to_wait=timeout - (System.currentTimeMillis() - start_time);
-                }
-                if(trace)
-                    log.info(ExternalStrings.PingWaiter_INITIAL_MEMBERS_ARE_0, rsps); 
-// GemStoneAddition - DEBUGGING
-//log.getLogWriter().warning("time_to_wait=" + time_to_wait
-//    + " num_servers_received=" + num_servers_received + " initial_mbrs=" + rsps);
-                return new Vector(rsps);
-            }
-            finally {
-//                if(ping_sender != null) GemStoneAddition (cannot be null)
-                    ping_sender.stop();
-            }
-        }
-    }
-    
-    // GemStoneAddition - get the coordinator that would be selected by ClientGmsImpl
-    // if the concurrent selection algorithm were used for election
-    public Address getPossibleCoordinator(Address local_addr) {
-      Set clients=new TreeSet();
-      clients.add(local_addr);
-      final Vector initial_mbrs;
-      synchronized (rsps) {
-        initial_mbrs = new Vector(rsps);
-      }
-      if (initial_mbrs.size() == 0) {
-        return local_addr;
-      }
-      for(int i=0; i < initial_mbrs.size(); i++) {
-          PingRsp pingRsp=(PingRsp)initial_mbrs.elementAt(i);
-          Address client_addr=pingRsp.getCoordAddress();
-          if(client_addr != null)
-              clients.add(client_addr);
-      }
-      return (Address)clients.iterator().next();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/QUEUE.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/QUEUE.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/QUEUE.java
deleted file mode 100644
index 65e3559..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/QUEUE.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: QUEUE.java,v 1.8 2005/08/08 12:45:43 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-import com.gemstone.org.jgroups.Event;
-//import com.gemstone.org.jgroups.Message;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.util.Util;
-
-import java.util.Vector;
-
-
-/**
- * Queuing layer. Upon reception of event START_QUEUEING, all events traveling through
- * this layer upwards/downwards (depending on direction of event) will be queued. Upon
- * reception of a STOP_QUEUEING event, all events will be released. Finally, the
- * queueing flag is reset.
- * When queueing, only event STOP_QUEUEING (received up or downwards) will be allowed
- * to release queueing.
- * @author Bela Ban
- */
-
-public class QUEUE extends Protocol  {
-    final Vector    up_vec=new Vector();
-    final Vector    dn_vec=new Vector();
-    boolean   queueing_up=false, queueing_dn=false;
-    Observer  my_observer=null;
-
-
-    public interface Observer {
-	/** Called before event is added. Blocks until call returns.
-	    @param evt The event
-	    @param num_events The number of events in the up vector <em>before</em>
-	    this event is added
-	    @return boolean True if event should be added. False if it should be discarded */
-	boolean addingToUpVector(Event evt, int num_events);
-
-	/** Called before event is added. Blocks until call returns.
-	    @param evt The event
-	    @param num_events The number of events in the down vector <em>before</em>
-	    this event is added
-	    @return boolean True if event should be added. False if it should be discarded */
-	boolean addingToDownVector(Event evt, int num_events);
-    }
-
-    /** Only 1 observer is allowed. More than one might slow down the system. Will be called
-	when an event is queued (up or down) */
-    public void setObserver(Observer observer) {this.my_observer=observer;}
-
-    public Vector  getUpVector()     {return up_vec;}
-    public Vector  getDownVector()   {return dn_vec;}
-    public boolean getQueueingUp()   {return queueing_up;}
-    public boolean getQueueingDown() {return queueing_dn;}
-
-
-    /** All protocol names have to be unique ! */
-    @Override // GemStoneAddition  
-    public String  getName() {return "QUEUE";}
-
-
-    @Override // GemStoneAddition  
-    public Vector providedUpServices() {
-	Vector ret=new Vector();
-	ret.addElement(Integer.valueOf(Event.START_QUEUEING));
-	ret.addElement(Integer.valueOf(Event.STOP_QUEUEING));
-	return ret;
-    }
-
-    @Override // GemStoneAddition  
-    public Vector providedDownServices() {
-	Vector ret=new Vector();
-	ret.addElement(Integer.valueOf(Event.START_QUEUEING));
-	ret.addElement(Integer.valueOf(Event.STOP_QUEUEING));
-	return ret;
-    }
-
-
-
-
-    /**
-       Queues or passes up events. No queue sync. necessary, as this method is never called
-       concurrently.
-     */
-    @Override // GemStoneAddition  
-    public void up(Event evt) {
-//	Message msg; GemStoneAddition
-	Vector  event_list;  // to be passed up *before* replaying event queue
-	Event   e;
-
-
-	switch(evt.getType()) {
-
-	case Event.START_QUEUEING:  // start queueing all up events
-	     if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_RECEIVED_START_QUEUEING);
-	    queueing_up=true;
-	    return;
-
-	case Event.STOP_QUEUEING:         // stop queueing all up events
-	    event_list=(Vector)evt.getArg();
-	    if(event_list != null)
-		for(int i=0; i < event_list.size(); i++)
-		    passUp((Event)event_list.elementAt(i));
-	    
-	     if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_REPLAYING_UP_EVENTS);
-	    
-	    for(int i=0; i < up_vec.size(); i++) {
-		e=(Event)up_vec.elementAt(i);
-		passUp(e);
-	    }
-
-	    up_vec.removeAllElements();
-	    queueing_up=false;
-	    return;
-	}
-	
-	if(queueing_up) {
-        if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_QUEUED_UP_EVENT__0, evt);
-        if(my_observer != null) {
-        if(my_observer.addingToUpVector(evt, up_vec.size()) == false)
-            return;  // discard event (don't queue)
-        }
-	    up_vec.addElement(evt);
-	}
-	else
-	    passUp(evt);            // Pass up to the layer above us
-    }
-
-
-
-
-    
-    @Override // GemStoneAddition  
-    public void down(Event evt) {
-//	Message msg; GemStoneAddition
-	Vector  event_list;  // to be passed down *before* replaying event queue
-
-	switch(evt.getType()) {
-	    
-	case Event.START_QUEUEING:  // start queueing all down events
-	     if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_RECEIVED_START_QUEUEING);
-	    queueing_dn=true;
-	    return;
-
-	case Event.STOP_QUEUEING:         // stop queueing all down events	    
-	     if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_RECEIVED_STOP_QUEUEING);
-	    event_list=(Vector)evt.getArg();
-	    if(event_list != null)  // play events first (if available)
-		for(int i=0; i < event_list.size(); i++)
-		    passDown((Event)event_list.elementAt(i));
-	    
-	     if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_REPLAYING_DOWN_EVENTS__0, dn_vec.size());
-	    
-	    for(int i=0; i < dn_vec.size(); i++) {
-		passDown((Event)dn_vec.elementAt(i));
-	    }
-
-	    dn_vec.removeAllElements();
-	    queueing_dn=false;
-	    return;
-  	}
-	    
-	if(queueing_dn) {
-
-		if(log.isInfoEnabled()) log.info(ExternalStrings.QUEUE_QUEUED_DOWN_EVENT__0, Util.printEvent(evt));
-
-	    if(my_observer != null) {
-		if(my_observer.addingToDownVector(evt, dn_vec.size()) == false)
-		    return;  // discard event (don't queue)
-	    }
-	    dn_vec.addElement(evt);
-	}
-	else
-	    passDown(evt);          // Pass up to the layer below us
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/RpcProtocolEXAMPLE.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/RpcProtocolEXAMPLE.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/RpcProtocolEXAMPLE.java
deleted file mode 100644
index 55f9566..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/RpcProtocolEXAMPLE.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: RpcProtocolEXAMPLE.java,v 1.2 2004/03/30 06:47:21 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-
-
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.stack.RpcProtocol;
-
-
-
-/**
-
- */
-public class RpcProtocolEXAMPLE extends RpcProtocol {
-
-  @Override // GemStoneAddition
-    public String  getName() {return "RpcProtocolEXAMPLE";}
-
-
-
-
-    /* ------------------------- Request handler methods ----------------------------- */
-
-
-    // Your methods, e.g.
-
-    public void foo() {}
-    public Object bar(int a, int b) {return null;}
-
-
-    /* --------------------- End of Request handler methods -------------------------- */
-
-
-
-
-    
-    /**
-       <b>Callback</b>. Called by superclass when event may be handled.<p>
-       <b>Do not use <code>PassUp</code> in this method as the event is passed up
-       by default by the superclass after this method returns !</b>
-       @return boolean Defaults to true. If false, event will not be passed up the stack.
-     */
-    @Override // GemStoneAddition
-    public boolean handleUpEvent(Event evt) {return true;}
-
-
-    /**
-       <b>Callback</b>. Called by superclass when event may be handled.<p>
-       <b>Do not use <code>PassDown</code> in this method as the event is passed down
-       by default by the superclass after this method returns !</b>
-       @return boolean Defaults to true. If false, event will not be passed down the stack.
-    */
-    @Override // GemStoneAddition
-    public boolean handleDownEvent(Event evt) {return true;}
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SHUFFLE.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SHUFFLE.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SHUFFLE.java
deleted file mode 100644
index 3231f3a..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SHUFFLE.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-package com.gemstone.org.jgroups.protocols;
-
-
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.Message;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-
-import java.util.*;
-
-
-
-/**
- * This layer shuffles upcoming messages, put it just above your bottom layer.
- * If you system sends less than 2 messages per sec you can notice a latency due
- * to this layer.
- *
- * @author Gianluca Collot
- *
- */
-
-public class SHUFFLE extends Protocol implements Runnable {
-
-    String       name="SHUFFLE";
-    final List         messages;
-    Thread       messagesHandler; // GemStoneAddition - accesses synchronized on this
-
-    public SHUFFLE() {
-        messages = Collections.synchronizedList(new ArrayList());
-    }
-
-    @Override // GemStoneAddition
-    public String getName() {
-        return name;
-    }
-
-    @Override // GemStoneAddition
-    public boolean setProperties(Properties props) {
-        String     str;
-
-        super.setProperties(props);
-        str=props.getProperty("name");
-        if(str != null) {
-            name=str;
-            props.remove("name");
-        }
-
-        if(props.size() > 0) {
-            log.error(ExternalStrings.SHUFFLE_DUMMYSETPROPERTIES_THESE_PROPERTIES_ARE_NOT_RECOGNIZED__0, props);
-
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Adds upcoming messages to the <code>messages List<\code> where the <code>messagesHandler<\code>
-     * retrieves them.
-     */
-
-    @Override // GemStoneAddition
-    public void up(Event evt) {
-        Message msg;
-
-        switch (evt.getType()) {
-
-	case Event.MSG:
-            msg=(Message)evt.getArg();
-            // Do something with the event, e.g. extract the message and remove a header.
-            // Optionally pass up
-            messages.add(msg);
-            return;
-        }
-
-        passUp(evt);            // Pass up to the layer above us
-    }
-
-
-
-
-    /**
-     * Starts the <code>messagesHandler<\code>
-     */
-    @Override // GemStoneAddition
-    synchronized /* GemStoneAddition */ public void start() throws Exception {
-        messagesHandler = new Thread(this,"MessagesHandler");
-        messagesHandler.setDaemon(true);
-        messagesHandler.start();
-    }
-
-    /**
-     * Stops the messagesHandler
-     */
-    @Override // GemStoneAddition
-    synchronized /* GemStoneAddition */ public void stop() {
-        Thread tmp = messagesHandler;
-        messagesHandler = null;
-        if (tmp != null) { // GemStoneAddition
-          tmp.interrupt(); // GemStoneAddition
-        try {
-            tmp.join();
-        } catch (InterruptedException ex) {ex.printStackTrace(); Thread.currentThread().interrupt(); /*GemStoneAddition*/}
-        }
-    }
-
-    /**
-     * Removes a random chosen message from the <code>messages List<\code> if there
-     * are less than 10 messages in the List it waits some time to ensure to chose from
-     * a set of messages > 1.
-     */
-
-    public void run() {
-        Message msg;
-        for (;;) { // GemStoneAddition -- remove coding anti-pattern
-          if (Thread.currentThread().isInterrupted()) break; // GemStoneAddition
-            if ( messages.size() > 0 ) {
-                msg = (Message) messages.remove(rnd(messages.size()));
-                passUp(new Event(Event.MSG,msg));
-            }
-            if (messages.size() < 5) {
-                try {
-                    Thread.sleep(300); // @todo make this time user configurable
-                }
-                catch (InterruptedException ex) { // GemStoneAddition
-                  Thread.currentThread().interrupt(); // GemStoneAddition
-                  return; // GemStoneAddition - exit loop and thread
-//                    ex.printStackTrace();
-                }
-            }
-        }// while
-        // PassUp remaining messages
-        Iterator iter = messages.iterator();
-        while (iter.hasNext()) {
-            msg = (Message) iter.next();
-            passUp(new Event(Event.MSG,msg));
-        }
-    }
-
-    // random integer between 0 and n-1
-    int rnd(int n) { return (int)(Math.random()*n); }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SIZE.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SIZE.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SIZE.java
deleted file mode 100644
index 2f9ada0..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SIZE.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: SIZE.java,v 1.15 2005/08/11 12:43:47 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.Message;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.util.Util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Vector;
-
-
-/**
- * Protocol which prints out the real size of a message. To do this, the message
- * is serialized into a byte buffer and its size read. Don't use this layer in
- * a production stack since the costs are high (just for debugging).
- * 
- * @author Bela Ban June 13 2001
- */
-public class SIZE extends Protocol  {
-    final Vector members=new Vector();
-    boolean print_msg=false;
-    boolean raw_buffer=false; // just print size of message buffer
-
-    /** Min size in bytes above which msgs should be printed */
-    long min_size=0;
-
-    final ByteArrayOutputStream out_stream=new ByteArrayOutputStream(65535);
-
-
-    /**
-     * All protocol names have to be unique !
-     */
-    @Override // GemStoneAddition  
-    public String getName() {
-        return "SIZE";
-    }
-
-
-    @Override // GemStoneAddition  
-    public void init() {
-    }
-
-
-    /**
-     * Setup the Protocol instance acording to the configuration string
-     */
-    @Override // GemStoneAddition  
-    public boolean setProperties(Properties props) {super.setProperties(props);
-        String str;
-
-        str=props.getProperty("print_msg");
-        if(str != null) {
-            print_msg=Boolean.valueOf(str).booleanValue();
-            props.remove("print_msg");
-        }
-
-        str=props.getProperty("raw_buffer");
-        if(str != null) {
-            raw_buffer=Boolean.valueOf(str).booleanValue();
-            props.remove("raw_buffer");
-        }
-
-        str=props.getProperty("min_size");
-        if(str != null) {
-            min_size=Integer.parseInt(str);
-            props.remove("min_size");
-        }
-
-        if(props.size() > 0) {
-            log.error(ExternalStrings.SIZE_THE_FOLLOWING_PROPERTIES_ARE_NOT_RECOGNIZED__0, props);
-
-            return false;
-        }
-        return true;
-    }
-
-
-    @Override // GemStoneAddition  
-    public void up(Event evt) {
-        Message msg;
-        int payload_size=0, serialized_size;
-
-        switch(evt.getType()) {
-
-        case Event.MSG:
-            msg=(Message)evt.getArg();
-            payload_size=msg.getLength();
-
-            if(raw_buffer) {
-                if(trace)
-                    log.trace("size of message buffer is " + payload_size + ", " + numHeaders(msg) + " headers");
-            }
-            else {
-                serialized_size=sizeOf(msg);
-                if(serialized_size > min_size) {
-                    if(trace)
-                        log.trace("size of serialized message is " + serialized_size +
-                                  ", " + numHeaders(msg) + " headers");
-
-                }
-            }
-            if(print_msg) {
-                if(trace)
-                    log.trace("headers are " + msg.getHeaders() + ", payload size=" + payload_size);
-            }
-            break;
-        }
-
-        passUp(evt);            // pass up to the layer above us
-    }
-
-
-    @Override // GemStoneAddition  
-    public void down(Event evt) {
-        Message msg;
-        int payload_size=0, serialized_size;
-
-        switch(evt.getType()) {
-
-            case Event.MSG:
-            msg=(Message)evt.getArg();
-            payload_size=msg.getLength();
-
-            if(raw_buffer) {
-                if(trace)
-                    log.trace("size of message buffer is " + payload_size + ", " + numHeaders(msg) + " headers");
-            }
-            else {
-                serialized_size=sizeOf(msg);
-                if(serialized_size > min_size) {
-                    if(trace)
-                        log.trace("size of serialized message is " + serialized_size + ", " + numHeaders(msg) + " headers");
-
-                }
-            }
-            if(print_msg) {
-                if(trace)
-                    log.trace("headers are " + msg.getHeaders() + ", payload size=" + payload_size);
-            }
-            break;
-        }
-
-        passDown(evt);          // Pass on to the layer below us
-    }
-
-
-    int sizeOf(Message msg) {
-        DataOutputStream out=null;
-
-        synchronized(out_stream) {
-            try {
-                out_stream.reset();
-                out=new DataOutputStream(out_stream);
-                msg.writeTo(out);
-                out.flush();
-                return out_stream.size();
-            }
-            catch(Exception e) {
-                return 0;
-            }
-            finally {
-                Util.closeOutputStream(out);
-            }
-        }
-    }
-
-    int numHeaders(Message msg) {
-        if(msg == null)
-            return 0;
-        Map hdrs=msg.getHeaders();
-        return hdrs !=null? hdrs.size() : 0;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SMACK.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SMACK.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SMACK.java
deleted file mode 100644
index 6ba4dfa..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/SMACK.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: SMACK.java,v 1.12 2005/08/11 12:43:47 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-
-import com.gemstone.org.jgroups.*;
-import com.gemstone.org.jgroups.stack.AckMcastSenderWindow;
-import com.gemstone.org.jgroups.stack.AckReceiverWindow;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.util.Util;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Vector;
-
-
-
-
-// @todo Initial mcast to announce new member (for view change)
-/**
- * Simple Multicast ACK protocol. A positive acknowledgment-based protocol for reliable delivery of
- * multicast messages, which does not need any group membership service.
- * Basically works as follows:
- * <ul>
- * <li>Sender S sends multicast message M</li>
- * <li>When member P receives M, it sends back a unicast ack to S</li>
- * <li>When S receives the ack from P, it checks whether P is in its
- *     membership list. If not, P will be added. This is necessary to retransmit the next message
- *     sent to P.</li>
- * <li>When S sends a multicast message M, all members are added to a
- *     retransmission entry (containing all members to which the message
- *     was sent), which is added to a hashmap (keyed by seqno). Whenever
- *     an ack is received from receiver X, X will be removed from the
- *     retransmission list for the given seqno. When the retransmission
- *     list is empty, the seqno will be removed from the hashmap.</li>
- * <li>A retransmitter thread in the sender periodically retransmits
- *     (either via unicast, or multicast) messages for which no ack has
- *     been received yet</li>
- * <li>When a max number of (unsuccessful) retransmissions have been
- *     exceeded, all remaining members for that seqno are removed from
- *     the local membership, and the seqno is removed from te hashmap,
- *     ceasing all retransmissions</li>
- * </ul>
- * Advantage of this protocol: no group membership necessary, fast.
- * @author Bela Ban Aug 2002
- * @version $Revision: 1.12 $
- * <BR> Fix membershop bug: start a, b, kill b, restart b: b will be suspected by a.
- */
-public class SMACK extends Protocol implements AckMcastSenderWindow.RetransmitCommand {
-    long[]                 timeout={1000,2000,3000};  // retransmit timeouts (for AckMcastSenderWindow)
-//    int                    max_xmits=10;              // max retransmissions (if still no ack, member will be removed) GemStoneAddition (omitted)
-    final Vector                 members=new Vector();      // contains Addresses
-    AckMcastSenderWindow   sender_win=null;
-    final HashMap                receivers=new HashMap();   // keys=sender (Address), values=AckReceiverWindow
-    final HashMap                xmit_table=new HashMap();  // keeps track of num xmits / member (keys: mbr, val:num)
-    Address                local_addr=null;           // my own address
-    long                   seqno=1;                   // seqno for msgs sent by this sender
-    long                   vid=1;                     // for the fake view changes
-    boolean                print_local_addr=true;
-    static final String    name="SMACK";
-    
-    
-
-
-
-    public SMACK() {
-    }
-
-    @Override // GemStoneAddition  
-    public String getName() {
-        return name;
-    }
-
-
-    @Override // GemStoneAddition  
-    public boolean setProperties(Properties props) {
-        String str;
-        long[] tmp;
-
-        super.setProperties(props);
-        str=props.getProperty("print_local_addr");
-        if(str != null) {
-            print_local_addr=Boolean.valueOf(str).booleanValue();
-            props.remove("print_local_addr");
-        }
-
-        str=props.getProperty("timeout");
-        if(str != null) {
-            tmp=Util.parseCommaDelimitedLongs(str);
-            props.remove("timeout");
-            if(tmp != null && tmp.length > 0)
-                timeout=tmp;
-        }
-
-        str=props.getProperty("max_xmits");
-        if(str != null) {
-//            max_xmits=Integer.parseInt(str); GemStoneAddition
-            props.remove("max_xmits");
-        }
-
-
-        if(props.size() > 0) {
-            log.error(ExternalStrings.SMACK_SMACKSETPROPERTIES_THE_FOLLOWING_PROPERTIES_ARE_NOT_RECOGNIZED__0, props);
-
-            return false;
-        }
-        return true;
-    }
-
-
-    @Override // GemStoneAddition  
-    public void stop() {
-        AckReceiverWindow win;
-        if(sender_win != null) {
-            sender_win.stop();
-            sender_win=null;
-        }
-        for(Iterator it=receivers.values().iterator(); it.hasNext();) {
-            win=(AckReceiverWindow)it.next();
-            win.reset();
-        }
-        receivers.clear();
-    }
-
-
-    @Override // GemStoneAddition  
-    public void up(Event evt) {
-        Address sender;
-
-        switch(evt.getType()) {
-
-            case Event.SET_LOCAL_ADDRESS:
-                local_addr=(Address)evt.getArg();
-                addMember(local_addr);
-                if(print_local_addr) {
-                    System.out.println("\n-------------------------------------------------------\n" +
-                                       "GMS: address is " + local_addr +
-                                       "\n-------------------------------------------------------");
-                }
-                break;
-
-            case Event.CONNECT_OK:
-                passUp(evt);
-                sender_win=new AckMcastSenderWindow(this, timeout);
-
-                // send join announcement
-                Message join_msg=new Message();
-                join_msg.putHeader(name, new SmackHeader(SmackHeader.JOIN_ANNOUNCEMENT, -1));
-                passDown(new Event(Event.MSG, join_msg));
-                return;
-
-            case Event.SUSPECT:
-                if(log.isInfoEnabled()) log.info(ExternalStrings.SMACK_REMOVING_SUSPECTED_MEMBER__0, (Object)evt.getArg());
-                removeMember((Address)evt.getArg());
-                break;
-
-            case Event.MSG:
-                Message msg=(Message)evt.getArg(), tmp_msg;
-                if(msg == null) break;
-                sender=msg.getSrc();
-                SmackHeader hdr=(SmackHeader)msg.removeHeader(name);
-                if(hdr == null) // is probably a unicast message
-                    break;
-                switch(hdr.type) {
-                    case SmackHeader.MCAST: // send an ack, then pass up (if not already received)
-                        Long tmp_seqno;
-                        AckReceiverWindow win;
-                        Message ack_msg=new Message(sender, null, null);
-
-                        ack_msg.putHeader(name, new SmackHeader(SmackHeader.ACK, hdr.seqno));
-                        passDown(new Event(Event.MSG, ack_msg));
-
-                        tmp_seqno=Long.valueOf(hdr.seqno);
-
-                        if(trace)
-                            log.trace("received #" + tmp_seqno + " from " + sender);
-
-                        win=(AckReceiverWindow)receivers.get(sender);
-                        if(win == null) {
-                            addMember(sender);
-                            win=new AckReceiverWindow(hdr.seqno);
-                            receivers.put(sender, win);
-                        }
-                        win.add(hdr.seqno, msg);
-
-                        // now remove as many messages as possible
-                        while((tmp_msg=win.remove()) != null)
-                            passUp(new Event(Event.MSG, tmp_msg));
-                        return;
-
-                    case SmackHeader.ACK:
-                        addMember(msg.getSrc());
-                        sender_win.ack(hdr.seqno, msg.getSrc());
-                        sender_win.clearStableMessages();
-                        if(trace)
-                            log.trace("received ack for #" + hdr.seqno + " from " + msg.getSrc());
-                        return;
-
-                    case SmackHeader.JOIN_ANNOUNCEMENT:
-
-                            if(log.isInfoEnabled()) log.info(ExternalStrings.SMACK_RECEIVED_JOIN_ANNOUNCEMENT_BY__0, msg.getSrc());
-
-                        if(!containsMember(sender)) {
-                            Message join_rsp=new Message(sender, null, null);
-                            join_rsp.putHeader(name, new SmackHeader(SmackHeader.JOIN_ANNOUNCEMENT, -1));
-                            passDown(new Event(Event.MSG, join_rsp));
-                        }
-                        addMember(sender);
-                        return;
-
-                    case SmackHeader.LEAVE_ANNOUNCEMENT:
-
-                            if(log.isInfoEnabled()) log.info(ExternalStrings.SMACK_RECEIVED_LEAVE_ANNOUNCEMENT_BY__0, msg.getSrc());
-
-                        removeMember(sender);
-                        return;
-
-                    default:
-                        if(warn) log.warn("detected SmackHeader with invalid type: " + hdr);
-                        break;
-                }
-                break;
-        }
-
-        passUp(evt);
-    }
-
-
-    @Override // GemStoneAddition  
-    public void down(Event evt) {
-        Message leave_msg;
-
-        switch(evt.getType()) {
-
-            case Event.DISCONNECT:
-                leave_msg=new Message();
-                leave_msg.putHeader(name, new SmackHeader(SmackHeader.LEAVE_ANNOUNCEMENT, -1));
-                passDown(new Event(Event.MSG, leave_msg));
-                // passUp(new Event(Event.DISCONNECT_OK));
-                break;
-
-            case Event.CONNECT:
-                //passUp(new Event(Event.CONNECT_OK));
-
-                // Do not send JOIN_ANOUNCEMENT here, don't know yet if the transport is OK.
-                // Send it later when handling CONNECT_OK from below
-
-//                 sender_win=new AckMcastSenderWindow(this, timeout);
-//                 // send join announcement
-//                 Message join_msg=new Message();
-//                 join_msg.putHeader(name, new SmackHeader(SmackHeader.JOIN_ANNOUNCEMENT, -1));
-//                 passDown(new Event(Event.MSG, join_msg));
-//                 return;
-
-                break;
-
-
-// add a header with the current sequence number and increment seqno
-            case Event.MSG:
-                Message msg=(Message)evt.getArg();
-                if(msg == null) break;
-                if(msg.getDest() == null || msg.getDest().isMulticastAddress()) {
-                    msg.putHeader(name, new SmackHeader(SmackHeader.MCAST, seqno));
-                    sender_win.add(seqno, msg, (Vector)members.clone());
-                    if(trace) log.trace("sending mcast #" + seqno);
-                    seqno++;
-                }
-                break;
-        }
-
-        passDown(evt);
-    }
-
-
-
-    /* ----------------------- Interface AckMcastSenderWindow.RetransmitCommand -------------------- */
-
-    public void retransmit(long seqno, Message msg, Address dest) {
-        msg.setDest(dest);
-        if(log.isInfoEnabled()) log.info(ExternalStrings.SMACK_0__MSG_1, 
-          new Object[] {Long.valueOf(seqno), msg});
-        passDown(new Event(Event.MSG, msg));
-    }
-
-    /* -------------------- End of Interface AckMcastSenderWindow.RetransmitCommand ---------------- */
-
-
-
-
-    public static class SmackHeader extends Header  {
-        public static final int MCAST=1;
-        public static final int ACK=2;
-        public static final int JOIN_ANNOUNCEMENT=3;
-        public static final int LEAVE_ANNOUNCEMENT=4;
-
-        int type=0;
-        long seqno=-1;
-
-        public SmackHeader() {
-        }
-
-        public SmackHeader(int type, long seqno) {
-            this.type=type;
-            this.seqno=seqno;
-        }
-
-
-        public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeInt(type);
-            out.writeLong(seqno);
-        }
-
-
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            type=in.readInt();
-            seqno=in.readLong();
-        }
-
-
-        @Override // GemStoneAddition  
-        public String toString() {
-            switch(type) {
-                case MCAST:
-                    return "MCAST";
-                case ACK:
-                    return "ACK";
-                case JOIN_ANNOUNCEMENT:
-                    return "JOIN_ANNOUNCEMENT";
-                case LEAVE_ANNOUNCEMENT:
-                    return "LEAVE_ANNOUNCEMENT";
-                default:
-                    return "<unknown>";
-            }
-        }
-    }
-
-
-    /* ------------------------------------- Private methods --------------------------------------- */
-    void addMember(Address mbr) {
-        synchronized(members) {
-            if(mbr != null && !members.contains(mbr)) {
-                Object tmp;
-                View new_view;
-                members.addElement(mbr);
-                tmp=members.clone();
-                if(trace)
-                    log.trace("added " + mbr + ", members=" + tmp);
-                new_view=new View(new ViewId(local_addr, vid++), (Vector)tmp);
-                passUp(new Event(Event.VIEW_CHANGE, new_view));
-                passDown(new Event(Event.VIEW_CHANGE, new_view));
-            }
-        }
-    }
-
-    void removeMember(Address mbr) {
-        synchronized(members) {
-            if(mbr != null) {
-                Object tmp;
-                View new_view;
-                members.removeElement(mbr);
-                tmp=members.clone();
-                if(trace)
-                    log.trace("removed " + mbr + ", members=" + tmp);
-                new_view=new View(new ViewId(local_addr, vid++), (Vector)tmp);
-                passUp(new Event(Event.VIEW_CHANGE, new_view));
-                passDown(new Event(Event.VIEW_CHANGE, new_view));
-                if(sender_win != null)
-                    sender_win.remove(mbr); // causes retransmissions to mbr to stop
-            }
-        }
-    }
-
-
-    boolean containsMember(Address mbr) {
-        synchronized(members) {
-            return mbr != null && members.contains(mbr);
-        }
-    }
-
-    /* --------------------------------- End of Private methods ------------------------------------ */
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8b2ea77d/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/STATE_TRANSFER.java
----------------------------------------------------------------------
diff --git a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/STATE_TRANSFER.java b/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/STATE_TRANSFER.java
deleted file mode 100644
index 2e682f3..0000000
--- a/gemfire-jgroups/src/main/java/com/gemstone/org/jgroups/protocols/STATE_TRANSFER.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/** Notice of modification as required by the LGPL
- *  This file was modified by Gemstone Systems Inc. on
- *  $Date$
- **/
-// $Id: STATE_TRANSFER.java,v 1.16 2005/11/12 06:38:21 belaban Exp $
-
-package com.gemstone.org.jgroups.protocols;
-
-
-import com.gemstone.org.jgroups.Address;
-import com.gemstone.org.jgroups.Event;
-import com.gemstone.org.jgroups.Message;
-import com.gemstone.org.jgroups.View;
-import com.gemstone.org.jgroups.blocks.GroupRequest;
-import com.gemstone.org.jgroups.blocks.RequestCorrelator;
-import com.gemstone.org.jgroups.blocks.RequestHandler;
-import com.gemstone.org.jgroups.stack.Protocol;
-import com.gemstone.org.jgroups.stack.StateTransferInfo;
-import com.gemstone.org.jgroups.util.ExternalStrings;
-import com.gemstone.org.jgroups.util.Rsp;
-import com.gemstone.org.jgroups.util.RspList;
-import com.gemstone.org.jgroups.util.Util;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.Vector;
-
-
-class StateTransferRequest implements Serializable {
-    static final int MAKE_COPY=1;  // arg = originator of request
-    static final int RETURN_STATE=2;  // arg = orginator of request
-
-    int type=0;
-    final Object arg;
-    private static final long serialVersionUID = -7734608266762273116L;
-
-
-    StateTransferRequest(int type, Object arg) {
-        this.type=type;
-        this.arg=arg;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public Object getArg() {
-        return arg;
-    }
-
-    @Override // GemStoneAddition  
-    public String toString() {
-        return "[StateTransferRequest: type=" + type2Str(type) + ", arg=" + arg + ']';
-    }
-
-    static String type2Str(int t) {
-        switch(t) {
-            case MAKE_COPY:
-                return "MAKE_COPY";
-            case RETURN_STATE:
-                return "RETURN_STATE";
-            default:
-                return "<unknown>";
-        }
-    }
-}
-
-
-/**
- * State transfer layer. Upon receiving a GET_STATE event from JChannel, a MAKE_COPY message is
- * sent to all members. When the originator receives MAKE_COPY, it queues all messages to the
- * channel.
- * When another member receives the message, it asks the JChannel to provide it with a copy of
- * the current state (GetStateEvent is received by application, returnState() sends state down the
- * stack). Then the current layer sends a unicast RETURN_STATE message to the coordinator, which
- * returns the cached copy.
- * When the state is received by the originator, the GET_STATE sender is unblocked with a
- * GET_STATE_OK event up the stack (unless it already timed out).<p>
- * Requires QUEUE layer on top.
- * 
- * @author Bela Ban
- */
-public class STATE_TRANSFER extends Protocol implements RequestHandler {
-    Address local_addr=null;
-    final Vector members=new Vector(11);
-    final Message m=null;
-    boolean is_server=false;
-    byte[] cached_state=null;
-    final Object state_xfer_mutex=new Object(); // get state from appl (via channel).
-    long timeout_get_appl_state=5000;
-    long timeout_return_state=5000;
-    RequestCorrelator corr=null;
-    final Vector observers=new Vector(5);
-    final HashMap map=new HashMap(7);
-
-
-    /**
-     * All protocol names have to be unique !
-     */
-    @Override // GemStoneAddition  
-    public String getName() {
-        return "STATE_TRANSFER";
-    }
-
-
-    @Override // GemStoneAddition  
-    public void init() throws Exception {
-        map.put("state_transfer", Boolean.TRUE);
-        map.put("protocol_class", getClass().getName());
-
-    }
-
-    @Override // GemStoneAddition  
-    public void start() throws Exception {
-        corr=new RequestCorrelator(getName(), this, this);
-        passUp(new Event(Event.CONFIG, map));
-    }
-
-    @Override // GemStoneAddition  
-    public void stop() {
-        if(corr != null) {
-            corr.stop();
-            corr=null;
-        }
-    }
-
-
-    @Override // GemStoneAddition  
-    public boolean setProperties(Properties props) {
-        String str;
-
-        super.setProperties(props);
-        // Milliseconds to wait for application to provide requested state, events are
-        // STATE_TRANSFER up and STATE_TRANSFER_OK down
-        str=props.getProperty("timeout_get_appl_state");
-        if(str != null) {
-            timeout_get_appl_state=Long.parseLong(str);
-            props.remove("timeout_get_appl_state");
-        }
-
-        // Milliseconds to wait for 1 or all members to return its/their state. 0 means wait
-        // forever. States are retrieved using GroupRequest/RequestCorrelator
-        str=props.getProperty("timeout_return_state");
-        if(str != null) {
-            timeout_return_state=Long.parseLong(str);
-            props.remove("timeout_return_state");
-        }
-
-        if(props.size() > 0) {
-            log.error(ExternalStrings.STATE_TRANSFER_STATE_TRANSFERSETPROPERTIES_THE_FOLLOWING_PROPERTIES_ARE_NOT_RECOGNIZED__0, props);
-
-            return false;
-        }
-        return true;
-    }
-
-
-    @Override // GemStoneAddition  
-    public Vector requiredUpServices() {
-        Vector ret=new Vector(2);
-        ret.addElement(Integer.valueOf(Event.START_QUEUEING));
-        ret.addElement(Integer.valueOf(Event.STOP_QUEUEING));
-        return ret;
-    }
-
-
-    @Override // GemStoneAddition  
-    public void up(Event evt) {
-        switch(evt.getType()) {
-
-            case Event.BECOME_SERVER:
-                is_server=true;
-                break;
-
-            case Event.SET_LOCAL_ADDRESS:
-                local_addr=(Address)evt.getArg();
-                break;
-
-            case Event.TMP_VIEW:
-            case Event.VIEW_CHANGE:
-                Vector new_members=((View)evt.getArg()).getMembers();
-                synchronized(members) {
-                    members.removeAllElements();
-                    if(new_members != null && new_members.size() > 0)
-                        for(int k=0; k < new_members.size(); k++)
-                            members.addElement(new_members.elementAt(k));
-                }
-                break;
-        }
-
-        if(corr != null)
-            corr.receive(evt); // will consume or pass up, depending on header
-        else
-            passUp(evt);
-    }
-
-
-    @Override // GemStoneAddition  
-    public void down(Event evt) {
-        Object coord, state;
-        Vector event_list;
-        StateTransferInfo info;
-
-
-        switch(evt.getType()) {
-
-            case Event.TMP_VIEW:
-            case Event.VIEW_CHANGE:
-                Vector new_members=((View)evt.getArg()).getMembers();
-                synchronized(members) {
-                    members.removeAllElements();
-                    if(new_members != null && new_members.size() > 0)
-                        for(int k=0; k < new_members.size(); k++)
-                            members.addElement(new_members.elementAt(k));
-                }
-                break;
-
-            case Event.GET_STATE:       // generated by JChannel.getState()
-                info=(StateTransferInfo)evt.getArg();
-                coord=determineCoordinator();
-
-                if(coord == null || coord.equals(local_addr)) {
-                    event_list=new Vector(1);
-                    event_list.addElement(new Event(Event.GET_STATE_OK, null));
-                    passUp(new Event(Event.STOP_QUEUEING, event_list));
-                    return;             // don't pass down any further !
-                }
-
-                sendMakeCopyMessage();  // multicast MAKE_COPY to all members (including me)
-
-                if(info.type == StateTransferInfo.GET_FROM_MANY)
-                    state=getStateFromMany(info.targets);
-                else
-                    state=getStateFromSingle(info.target);
-
-                /* Pass up the state to the application layer (insert into JChannel's event queue */
-                event_list=new Vector(1);
-                event_list.addElement(new Event(Event.GET_STATE_OK, state));
-
-                /* Now stop queueing */
-                passUp(new Event(Event.STOP_QUEUEING, event_list));
-                return;                 // don't pass down any further !
-
-            case Event.GET_APPLSTATE_OK:
-                synchronized(state_xfer_mutex) {
-                    cached_state=(byte[])evt.getArg();
-                    state_xfer_mutex.notifyAll();
-                }
-                return;                 // don't pass down any further !
-
-        }
-
-        passDown(evt);              // pass on to the layer below us
-    }
-
-
-    /* ---------------------- Interface RequestHandler -------------------------- */
-    public Object handle(Message msg) {
-        StateTransferRequest req;
-
-        try {
-            req=(StateTransferRequest)msg.getObject();
-
-            switch(req.getType()) {
-                case StateTransferRequest.MAKE_COPY:
-                    makeCopy(req.getArg());
-                    return null;
-                case StateTransferRequest.RETURN_STATE:
-                    if(is_server)
-                        return cached_state;
-                    else {
-                        if(warn) log.warn("RETURN_STATE: returning null" +
-                                "as I'm not yet an operational state server !");
-                        return null;
-                    }
-                default:
-                    if(log.isErrorEnabled()) log.error("type " + req.getType() +
-                            "is unknown in StateTransferRequest !");
-                    return null;
-            }
-        }
-        catch(Exception e) {
-            if(log.isErrorEnabled()) log.error(ExternalStrings.STATE_TRANSFER_EXCEPTION_IS__0, e);
-            return null;
-        }
-    }
-    /* ------------------- End of Interface RequestHandler ---------------------- */
-
-
-
-
-
-
-
-
-    byte[] getStateFromSingle(Address target) {
-        Vector dests=new Vector(11);
-        Message msg;
-        StateTransferRequest r=new StateTransferRequest(StateTransferRequest.RETURN_STATE, local_addr);
-        RspList rsp_list;
-        Rsp rsp;
-        Address dest;
-        GroupRequest req;
-        int num_tries=0;
-
-
-        try {
-            msg=new Message(null, null, Util.objectToByteBuffer(r));
-        }
-        catch(Exception e) {
-            if(log.isErrorEnabled()) log.error(ExternalStrings.STATE_TRANSFER_EXCEPTION_0, e);
-            return null;
-        }
-
-        while(members.size() > 1 && num_tries++ < 3) {  // excluding myself
-            dest=target != null? target : determineCoordinator();
-            if(dest == null)
-                return null;
-            msg.setDest(dest);
-            dests.removeAllElements();
-            dests.addElement(dest);
-            req=new GroupRequest(msg, corr, dests, GroupRequest.GET_FIRST, timeout_return_state, 0);
-            req.execute();
-            rsp_list=req.getResults();
-            for(int i=0; i < rsp_list.size(); i++) {  // get the first non-suspected result
-                rsp=(Rsp)rsp_list.elementAt(i);
-                if(rsp.wasReceived())
-                    return (byte[])rsp.getValue();
-            }
-            try { // GemStoneAddition
-              Util.sleep(1000);
-            }
-            catch (InterruptedException e) {
-              Thread.currentThread().interrupt();
-              return null; // treat like it failed
-            }
-        }
-
-        return null;
-    }
-
-
-    Vector getStateFromMany(Vector targets) {
-        Vector dests=new Vector(11);
-        Message msg;
-        StateTransferRequest r=new StateTransferRequest(StateTransferRequest.RETURN_STATE, local_addr);
-        RspList rsp_list;
-        GroupRequest req;
-        int i;
-
-
-        if(targets != null) {
-            for(i=0; i < targets.size(); i++)
-                if(!local_addr.equals(targets.elementAt(i)))
-                    dests.addElement(targets.elementAt(i));
-        }
-        else {
-            for(i=0; i < members.size(); i++)
-                if(!local_addr.equals(members.elementAt(i)))
-                    dests.addElement(members.elementAt(i));
-        }
-
-        if(dests.size() == 0)
-            return null;
-
-        msg=new Message();
-        try {
-            msg.setBuffer(Util.objectToByteBuffer(r));
-        }
-        catch(Exception e) {
-        }
-
-        req=new GroupRequest(msg, corr, dests, GroupRequest.GET_ALL, timeout_return_state, 0);
-        req.execute();
-        rsp_list=req.getResults();
-        return rsp_list.getResults();
-    }
-
-
-    void sendMakeCopyMessage() {
-        GroupRequest req;
-        Message msg=new Message();
-        StateTransferRequest r=new StateTransferRequest(StateTransferRequest.MAKE_COPY, local_addr);
-        Vector dests=new Vector(11);
-
-        for(int i=0; i < members.size(); i++)   
-             dests.addElement(members.elementAt(i));
-
-        if(dests.size() == 0)
-            return;
-
-        try {
-            msg.setBuffer(Util.objectToByteBuffer(r));
-        }
-        catch(Exception e) {
-        }
-
-        req=new GroupRequest(msg, corr, dests, GroupRequest.GET_ALL, timeout_return_state, 0);
-        req.execute();
-    }
-
-
-    /**
-     * Return the first element of members which is not me. Otherwise return null.
-     */
-    Address determineCoordinator() {
-        Address ret=null;
-        if(members != null && members.size() > 1) {
-            for(int i=0; i < members.size(); i++)
-                if(!local_addr.equals(members.elementAt(i)))
-                    return (Address)members.elementAt(i);
-        }
-        return ret;
-    }
-
-
-    /**
-     * If server, ask application to send us a copy of its state (STATE_TRANSFER up,
-     * STATE_TRANSFER down). If client, start queueing events. Queuing will be stopped when
-     * state has been retrieved (or not) from single or all member(s).
-     */
-    void makeCopy(Object sender) {
-        if(sender.equals(local_addr)) { // was sent by us, has to start queueing
-            passUp(new Event(Event.START_QUEUEING));
-        }
-        else {               // only retrieve state from appl when not in client state anymore
-            if(is_server) {  // get state from application and store it locally
-                synchronized(state_xfer_mutex) {
-                    cached_state=null;
-
-                    passUp(new Event(Event.GET_APPLSTATE, local_addr));
-                    if(cached_state == null) {
-                        try {
-                            state_xfer_mutex.wait(timeout_get_appl_state); // wait for STATE_TRANSFER_OK
-                        }
-                        catch(InterruptedException e) {
-                          Thread.currentThread().interrupt(); // GemStoneAddition
-                          // Just propagate to caller
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-
-}



Mime
View raw message