use of org.jgroups.util.ByteArrayDataOutputStream in project JGroups by belaban.
the class NoBundler method send.
public void send(Message msg) throws Exception {
ByteArrayDataOutputStream out = new ByteArrayDataOutputStream((int) (msg.size() + 10));
sendSingleMessage(msg, out);
}
use of org.jgroups.util.ByteArrayDataOutputStream in project JGroups by belaban.
the class AsyncNoBundler method send.
@Override
public void send(final Message msg) throws Exception {
Runnable async_send = () -> {
ByteArrayDataOutputStream out = new ByteArrayDataOutputStream((int) (msg.size() + 10));
sendSingleMessage(msg, out);
};
thread_pool.execute(async_send);
}
use of org.jgroups.util.ByteArrayDataOutputStream in project JGroups by belaban.
the class BPING method sendMcastDiscoveryRequest.
@Override
protected void sendMcastDiscoveryRequest(Message msg) {
try {
if (msg.getSrc() == null)
msg.setSrc(local_addr);
ByteArrayDataOutputStream out = new ByteArrayDataOutputStream((int) msg.size());
msg.writeTo(out);
for (int i = bind_port; i <= bind_port + port_range; i++) {
DatagramPacket packet = new DatagramPacket(out.buffer(), 0, out.position(), dest_addr, i);
sock.send(packet);
}
} catch (Exception ex) {
log.error(Util.getMessage("FailedSendingDiscoveryRequest"), ex);
}
}
use of org.jgroups.util.ByteArrayDataOutputStream in project JGroups by belaban.
the class BaseBundler method init.
public void init(TP transport) {
this.transport = transport;
log = transport.getLog();
output = new ByteArrayDataOutputStream(transport.getMaxBundleSize() + MSG_OVERHEAD);
}
use of org.jgroups.util.ByteArrayDataOutputStream in project JGroups by belaban.
the class TUNNEL method send.
@Override
protected void send(Message msg, Address dest) throws Exception {
// we don't currently support message bundling in TUNNEL
TpHeader hdr = msg.getHeader(this.id);
if (hdr == null)
throw new Exception("message " + msg + " doesn't have a transport header, cannot route it");
String group = cluster_name != null ? cluster_name.toString() : null;
ByteArrayDataOutputStream dos = new ByteArrayDataOutputStream((int) (msg.size() + 50));
Util.writeMessage(msg, dos, dest == null);
if (stats) {
msg_stats.incrNumMsgsSent(1);
msg_stats.incrNumBytesSent(dos.position());
}
if (dest == null)
tunnel_policy.sendToAllMembers(group, local_addr, dos.buffer(), 0, dos.position());
else
tunnel_policy.sendToSingleMember(group, dest, local_addr, dos.buffer(), 0, dos.position());
}
Aggregations