Task Monitoring Program design and implementation summary

Source: Internet
Author: User

1. Introduction 1.1 Upstream system1. The upstream system does not periodically send a plan XML file that contains a set of < types: task >; the upstream system needs to return a receipt after it receives the file. 2. Send status escalation commands on an unscheduled basis to inquire about plan execution.   1.2 Monitoring Program The monitoring system resembles the broker in the message queue, maintains the task queue, receives the plan issued by the upstream system, and dispatches the task to the downstream system for execution. 1. The monitoring program maintains a set of task queues, updating the corresponding task status according to the task status information sent by the downstream system. If the downstream system is idle, assign a new task to it.2. After the downstream system is offline, the monitoring program needs to reassign tasks that are not completed by the system. 3. After the monitoring program restarts, you can read the saved task Information reconstruction < type: task queue; rebuild < downstream system through downstream system escalation: Current Task > Association. 4. When the task status changes, you need to report status information to the upstream system.   1.3 Downstream Systems1. Each downstream system handles specific types of tasks, and multiple tasks of the same type can be assigned to multiple downstream systems for execution.2. The downstream system periodically sends the current task status (Heartbeat protocol). The status transitions for downstream systems are as follows:
2. Class diagram Design 1.GlobalTaskBufferusing a single-case model,Saves all the task information in the system, and builds different task queues depending on the type of task. 2.GlobalDownSysBuffer uses a singleton mode, saving all downstream system information, each downsys corresponding to a current task Curtask,curtask by the monitoring program dispatch allocation, the initial state is null. The 2.1 Getdownsys method searches for the corresponding Downsys object based on IP and port, and if not found, creates a new Downsys object and adds it to the Globaldownsysbuffer; 2.2 The heartbeat method accumulates the heartbeatcount of the Downsys object, and if the Heartbeatcount value exceeds the set threshold, the system considers the Downsys to be offline. Perform the Cleardiedownsys method to do Cleanup (if the Downsys corresponding task is executing, the task is considered to have been executed incorrectly, reassigned). The heartbeat method is called by the control's Heartbeattimerproc timer. Interaction between 3.BaseHandler processing and upstream and downstream systems 3.1 upsyshandler receives and resolves the plan XML sent by the system, sends a file receipt, receives a task escalation command, and builds and sends a task execution status receipt. 3.2 Downsyshandler assigns tasks to downstream systems, receives and resolves task status information sent by downstream systems, updates task status, maintenance <DownSys,Task> mapping, etc. The 4.Control class handles interactions with the upstream and downstream with the help of other classes. 3. Process flow (timing diagram)   1 handling interactions with upstream systems 2 handling of interactions with downstream systems

Task Monitoring Program design and implementation summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.