void send(Msg msg) { send(new MessageWrapper(msg)); }
msgw.injectSize(diff, startTS); outL.add(out); } finally {
ChannelFuture sendUdpMessage(MessageWrapper msgw) { ByteBuf buf = udpChannel.alloc().ioBuffer(INITIAL_BUFFER_SIZE, SEND_BUFFER_SIZE); try { if (msgw.notify.isPresent() && msgw.notify.get().notifyOfDelivery) { MessageNotify.Req msgr = msgw.notify.get(); AckRequestMsg arm = new AckRequestMsg(msgw.msg, msgr.getMsgId()); Serializers.toBinary(arm, buf); } else { Serializers.toBinary(msgw.msg, buf); } msgw.injectSize(buf.readableBytes(), System.nanoTime()); DatagramPacket pack = new DatagramPacket(buf, msgw.msg.getDestination().asSocket()); logger.debug("Sending Datagram message {} ({}bytes)", msgw.msg, buf.readableBytes()); return udpChannel.writeAndFlush(pack); } catch (Exception e) { // serialization might fail horribly with size bounded buff logger.warn("Could not send Datagram message {}, error was: {}", msgw, e); return null; } }
void send(MessageNotify.Req notify) { send(new MessageWrapper(notify)); }
@Override protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { ByteBuf frame = (ByteBuf) super.decode(ctx, in); if (frame == null) { return null; } component.setCustomMDC(); try { component.extLog.trace("Trying to decode incoming {} bytes of data from {} to {}.", new Object[]{frame.readableBytes(), ctx.channel().remoteAddress(), ctx.channel().localAddress()}); Object o = Serializers.fromBinary(frame, Optional.absent()); component.extLog.trace("Decoded incoming data from {}: {}", ctx.channel().remoteAddress(), o); if (o instanceof AckRequestMsg) { AckRequestMsg arm = (AckRequestMsg) o; component.extLog.trace("Got AckRequest for {}. Replying...", arm.id); NotifyAck an = arm.reply(); ctx.channel().writeAndFlush(new MessageWrapper(an)); return arm.content; } else if (o instanceof Msg) { return o; } else { component.extLog.warn("Got unexpected Stream message type: {} -> {}", o.getClass().getCanonicalName(), o); } return o; } finally { MDC.clear(); } }
component.extLog.trace("Finally sending Disamb: {}", dc); waitingForCreationUDT.add(destination.asSocket()); sc.writeAndFlush(new MessageWrapper(dc));
component.extLog.trace("Finally sending Disamb: {}", dc); waitingForCreationUDT.add(destination.asSocket()); sc.writeAndFlush(new MessageWrapper(dc));
tcpC.writeAndFlush(new MessageWrapper(r)); return null;
channels.disambiguate(msg, c); if (msg.reply) { c.writeAndFlush(new MessageWrapper(new DisambiguateConnection(self, msg.getSource(), msg.getProtocol(), boundUDTPort, false)));