Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions rsc/src/main/java/org/apache/livy/rsc/ContextLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private ContextLauncher(RSCClientFactory factory, RSCConf conf) throws IOExcepti
this.conf = conf;
this.factory = factory;

final RegistrationHandler handler = new RegistrationHandler();
final RegistrationHandler handler = new RegistrationHandler(conf);
try {
factory.getServer().registerClient(clientId, secret, handler);
String replMode = conf.get("repl");
Expand Down Expand Up @@ -319,6 +319,12 @@ private static File writeConfToFile(RSCConf conf) throws IOException {
private class RegistrationHandler extends BaseProtocol
implements RpcServer.ClientCallback {

private final RSCConf conf;

private RegistrationHandler(RSCConf conf) {
this.conf = conf;
}

volatile RemoteDriverAddress driverAddress;

private Rpc client;
Expand All @@ -341,9 +347,12 @@ void dispose() {
}

private void handle(ChannelHandlerContext ctx, RemoteDriverAddress msg) {
InetSocketAddress insocket = (InetSocketAddress) ctx.channel().remoteAddress();
String ip = insocket.getAddress().getHostAddress();
ContextInfo info = new ContextInfo(ip, msg.port, clientId, secret);
String host = msg.host;
if(conf.getBoolean(RPC_CLIENT_GET_DRIVER_IP_FROM_CONNECTION)) {
InetSocketAddress insocket = (InetSocketAddress) ctx.channel().remoteAddress();
host = insocket.getAddress().getHostAddress();
}
ContextInfo info = new ContextInfo(host, msg.port, clientId, secret);
if (promise.trySuccess(info)) {
timeout.cancel(true);
LOG.debug("Received driver info for client {}: {}/{}.", client.getChannel(),
Expand Down
1 change: 1 addition & 0 deletions rsc/src/main/java/org/apache/livy/rsc/RSCConf.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public static enum Entry implements ConfEntry {
RPC_SERVER_ADDRESS("rpc.server.address", null),
RPC_CLIENT_HANDSHAKE_TIMEOUT("server.connect.timeout", "90s"),
RPC_CLIENT_CONNECT_TIMEOUT("client.connect.timeout", "10s"),
RPC_CLIENT_GET_DRIVER_IP_FROM_CONNECTION("client.get-driver-ip-from-connection", true),
RPC_CHANNEL_LOG_LEVEL("channel.log.level", null),
RPC_MAX_MESSAGE_SIZE("rpc.max.size", 50 * 1024 * 1024),
RPC_MAX_THREADS("rpc.threads", 8),
Expand Down