public static void writeView(View view,DataOutput out) throws Exception { if(view == null) { out.writeBoolean(false); return; } out.writeBoolean(true); out.writeBoolean(view instanceof MergeView); view.writeTo(out); }
public void writeTo(DataOutput out) throws Exception { byte flags=0; if(view != null) flags|=VIEW_PRESENT; if(digest != null) flags|=DIGEST_PRESENT; if(fail_reason != null) flags|=FAIL_REASON_PRESENT; out.writeByte(flags); // 1. view if(view != null) view.writeTo(out); // 2. digest if(digest != null) digest.writeTo(out, false); // don't write the membership; it is already present in the view // 3. fail_reason if(fail_reason != null) out.writeUTF(fail_reason); }
public void writeTo(DataOutput out) throws Exception { super.writeTo(out); // write subgroups int len=subgroups != null? subgroups.length : 0; out.writeShort(len); if(len == 0) return; for(View v: subgroups) { int index=get(v.getCreator()); out.writeShort(index); // if we don't find the member, write the addres (https://issues.jboss.org/browse/JGRP-1707) if(index < 0) Util.writeAddress(v.getCreator(), out); out.writeLong(v.getViewId().getId()); int num_mbrs=v.size(); out.writeShort(num_mbrs); for(Address mbr: v) { index=get(mbr); out.writeShort(index); if(index < 0) Util.writeAddress(mbr, out); } } }
protected static Buffer marshal(final View view, final Digest digest) { try { int expected_size=Global.SHORT_SIZE; if(view != null) expected_size+=view.serializedSize(); boolean write_addrs=writeAddresses(view, digest); if(digest != null) expected_size=(int)digest.serializedSize(write_addrs); final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(expected_size +10); out.writeShort(determineFlags(view, digest)); if(view != null) view.writeTo(out); if(digest != null) digest.writeTo(out, write_addrs); return out.getBuffer(); } catch(Exception ex) { return null; } }
public static void writeView(View view,DataOutput out) throws Exception { if(view == null) { out.writeBoolean(false); return; } out.writeBoolean(true); out.writeBoolean(view instanceof MergeView); view.writeTo(out); }
public void writeTo(DataOutputStream out) throws IOException { super.writeTo(out); // write subgroups int len=subgroups != null? subgroups.size() : 0; out.writeShort(len); if(len == 0) return; for(View v: subgroups) { if(v instanceof MergeView) out.writeBoolean(true); else out.writeBoolean(false); v.writeTo(out); } }
public void writeTo(DataOutput out) throws Exception { byte flags=0; if(view != null) flags|=VIEW_PRESENT; if(digest != null) flags|=DIGEST_PRESENT; if(fail_reason != null) flags|=FAIL_REASON_PRESENT; out.writeByte(flags); // 1. view if(view != null) view.writeTo(out); // 2. digest if(digest != null) digest.writeTo(out, false); // don't write the membership; it is already present in the view // 3. fail_reason if(fail_reason != null) out.writeUTF(fail_reason); }
public void writeTo(DataOutput out) throws Exception { super.writeTo(out); // write subgroups int len=subgroups != null? subgroups.length : 0; out.writeShort(len); if(len == 0) return; for(View v: subgroups) { int index=get(v.getCreator()); out.writeShort(index); // if we don't find the member, write the addres (https://issues.jboss.org/browse/JGRP-1707) if(index < 0) Util.writeAddress(v.getCreator(), out); out.writeLong(v.getViewId().getId()); int num_mbrs=v.size(); out.writeShort(num_mbrs); for(Address mbr: v) { index=get(mbr); out.writeShort(index); if(index < 0) Util.writeAddress(mbr, out); } } }
protected static Buffer marshal(final View view, final Digest digest) { try { int expected_size=Global.SHORT_SIZE; if(view != null) expected_size+=view.serializedSize(); boolean write_addrs=writeAddresses(view, digest); if(digest != null) expected_size=(int)digest.serializedSize(write_addrs); final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(expected_size +10); out.writeShort(determineFlags(view, digest)); if(view != null) view.writeTo(out); if(digest != null) digest.writeTo(out, write_addrs); return out.getBuffer(); } catch(Exception ex) { return null; } }