public void init(TP transport) { this.transport=transport; log=transport.getLog(); buf_pool=new ArrayBlockingQueue<>(pool_size); for(int i=0; i < pool_size; i++) buf_pool.offer(new ByteArrayDataOutputStream(initial_buf_size)); } public void start() {}
protected static Buffer marshal(Collection<? extends Address> mbrs) { try { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); Util.writeAddresses(mbrs, out); return out.getBuffer(); } catch(Exception ex) { return null; } }
public void init(TP transport) { this.transport=transport; log=transport.getLog(); output=new ByteArrayDataOutputStream(transport.getMaxBundleSize() + MSG_OVERHEAD); }
public static Buffer streamableToBuffer(Streamable obj) { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); try { Util.writeStreamable(obj,out); return out.getBuffer(); } catch(Exception ex) { return null; } }
public void init(TP transport) { this.transport=transport; log=transport.getLog(); output=new ByteArrayDataOutputStream(transport.getMaxBundleSize() + MSG_OVERHEAD); }
protected static Buffer marshal(Collection<? extends Address> mbrs) { try { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); Util.writeAddresses(mbrs, out); return out.getBuffer(); } catch(Exception ex) { return null; } }
protected static Buffer marshal(final ViewId view_id) { try { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); Util.writeViewId(view_id, out); return out.getBuffer(); } catch(Exception ex) { return null; } }
protected static Buffer marshal(Collection<? extends Address> mbrs) { try { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); Util.writeAddresses(mbrs, out); return out.getBuffer(); } catch(Exception ex) { return null; } }
public static byte[] streamableToByteBuffer(Streamable obj) throws Exception { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); obj.writeTo(out); return Arrays.copyOf(out.buffer(), out.position()); }
public static byte[] streamableToByteBuffer(Streamable obj) throws Exception { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); obj.writeTo(out); return Arrays.copyOf(out.buffer(), out.position()); }
protected static Buffer marshal(final Collection<? extends Address> participants, final Digest digest) { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); try { Util.writeAddresses(participants, out); Util.writeStreamable(digest,out); return out.getBuffer(); } catch(Exception ex) { return null; } }
public static Buffer messageToByteBuffer(Message msg) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); out.writeBoolean(msg != null); if(msg != null) msg.writeTo(out); return out.getBuffer(); }
protected static Buffer marshal(final Collection<? extends Address> participants, final Digest digest) { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); try { Util.writeAddresses(participants, out); Util.writeStreamable(digest,out); return out.getBuffer(); } catch(Exception ex) { return null; } }
protected static Buffer marshal(final Collection<? extends Address> participants, final Digest digest) { final ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(512); try { Util.writeAddresses(participants, out); Util.writeStreamable(digest,out); return out.getBuffer(); } catch(Exception ex) { return null; } }
protected synchronized void writeRequest(GossipData req) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(req.size()); req.writeTo(out); client.send(remote, out.buffer(), 0, out.position()); }
protected synchronized void writeRequest(GossipData req) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(req.size()); req.writeTo(out); client.send(remote, out.buffer(), 0, out.position()); }
protected void sendToMember(Address dest, GossipData request) { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(request.size()); try { request.writeTo(out); server.send(dest, out.buffer(), 0, out.position()); } catch(Exception ex) { log.error("failed sending unicast message to %s: %s", dest, ex); } }
protected static Buffer streamableToBuffer(byte req_or_rsp, byte type, Streamable obj) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(100); out.writeByte(req_or_rsp); out.writeByte(type); obj.writeTo(out); return new Buffer(out.buffer(), 0, out.position()); }
protected static Buffer streamableToBuffer(byte req_or_rsp, byte type, Streamable obj) throws Exception { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(100); out.writeByte(req_or_rsp); out.writeByte(type); obj.writeTo(out); return new Buffer(out.buffer(), 0, out.position()); }
protected void sendToMember(Address dest, GossipData request) { ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(request.size()); try { request.writeTo(out); server.send(dest, out.buffer(), 0, out.position()); } catch(Exception ex) { log.error("failed sending unicast message to %s: %s", dest, ex); } }