in thrift/src/main/scala/com/twitter/finatra/thrift/servers.scala [180:219]
override protected def postWarmup(): Unit = {
super.postWarmup()
val baseSrv = ThriftMux.server
.withLabel(thriftServerNameFlag())
.withStatsReceiver(injector.instance[StatsReceiver].scope("srv"))
.withResponseClassifier(injector.instance[ThriftResponseClassifier])
// The inject.TwitterServer installs the TracerModule, which uses a bindOption for configuring a Tracer. This
// approach differs from the pattern used with StatsReceiver & StatsReceiverModule in order to work
// backwards compatibly with implementations that already bind their own customer Tracer.
// If a Tracer is bound to the object graph we configure it here, otherwise the default Tracer
// configuration is used. This is our primary integration point for verifying traces via test.
val srv = injector.instance[Option[Tracer]] match {
case Some(tracer) => baseSrv.withTracer(tracer)
case _ => baseSrv
}
thriftServer = build(
thriftPortFlag(),
frameworkConfigureServer(
configureThriftServer(
srv
)
)
)
onExit {
Await.result(thriftServer.close(thriftShutdownTimeoutFlag().fromNow))
}
await(thriftServer)
thriftAnnounceFlag() match {
case ThriftServerTrait.NoThriftAnnouncement => // no-op
case addr =>
info(s"thrift server announced to $addr")
thriftServer.announce(addr)
}
info(s"thrift server started on port ${PortUtils.getPort(thriftServer.boundAddress)}")
}