Skip to content
Open

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.apache.thrift.TProcessor;
import org.apache.thrift.TProcessorFactory;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.server.THsHaServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.server.TThreadedSelectorServer;
import org.apache.thrift.transport.TNonblockingServerSocket;
Expand Down Expand Up @@ -190,7 +191,10 @@ private static ServerAddress createThreadedSelectorServer(HostAndPort address,
address = HostAndPort.fromParts(address.getHost(), transport.getPort());
}

return new ServerAddress(new CustomThreadedSelectorServer(options), address);
final TThreadedSelectorServer server = new TThreadedSelectorServer(options);
server.setServerEventHandler(new ThriftServerEventHandler());

return new ServerAddress(server, address);
}

/**
Expand All @@ -207,7 +211,7 @@ private static ServerAddress createNonBlockingServer(HostAndPort address, TProce
.clientTimeout(0).maxFrameSize(Ints.saturatedCast(maxMessageSize));

final TNonblockingServerSocket transport = new TNonblockingServerSocket(args);
final CustomNonBlockingServer.Args options = new CustomNonBlockingServer.Args(transport);
THsHaServer.Args options = new THsHaServer.Args(transport);

options.protocolFactory(protocolFactory);
options.transportFactory(ThriftUtil.transportFactory(maxMessageSize));
Expand All @@ -225,7 +229,10 @@ private static ServerAddress createNonBlockingServer(HostAndPort address, TProce
address = HostAndPort.fromParts(address.getHost(), transport.getPort());
}

return new ServerAddress(new CustomNonBlockingServer(options), address);
final THsHaServer server = new THsHaServer(options);
Comment thread
Amemeda marked this conversation as resolved.
Outdated
server.setServerEventHandler(new ThriftServerEventHandler());

return new ServerAddress(server, address);
}

/**
Expand Down Expand Up @@ -295,6 +302,8 @@ private static ServerAddress createBlockingServer(HostAndPort address, TProcesso
log.info("Blocking Server bound on {}", address);
}

server.setServerEventHandler(new ThriftServerEventHandler());

return new ServerAddress(server, address);

}
Expand All @@ -317,7 +326,11 @@ private static TThreadPoolServer createTThreadPoolServer(TServerTransport transp
if (service != null) {
options.executorService(service);
}
return new TThreadPoolServer(options);

final TThreadPoolServer server = new TThreadPoolServer(options);
server.setServerEventHandler(new ThriftServerEventHandler());

return server;
}

/**
Expand Down Expand Up @@ -395,9 +408,11 @@ private static ServerAddress createSslThreadPoolServer(HostAndPort address, TPro

ThreadPoolExecutor pool =
createSelfResizingThreadPool(numThreads, threadTimeOut, conf, timeBetweenThreadChecks);
TThreadPoolServer server = createTThreadPoolServer(transport, processor,
ThriftUtil.transportFactory(), protocolFactory, pool);
server.setServerEventHandler(new ThriftServerEventHandler());

return new ServerAddress(createTThreadPoolServer(transport, processor,
ThriftUtil.transportFactory(), protocolFactory, pool), address);
return new ServerAddress(server, address);
}

private static ServerAddress createSaslThreadPoolServer(HostAndPort address, TProcessor processor,
Expand Down Expand Up @@ -495,6 +510,7 @@ private static ServerAddress createSaslThreadPoolServer(HostAndPort address, TPr
final TThreadPoolServer server =
createTThreadPoolServer(transport, processor, ugiTransportFactory, protocolFactory, pool);

server.setServerEventHandler(new ThriftServerEventHandler());
return new ServerAddress(server, address);
}

Expand Down
Loading