Page Speed Optimization Libraries
1.13.35.1
|
#include "central_controller_rpc_server.h"
Public Member Functions | |
CentralControllerRpcServer (const GoogleString &listen_address, ExpensiveOperationController *expensive_operation_controller, ScheduleRewriteController *rewrite_controller, MessageHandler *handler) | |
int | Setup () override |
ControllerProcess implementation. | |
int | Run () override |
void | Stop () override |
Static Public Member Functions | |
static void | MainLoop (::grpc::CompletionQueue *queue) |
Pulled out into a static function so it can also be used in tests. | |
ControllerProcess implementation that starts a gRPC server which handles CentralController operations.
net_instaweb::CentralControllerRpcServer::CentralControllerRpcServer | ( | const GoogleString & | listen_address, |
ExpensiveOperationController * | expensive_operation_controller, | ||
ScheduleRewriteController * | rewrite_controller, | ||
MessageHandler * | handler | ||
) |
listen_address is passed directly into ServerBuilder::AddListeningPort, so theoretically it can be anything gRPC supports. In practice we expect it to be either "localhost:<port>" or "unix:<path>". This takes ownership of rewrite_controller.
|
overridevirtual |
Perform your work and return the exit status. Invoked only if Setup() returns 0. Stop() may be called before Run(), in which case Run() should return immediately.
The babysitter respawns the child whenever it dies for any reason other than exit(0). Thus, if the child is dying because it was asked to by the parent process (ie: Stop() was called) the return value of Run() is ignored and an exit status of 0 will be used.
Implements net_instaweb::ControllerProcess.
|
overridevirtual |
Notify the Run() thread to stop. Called from a different thread so must be thread safe. May be called before, during or after Run(), possibly multiple times.
Implements net_instaweb::ControllerProcess.