Refactor the scheduler with the task manager mechanism, this will reduce the duplicate code Signed-off-by: Wenkai Yin <yinw@vmware.com>