TaskManager Class Reference

Inheritance diagram for TaskManager:

List of all members.

Public Member Functions

 TaskManager (MasterConfigTree &config_tree, ModuleManager &mmgr, XorpClient &xclient, bool global_do_exec, bool verbose)
void set_do_exec (bool do_exec, bool is_verification)
void reset ()
int add_module (const ModuleCommand &mod_cmd, string &error_msg)
void add_xrl (const string &module_name, const UnexpandedXrl &xrl, XrlRouter::XrlCallback &cb)
void add_program (const string &module_name, const UnexpandedProgram &program, TaskProgramItem::ProgramCallback program_cb)
void shutdown_module (const string &module_name)
void run (CallBack cb)
XorpClientxorp_client () const
ModuleManagermodule_manager () const
MasterConfigTreeconfig_tree () const
bool do_exec () const
bool is_verification () const
bool verbose () const
EventLoopeventloop () const
void kill_process (const string &module_name)
 kill_process is used to kill a fatally wounded process
const RunShellCommand::ExecIdexec_id () const
 Get a reference to the ExecId object.
void set_exec_id (const RunShellCommand::ExecId &v)
 Set the execution ID for executing the tasks.

Private Types

typedef XorpCallback2< void,
bool, string >::RefPtr 

Private Member Functions

void reorder_tasks ()
void run_task ()
void task_done (bool success, const string &errmsg)
void fail_tasklist_initialization (const string &errmsg)
Taskfind_task (const string &module_name)
void null_callback ()

Private Attributes

bool _global_do_exec
bool _current_do_exec
bool _is_verification
bool _verbose
map< string, Task * > _tasks
list< Task * > _tasklist
list< Task * > _shutdown_order
map< string, const
ModuleCommand * > 
RunShellCommand::ExecId _exec_id
CallBack _completion_cb

Member Function Documentation

const RunShellCommand::ExecId& TaskManager::exec_id ( ) const [inline]

Get a reference to the ExecId object.

a reference to the ExecId object that is used for setting the execution ID when running the tasks.
void TaskManager::kill_process ( const string &  module_name)

kill_process is used to kill a fatally wounded process

kill_process is used to kill a fatally wounded process. This does not politely ask the process to die, because if we get here we can't communicate with the process using XRLs or any other mechanism, so we just kill it outright.

module_namethe module name of the process to be killed.
void TaskManager::set_exec_id ( const RunShellCommand::ExecId v) [inline]

Set the execution ID for executing the tasks.

vthe execution ID.
void TaskManager::task_done ( bool  success,
const string &  errmsg 
) [private]

This indicates we are badly out of sync. We got some callback we weren't expecting, basically. That this happens with the scenario below indicates the task-manager & task logic is busted somewhere. Reported by: Li Zhao 1. start rtrmgr from linux shell on the system; 2. manually start xorp_static_routes from linux shell. This static will hijack the xrl channels to rtrmgr; 3. use cli command "create protocol static" to start a second xorp_static_routes. 4. use cli command "delete protocol static" to stop static. both xorp_static_routes were terminated. depended process like fea, rib and policy were also terminated. rtrmgr crash.

With this check for empty task list, it at least doesn't crash, but the logic is still busted somewhere.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations