use of com.facebook.drift.transport.netty.server.DriftNettyServerTransport in project presto by prestodb.
the class PrestoServer method updateThriftServerPort.
private static void updateThriftServerPort(Announcer announcer, DriftServer driftServer) {
// get existing announcement
ServiceAnnouncement announcement = getPrestoAnnouncement(announcer.getServiceAnnouncements());
// drift server::start can be called multiple times
driftServer.start();
// update announcement and thrift port property
int thriftPort = ((DriftNettyServerTransport) driftServer.getServerTransport()).getPort();
Map<String, String> properties = new LinkedHashMap<>(announcement.getProperties());
properties.put("thriftServerPort", String.valueOf(thriftPort));
announcer.removeServiceAnnouncement(announcement.getId());
announcer.addServiceAnnouncement(serviceAnnouncement(announcement.getType()).addProperties(properties).build());
announcer.forceAnnounce();
}
Aggregations