Search in sources :

Example 1 with DriftNettyServerTransport

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();
}
Also used : DriftNettyServerTransport(com.facebook.drift.transport.netty.server.DriftNettyServerTransport) ServiceAnnouncement(com.facebook.airlift.discovery.client.ServiceAnnouncement) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ServiceAnnouncement (com.facebook.airlift.discovery.client.ServiceAnnouncement)1 DriftNettyServerTransport (com.facebook.drift.transport.netty.server.DriftNettyServerTransport)1 LinkedHashMap (java.util.LinkedHashMap)1