1 3 package org.jgroups.protocols.pbcast; 4 5 6 import org.jgroups.Address; 7 import org.jgroups.View; 8 9 import java.io.Externalizable ; 10 import java.io.IOException ; 11 import java.io.ObjectInput ; 12 import java.io.ObjectOutput ; 13 14 15 21 public class MergeData implements Externalizable { 22 Address sender=null; 23 boolean merge_rejected=false; 24 View view=null; 25 Digest digest=null; 26 27 30 public MergeData() { 31 ; 32 } 33 34 public MergeData(Address sender, View view, Digest digest) { 35 this.sender=sender; 36 this.view=view; 37 this.digest=digest; 38 } 39 40 public Address getSender() { 41 return sender; 42 } 43 44 public View getView() { 45 return view; 46 } 47 48 public Digest getDigest() { 49 return digest; 50 } 51 52 public void setView(View v) { 53 view=v; 54 } 55 56 public void setDigest(Digest d) { 57 digest=d; 58 } 59 60 61 public boolean equals(Object other) { 62 return sender != null && other != null && other instanceof MergeData && 63 ((MergeData)other).sender != null && ((MergeData)other).sender.equals(sender); 64 } 65 66 67 public void writeExternal(ObjectOutput out) throws IOException { 68 out.writeObject(sender); 69 out.writeBoolean(merge_rejected); 70 if(!merge_rejected) { 71 out.writeObject(view); 72 out.writeObject(digest); 73 } 74 } 75 76 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 77 sender=(Address)in.readObject(); 78 merge_rejected=in.readBoolean(); 79 if(!merge_rejected) { 80 view=(View)in.readObject(); 81 digest=(Digest)in.readObject(); 82 } 83 } 84 85 86 public String toString() { 87 StringBuffer sb=new StringBuffer (); 88 sb.append("sender=" + sender); 89 if(merge_rejected) 90 sb.append(" (merge_rejected)"); 91 else { 92 sb.append(", view=" + view + ", digest=" + digest); 93 } 94 return sb.toString(); 95 } 96 97 98 } 99 100 101 102 | Popular Tags |