To use, override the appropriate @Lifecycle and callback method(s). Make sure when overriding
@Lifecycle
methods to call the super implementation, otherwise critical lifecycle set-up may not
occur causing your server to either function improperly or outright fail.
If you are extending this trait, to implement your server, override the start() function, e.g.,
import com.twitter.inject.server.TwitterServer
object MyServerMain extends MyServer
class MyServer extends TwitterServer {
overrideprotecteddef start(): Unit = {
// YOUR CODE HERE
await(someAwaitable)
}
}
Note, you do not need to await on the adminHttpServer as this is done for you by the framework.
Server Lifecycle:
+-------------------------------------------------------------------------+
| Life Cycle Method | Ancillary Function(s) |
+-------------------------------------------------------------------------+
| loadModules() | |
+-------------------------------------------------------------------------+
| modules.postInjectorStartup() | foreach.singletonStartup() |
+-------------------------------------------------------------------------+
| postInjectorStartup() | resolveFinagleClientsOnStartup(), |
| | FinagleBuildRevision.register(), |
| | setup() |
+-------------------------------------------------------------------------+
| warmup() | |
+-------------------------------------------------------------------------+
| beforePostWarmup() | LifeCycle.Warmup.prebindWarmup() |
+-------------------------------------------------------------------------+
| postWarmup() (binds ext ports)| disable or announce admin server |
+-------------------------------------------------------------------------+
| afterpostwarmup() | LifeCycle.Warmup.warmupComplete() |
+-------------------------------------------------------------------------+
| setAppStarted() | |
+-------------------------------------------------------------------------+
| run() | start() |
+-------------------------------------------------------------------------+
| Await on awaitables |
+-------------------------------------------------------------------------+
@Lifecycle
}}}
occur causing your server to either function improperly or outright fail.
If you are extending this trait, to implement your server, override the start() function, e.g.,
import com.twitter.inject.server.TwitterServer
object MyServerMain extends MyServer
class MyServer extends TwitterServer {
overrideprotecteddef start(): Unit = {
// YOUR CODE HERE
await(someAwaitable)
}
}
Note, you do not need to await on the adminHttpServer as this is done for you by the framework.
A com.twitter.server.TwitterServer that supports injection and com.twitter.inject.TwitterModule modules.
To use, override the appropriate @Lifecycle and callback method(s). Make sure when overriding
methods to call the super implementation, otherwise critical lifecycle set-up may not occur causing your server to either function improperly or outright fail.
If you are extending this trait, to implement your server, override the start() function, e.g.,
Note, you do not need to await on the
adminHttpServer
as this is done for you by the framework.Server Lifecycle: +-------------------------------------------------------------------------+ | Life Cycle Method | Ancillary Function(s) | +-------------------------------------------------------------------------+ | loadModules() | | +-------------------------------------------------------------------------+ | modules.postInjectorStartup() | foreach.singletonStartup() | +-------------------------------------------------------------------------+ | postInjectorStartup() | resolveFinagleClientsOnStartup(), | | | FinagleBuildRevision.register(), | | | setup() | +-------------------------------------------------------------------------+ | warmup() | | +-------------------------------------------------------------------------+ | beforePostWarmup() | LifeCycle.Warmup.prebindWarmup() | +-------------------------------------------------------------------------+ | postWarmup() (binds ext ports)| disable or announce admin server | +-------------------------------------------------------------------------+ | afterpostwarmup() | LifeCycle.Warmup.warmupComplete() | +-------------------------------------------------------------------------+ | setAppStarted() | | +-------------------------------------------------------------------------+ | run() | start() | +-------------------------------------------------------------------------+ | Await on awaitables | +-------------------------------------------------------------------------+ @Lifecycle }}} occur causing your server to either function improperly or outright fail.
If you are extending this trait, to implement your server, override the start() function, e.g.,
Note, you do not need to await on the
adminHttpServer
as this is done for you by the framework.Server Lifecycle: +-------------------------------------------------------------------------+ | Life Cycle Method | Ancillary Function(s) | +-------------------------------------------------------------------------+ | loadModules() | | +-------------------------------------------------------------------------+ | modules.postInjectorStartup() | foreach.singletonStartup() | +-------------------------------------------------------------------------+ | postInjectorStartup() | resolveFinagleClientsOnStartup(), | | | FinagleBuildRevision.register(), | | | setup() | +-------------------------------------------------------------------------+ | warmup() | | +-------------------------------------------------------------------------+ | beforePostWarmup() | LifeCycle.Warmup.prebindWarmup() | +-------------------------------------------------------------------------+ | postWarmup() (binds ext ports)| disable or announce admin server | +-------------------------------------------------------------------------+ | afterpostwarmup() | LifeCycle.Warmup.warmupComplete() | +-------------------------------------------------------------------------+ | setAppStarted() | | +-------------------------------------------------------------------------+ | run() | start() | +-------------------------------------------------------------------------+ | Await on awaitables | +-------------------------------------------------------------------------+
Creating an Injectable TwitterServer