CN103368761B - A kind of scheduled service processing method and processing device - Google Patents

A kind of scheduled service processing method and processing device Download PDF

Info

Publication number
CN103368761B
CN103368761B CN201210094480.3A CN201210094480A CN103368761B CN 103368761 B CN103368761 B CN 103368761B CN 201210094480 A CN201210094480 A CN 201210094480A CN 103368761 B CN103368761 B CN 103368761B
Authority
CN
China
Prior art keywords
scheduled service
timer
service unit
timing
scheduled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210094480.3A
Other languages
Chinese (zh)
Other versions
CN103368761A (en
Inventor
史日辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201210094480.3A priority Critical patent/CN103368761B/en
Publication of CN103368761A publication Critical patent/CN103368761A/en
Application granted granted Critical
Publication of CN103368761B publication Critical patent/CN103368761B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of scheduled service processing method and processing device, belong to computer realm.Methods described includes:A scheduled service unit is created for a scheduled service;The relevant parameter of the scheduled service unit is set, and the relevant parameter includes:Time interval and cycle-index;Time interval identical scheduled service unit is added into same timer, the timer is timed the processing of business to scheduled service unit according to the relevant parameter.Described device includes:Creation module, setup module, add module.The timer of the present invention can manage multiple time interval identical scheduled services, a timer is established relative to each scheduled service, reduce the quantity of concurrent timer in the case of scheduled service quantity identical, it is easy to the maintenance and management of timer, and improves the operational efficiency of system.

Description

A kind of scheduled service processing method and processing device
Technical field
The present invention relates to computer realm, more particularly to a kind of scheduled service processing method and processing device.
Background technology
With the continuous development of cyber-net, the application based on scheduled service is also more and more.Tight to regularly having In the application of lattice requirement, for example, Flash game, can smooth efficiently handle scheduled service can directly influence Consumer's Experience.
In the prior art, a timer is often established respectively for each scheduled service, each timer is to it Corresponding scheduled service is individually timed management.For example, there is N number of scheduled service in one application, then need N number of for this Scheduled service establishes N number of timer, and N number of timer is individually timed management to its corresponding scheduled service respectively.
During the present invention is realized, inventor has found that prior art at least has problems with:
When scheduled service is more, concurrently many timers are understood, on the one hand can influence the operational efficiency of system, on the other hand It is unfavorable for the maintenance and management of timer.
The content of the invention
For the ease of managing and safeguarding timer, the operational efficiency of system is improved, it is fixed the embodiments of the invention provide one kind When method for processing business and device.The technical scheme is as follows:
On the one hand, the invention provides a kind of scheduled service processing method, methods described to include:
A scheduled service unit is created for a scheduled service;
The relevant parameter of the scheduled service unit is set, and the relevant parameter includes:Time interval and cycle-index;
Time interval identical scheduled service unit is added into same timer, makes the timer according to the related ginseng Several processing that business is timed to scheduled service unit.
Wherein, it is described that time interval identical scheduled service unit is added into same timer, including:
Determine whether timer be currently running with the scheduled service unit interval identical scheduled service, if Have timer be currently running with the scheduled service unit interval identical scheduled service, the scheduled service unit is added Enter the timer.
It is described to determine whether that timer is currently running and the scheduled service unit interval identical scheduled service Afterwards, methods described also includes:
It is with the scheduled service unit interval identical scheduled service, judgement if no timer is currently running No available free timer, if idle timers, the scheduled service unit is added into the idle timers, if do not had Idle timers, a timer is newly created, the scheduled service unit is added to the timer newly created.
Wherein, the relevant parameter also includes:Timing function and end function;
The timer is timed the processing of business according to the relevant parameter to scheduled service unit, including:
The timer starts timing to the scheduled service of scheduled service unit, whenever time interval is reached, readjustment meter When function restart timing, and cycle-index subtracts one, repeats process of the timer according to time interval timing, until circulation When number is 0, readjustment terminates the processing that function terminates the scheduled service.
Wherein, after the readjustment end function terminates the processing of the scheduled service, methods described also includes:
The timer judges whether also unclosed scheduled service unit, if it is, the timer continues with Unclosed scheduled service unit.
Other hand, present invention also offers a kind of scheduled service processing unit, described device includes:
Creation module, for creating a scheduled service unit for a scheduled service;
Setup module, for setting the relevant parameter of the scheduled service unit, the relevant parameter includes:Time interval And cycle-index;
Add module, for time interval identical scheduled service unit to be added into same timer, make the timer The processing of business is timed to scheduled service unit according to the relevant parameter.
Wherein, the add module includes:
Adding device, for determining whether that timer is currently running and the scheduled service unit interval identical Scheduled service, if timer be currently running with the scheduled service unit interval identical scheduled service, will described in Scheduled service unit adds the timer.
Wherein, the adding device, is additionally operable to
It is with the scheduled service unit interval identical scheduled service, judgement if no timer is currently running No available free timer, if idle timers, the scheduled service unit is added into the idle timers, if do not had Idle timers, a timer is newly created, the scheduled service unit is added to the timer newly created.
Wherein, described device also includes:
Timer, for starting timing to the scheduled service of scheduled service unit, whenever time interval is reached, readjustment meter When function restart timing, and cycle-index subtracts one, repeats process of the timer according to time interval timing, until circulation When number is 0, readjustment terminates the processing that function terminates the scheduled service.
Wherein, after the timer callback terminates the processing that function terminates the scheduled service, it is additionally operable to judge whether Also unclosed scheduled service unit, if it is, the timer continues with unclosed scheduled service unit.
The beneficial effect that technical scheme provided in an embodiment of the present invention is brought is:
By creating a scheduled service unit for scheduled service, and by time interval identical scheduled service unit The processing that same timer is timed business is added, such a timer can manage multiple time interval identical timings Business, a timer is established relative to each scheduled service, it is concurrently fixed to reduce in the case of scheduled service quantity identical When device quantity, be easy to the maintenance and management of timer, and improve the operational efficiency of system.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings Accompanying drawing.
Fig. 1 is the scheduled service process flow figure that the embodiment of the present invention one provides;
Fig. 2 is the scheduled service process flow figure that the embodiment of the present invention two provides;
Fig. 3 is the scheduled service processing unit structure chart that the embodiment of the present invention three provides;
Fig. 4 is another structure chart of scheduled service processing unit that the embodiment of the present invention three provides.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention Formula is described in further detail.
Embodiment one
A kind of scheduled service processing method is present embodiments provided, referring to Fig. 1, the method flow that the present embodiment provides is specific It is as follows:
101:A scheduled service unit is created for a scheduled service;
Specifically, determine whether timer be currently running with scheduled service unit interval identical scheduled service, If timer be currently running with scheduled service unit interval identical scheduled service, it is fixed that scheduled service unit is added When device.
Wherein, determine whether timer be currently running with scheduled service unit interval identical scheduled service it Afterwards, method also includes:If no timer is currently running and scheduled service unit interval identical scheduled service, judgement Whether available free timer, if idle timers, scheduled service unit is added into idle timers, if fixed without the free time When device, newly create a timer, scheduled service unit added into the timer that newly creates.
102:The relevant parameter of scheduled service unit is set, and relevant parameter includes:Time interval and cycle-index;
Further, relevant parameter also includes:Timing function and end function.
103:Time interval identical scheduled service unit is added into same timer, makes timer according to relevant parameter pair Scheduled service unit is timed the processing of business.
Specifically, timer is timed the processing of business according to relevant parameter to scheduled service unit, including:Timer Timing is started to the scheduled service of scheduled service unit, whenever time interval is reached, readjustment timing function restarts timing, And cycle-index subtracts one, process of the timer according to time interval timing is repeated, until when cycle-index is 0, readjustment terminates The processing of function stop timing business.
Wherein, after the processing that readjustment terminates function stop timing business, method also includes:Timer judges whether also There is unclosed scheduled service unit, if it is, timer continues with unclosed scheduled service unit.
The method that the present embodiment provides for scheduled service by creating a scheduled service unit, and by time interval Identical scheduled service unit adds the processing that same timer is timed business, and such a timer can manage multiple Time interval identical scheduled service, a timer is established relative to each scheduled service, in scheduled service quantity identical In the case of reduce the quantity of concurrent timer, be easy to the maintenance and management of timer, and improve the operational efficiency of system.
Embodiment two
A kind of scheduled service processing method is present embodiments provided, referring to Fig. 2, the method flow that the present embodiment provides is specific It is as follows:
201:Scheduled service processing unit is that a scheduled service creates a scheduled service unit;
Wherein, scheduled service processing unit can be various clients, such as mobile phone, computer, can also be server etc. Any need is timed the software or hardware of business processing, and the present embodiment does not limit the specific shape of scheduled service processing unit Formula.
In addition, scheduled service processing unit can create scheduled service unit according to the instruction of developer, also, it is each Individual scheduled service processing unit has a unique mark, for distinguishing different scheduled service units.
202:The relevant parameter of scheduled service unit is set, and relevant parameter includes:Time interval and cycle-index, further Relevant parameter can also include:Timing function and end function;
Wherein, time interval is set to delay, the timing of one scheduled service of product representation of time interval and cycle-index Time;Timing function is set to timer, for carrying out timing to every interval of time;Terminate function and be set to end, for terminating The processing of whole scheduled service.
203:Determine whether timer be currently running with the scheduled service unit interval identical scheduled service, such as Fruit is to perform step 204, otherwise, performs step 205;
It should be noted that in order to improve timer utilization rate, a timer in the present embodiment can be handled simultaneously Multiple time interval identical scheduled services.
204:When there is timer to be currently running with the scheduled service unit interval identical scheduled service, this is determined When business unit add and be currently running timer with the scheduled service unit interval identical scheduled service, perform step 208;
205:When no timer is currently running with the scheduled service unit interval identical scheduled service, judge Whether available free timer, if it is, perform step 206, otherwise, perform step 207;
It should be noted that in the present embodiment, the status indications of idle timers is the free time, run timing business it is non- The state representation of idle timers is operation.When determining whether idle timers, can according to the condition adjudgement of timer, If the state of timer is the free time, then illustrate available free timer, if the state of all timers is all operation, say It is bright there is no idle timers.
206:When available free timer, the scheduled service unit is added into idle timers, performs step 208;
207:When there is no idle timers, a timer is newly created, and the scheduled service unit is added into new create Timer, perform step 208;
208:Timer is timed the processing of business according to relevant parameter to scheduled service unit.
Specifically, timer starts timing to the scheduled service of scheduled service unit, and whenever time interval is reached, readjustment Timing function restarts timing, and cycle-index subtracts one, repeats process of the timer according to time interval timing, until following When ring number is 0, readjustment terminates the processing of function stop timing business.
After the processing that readjustment terminates function stop timing business, further, timer judges whether not tie also The scheduled service unit of beam, if it is, timer continues with unclosed scheduled service unit.
The method that the present embodiment provides for scheduled service by creating a scheduled service unit, and by time interval Identical scheduled service unit adds the processing that same timer is timed business, and such a timer can manage multiple Time interval identical scheduled service, a timer is established relative to each scheduled service, in scheduled service quantity identical In the case of reduce the quantity of concurrent timer, be easy to the maintenance and management of timer, and improve the operational efficiency of system.
Embodiment three
A kind of scheduled service processing unit is present embodiments provided, referring to Fig. 3, the device flow that the present embodiment provides is specific It is as follows:
Creation module 301, for creating a scheduled service unit for a scheduled service;
Setup module 302, for setting the relevant parameter of scheduled service unit, relevant parameter includes:Time interval and follow Ring number;
Add module 303, for time interval identical scheduled service unit to be added into same timer, make timer by Photograph related parameter is timed the processing of business to scheduled service unit.
Referring to Fig. 4, wherein, add module 303 includes:
Adding device 303a, for determining whether that timer is currently running and scheduled service unit interval identical Scheduled service, if timer be currently running with scheduled service unit interval identical scheduled service, by scheduled service Unit adds timer.
Adding device 303a, is additionally operable to
If no timer be currently running with scheduled service unit interval identical scheduled service, determine whether Idle timers, if idle timers, scheduled service unit is added into idle timers, if without idle timers, A timer is newly created, scheduled service unit is added to the timer newly created.
The device also includes:
Timer 304, for starting timing to the scheduled service of scheduled service unit, whenever time interval is reached, return Timing function is adjusted to restart timing, and cycle-index subtracts one, repeats process of the timer according to time interval timing, until When cycle-index is 0, readjustment terminates the processing of function stop timing business.
After adjusting back the processing for terminating function stop timing business in timer 304, it is additionally operable to judge whether not tie also The scheduled service unit of beam, if it is, timer 304 continues with unclosed scheduled service unit.
The present embodiment for scheduled service by creating a scheduled service unit, and by the timing of time interval identical Business unit adds the processing that same timer is timed business, and such a timer can manage multiple time interval phases Same scheduled service, establishes a timer relative to each scheduled service, is reduced in the case of scheduled service quantity identical The quantity of concurrent timer, is easy to the maintenance and management of timer, and improve the operational efficiency of system.
It should be noted that:A kind of scheduled service processing unit that above-described embodiment provides is when handling scheduled service, only With the division progress of above-mentioned each functional module for example, in practical application, can as needed and by above-mentioned function distribution by Different functional modules is completed, i.e., the internal structure of device is divided into different functional modules, described above complete to complete Portion or partial function.In addition, a kind of scheduled service processing unit and a kind of scheduled service processing side of above-described embodiment offer Method embodiment belongs to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that hardware can be passed through by realizing all or part of step of above-described embodiment To complete, by program the hardware of correlation can also be instructed to complete, described program can be stored in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent substitution and improvements made etc., it should be included in the scope of the protection.

Claims (6)

1. a kind of scheduled service processing method, it is characterised in that methods described includes:
A scheduled service unit is created for a scheduled service;
The relevant parameter of the scheduled service unit is set, and the relevant parameter includes:Time interval and cycle-index, when described Between interval and the timing of one scheduled service of product representation of the cycle-index;
Determine whether timer be currently running with the scheduled service unit interval identical scheduled service, if fixed When device be currently running with the scheduled service unit interval identical scheduled service, by the scheduled service unit add institute Timer is stated, the timer is timed the processing of business to scheduled service unit according to the relevant parameter;
If no timer be currently running with the scheduled service unit interval identical scheduled service, determine whether Idle timers, if idle timers, the scheduled service unit is added into the idle timers, if without the free time Timer, a timer is newly created, the scheduled service unit is added to the timer newly created.
2. according to the method for claim 1, it is characterised in that the relevant parameter also includes:Timing function and end letter Number;
The timer is timed the processing of business according to the relevant parameter to scheduled service unit, including:
The timer starts timing to the scheduled service of scheduled service unit, whenever time interval is reached, adjusts back timing letter Number restarts timing, and cycle-index subtracts one, repeats process of the timer according to time interval timing, until cycle-index For 0 when, readjustment terminates function and terminates the processing of the scheduled service.
3. according to the method for claim 2, it is characterised in that the readjustment terminates the place that function terminates the scheduled service After reason, methods described also includes:
The timer judges whether also unclosed scheduled service unit, if it is, the timer is continued with and do not tied The scheduled service unit of beam.
4. a kind of scheduled service processing unit, it is characterised in that described device includes:
Creation module, for creating a scheduled service unit for a scheduled service;
Setup module, for setting the relevant parameter of the scheduled service unit, the relevant parameter includes:Time interval and follow Ring number, the timing of the time interval and one scheduled service of product representation of the cycle-index;
Add module, for determining whether that timer is currently running and scheduled service unit interval identical timing Business, if timer be currently running with the scheduled service unit interval identical scheduled service, by the timing Business unit adds the timer, the timer is timed business to scheduled service unit according to the relevant parameter Processing;
The add module, it is currently running and the scheduled service unit interval identical if being additionally operable to no timer Scheduled service, idle timers are determined whether, if idle timers, the scheduled service unit is added into the free time Timer, if without idle timers, a timer is newly created, the scheduled service unit is added to the timing newly created Device.
5. device according to claim 4, it is characterised in that described device also includes:
Timer, for starting timing to the scheduled service of scheduled service unit, whenever time interval is reached, adjust back timing letter Number restarts timing, and cycle-index subtracts one, repeats process of the timer according to time interval timing, until cycle-index For 0 when, readjustment terminates function and terminates the processing of the scheduled service.
6. device according to claim 5, it is characterised in that the timer callback terminates function and terminates the timing industry After the processing of business, it is additionally operable to judge whether also unclosed scheduled service unit, if it is, the timer continues with Unclosed scheduled service unit.
CN201210094480.3A 2012-04-01 A kind of scheduled service processing method and processing device Active CN103368761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210094480.3A CN103368761B (en) 2012-04-01 A kind of scheduled service processing method and processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210094480.3A CN103368761B (en) 2012-04-01 A kind of scheduled service processing method and processing device

Publications (2)

Publication Number Publication Date
CN103368761A CN103368761A (en) 2013-10-23
CN103368761B true CN103368761B (en) 2018-02-09

Family

ID=

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870767A (en) * 2005-12-14 2006-11-29 华为技术有限公司 Method for managing timer task

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870767A (en) * 2005-12-14 2006-11-29 华为技术有限公司 Method for managing timer task

Similar Documents

Publication Publication Date Title
Lee et al. A dynamic priority scheduling algorithm on service request scheduling in cloud computing
CN103246546B (en) Based on open electric system Numeral Emulation System and the emulation mode thereof of cloud
CN102243598B (en) Method for scheduling task in Distributed Data Warehouse and system
CN101339521B (en) Tasks priority dynamic dispatching algorithm
CN106980532A (en) A kind of job scheduling method and device
CN103346902B (en) The method and system of data acquisition scheduling
CN104954478A (en) System and method for realizing automatic longitudinal scaling of server in cloud computing platform
CN105975049B (en) A kind of accidental task low energy consumption dispatching method of tasks synchronization
CN107689982A (en) Multi-data source method of data synchronization, application server and computer-readable recording medium
CN103257896B (en) A kind of Max-D job scheduling method under cloud environment
CN102981890A (en) Computing task and virtual machine deploying method within a virtual data center
CN107292419A (en) The Cost Optimization strategy that dynamic Multi-workflow scheduling is performed in a kind of mixing cloud environment
CN103336684B (en) The AC of a kind of concurrent processing AP message and processing method thereof
CN103679388A (en) Production scheduling method and system
CN106776025A (en) A kind of computer cluster job scheduling method and its device
CN105389207A (en) Adaptive data request processing method and apparatus, task scheduler and adaptive data request processing system
CN103023980A (en) Method and system for processing user service request by cloud platform
CN108829519A (en) Method for scheduling task, cloud platform and computer readable storage medium based on cloud platform
CN104123185A (en) Resource scheduling method, device and system
CN106445936A (en) Data processing method and equipment
CN103368761B (en) A kind of scheduled service processing method and processing device
CN110275765A (en) Data parallel job scheduling method based on branch DAG dependency
CN109800074A (en) Task data concurrently executes method, apparatus and electronic equipment
CN103617048B (en) Virtual machine connection pool grouping system and grouping connection method
CN110377411B (en) Distributed cloud-oriented workflow task scheduling method and system

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant