private Class<? extends ProtocolServer> defaultProtocolServer() { if (protocol.getType() == ProtocolType.TCP) { return JsonLineProtocolServer.class; } return JsonFrameProtocolServer.class; }
private Class<? extends ProtocolServer> parseProtocolServer() { if (protocol.getType() == ProtocolType.UDP) { return ProtobufFrameProtocolServer.class; } if (protocol.getType() == ProtocolType.TCP) { return ProtobufLengthPrefixedProtocolServer.class; } throw new IllegalArgumentException("Protocol not supported: " + protocol.getType()); }
private Class<? extends ProtocolServer> parseProtocolServer() { if (protocol.getType() == ProtocolType.UDP) { return RiemannUDPProtocolServer.class; } if (protocol.getType() == ProtocolType.TCP) { return RiemannTCPProtocolServer.class; } throw new IllegalArgumentException("Protocol not supported: " + protocol.getType()); }
private Class<? extends ProtocolServer> parseProtocolServer(final String delimiter) { if (FRAME.equals(delimiter)) { if (protocol.getType() == ProtocolType.TCP) { throw new IllegalArgumentException("frame-based decoding is not suitable for TCP"); } throw new IllegalArgumentException("frame-based decoding is not supported yet"); } if (LINE.equals(delimiter)) { return CarbonLineServer.class; } return defaultProtocolServer(); }
@Override public AsyncFuture<ProtocolConnection> bind( Logger log, Protocol protocol, ProtocolServer server, RetryPolicy policy ) { if (protocol.getType() == ProtocolType.UDP) { return bindUDP(log, protocol, server, policy); } if (protocol.getType() == ProtocolType.TCP) { return bindTCP(log, protocol, server, policy); } throw new IllegalArgumentException("Unsupported protocol: " + protocol); }
@Override public AsyncFuture<ProtocolConnection> connect( Logger log, Protocol protocol, ProtocolClient client, RetryPolicy policy ) { if (protocol.getType() == ProtocolType.UDP) { return connectUDP(protocol, client, policy); } if (protocol.getType() == ProtocolType.TCP) { return connectTCP(log, protocol, client, policy); } throw new IllegalArgumentException("Unsupported protocol: " + protocol); }
private Class<? extends ProtocolServer> parseProtocolServer(String delimiter) { if (FRAME.equals(delimiter)) { if (protocol.getType() == ProtocolType.TCP) { throw new IllegalArgumentException("frame-based decoding is not suitable for TCP"); } return JsonFrameProtocolServer.class; } if (LINE.equals(delimiter)) { return JsonLineProtocolServer.class; } return defaultProtocolServer(); }