CN105630585A - Periodic task processing method and apparatus - Google Patents

Periodic task processing method and apparatus Download PDF

Info

Publication number
CN105630585A
CN105630585A CN201510967738.XA CN201510967738A CN105630585A CN 105630585 A CN105630585 A CN 105630585A CN 201510967738 A CN201510967738 A CN 201510967738A CN 105630585 A CN105630585 A CN 105630585A
Authority
CN
China
Prior art keywords
periodic task
pending
identification information
time
set list
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.)
Pending
Application number
CN201510967738.XA
Other languages
Chinese (zh)
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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510967738.XA priority Critical patent/CN105630585A/en
Publication of CN105630585A publication Critical patent/CN105630585A/en
Priority to PCT/CN2016/110141 priority patent/WO2017107843A1/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a periodic task processing method and apparatus, which relate to the technical field of information and can reduce the development cost of newly added periodic tasks and realize unified packaging and management of the periodic tasks. The method comprises the steps of when an instruction of adding a new to-be-executed periodic task is received, firstly obtaining identifier information and period time corresponding to the to-be-executed periodic task; secondly adding the identifier information and the period time into a preset list, wherein the preset list stores identifier information corresponding to different to-be-executed periodic tasks and period time corresponding to each to-be-executed periodic task; and finally according to the period time corresponding to each to-be-executed periodic task, detecting whether identifier information corresponding to the to-be-executed periodic task outside the period exists in the preset list or not; and if yes, obtaining and executing the to-be-executed periodic task corresponding to the identifier information.

Description

The processing method of periodic task and device
Technical field
The present invention relates to a kind of areas of information technology, particularly relate to processing method and the device of a kind of periodic task.
Background technology
Along with the development of information technology, the demand of periodic task is more and more extensive. Such as, for browser, it will usually have some requests needing the cycle to perform. Periodic task is primarily referred to as the task of needing to perform after a certain interval. For there being periodically needing of task, typically require guarantee control thread to exist always, such as, no matter it is use ScheduledExecutorService instrument or use timer+Handler instrument task performance period to be required for ensureing that controlling thread exists always. Both it had been not only restricted to whether thread exists for how can guarantee that, can guarantee that again that startup can both carry out being periodically detected having become as the problem that user becomes more concerned with every time.
Currently for the task of needing periodically execution, after a tasks carrying, being recorded as the time, next time judges whether within the cycle when performing again, if being in cycle time, does not perform, if it exceeds cycle time then performs. But, aforesaid way is in the scene that periodic task demand is more, it is necessary to for different demands encapsulation process respectively, whenever the newly-increased periodic task of needs, development cost can be caused higher.
Summary of the invention
In view of this, the invention provides the processing method of a kind of periodic task and device, main purpose is in that to reduce the development cost to newly-increased periodic task, it is possible to achieve by unified for periodic task encapsulation and management.
According to one aspect of the invention, it is provided that the processing method of a kind of periodic task, the method includes:
When receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time;
Described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding;
According to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding;
If existing, then obtain the pending periodic task corresponding with described identification information and perform.
According to another aspect of the present invention, it is provided that the process device of a kind of periodic task, this device includes:
Acquiring unit, for when receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time;
Adding device, add in pre-set list for the identification information that described acquiring unit is obtained and described cycle time, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding;
Detection unit, for the cycle time corresponding according to described each pending periodic task, detects the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding;
Described acquiring unit, if being additionally operable to the identification information that pending periodic task that described detection unit detects that in described pre-set list, existence is in outside the cycle is corresponding, then obtains the pending periodic task corresponding with described identification information;
Performance element, for performing the pending periodic task corresponding with described identification information.
By technique scheme, the technical scheme that the embodiment of the present invention provides at least has the advantage that
The processing method of a kind of periodic task provided by the invention and device, when receive add new pending periodic task instruction time, first obtain identification information corresponding to described pending periodic task and cycle time; Then described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding; Finally according to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding; If existing, then obtain the pending periodic task corresponding with described identification information and perform. Compared with needing, with currently for different periodic task demands, the mode that processes respectively, the present invention is by by the identification information of newly-increased pending periodic task and add to cycle time in pre-set list, by pre-set list, the task of be there is a need to periodically perform is managed, and then achieve the task that encapsulation be there is a need to periodically perform, it can be carried out unified management, greatly reduce the development cost to newly-increased pending periodic task. And allowing periodic task be easy to management especially unified for periodic task encapsulation and management, code is easy to read, and decreases the probability that related realization goes wrong. For including being periodically detected renewal, periodically updating the demands such as configuration information can add easily and manage.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, and can be practiced according to the content of description, and in order to above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Accompanying drawing explanation
By reading hereafter detailed description of the preferred embodiment, various other advantage and benefit those of ordinary skill in the art be will be clear from understanding. Accompanying drawing is only for illustrating the purpose of preferred implementation, and is not considered as limitation of the present invention. And in whole accompanying drawing, it is denoted by the same reference numerals identical parts. In the accompanying drawings:
Fig. 1 illustrates the process flow schematic diagram of a kind of periodic task that the embodiment of the present invention provides;
Fig. 2 illustrates the process flow schematic diagram of the another kind of periodic task that the embodiment of the present invention provides;
Fig. 3 illustrates the process apparatus structure schematic diagram of a kind of periodic task that the embodiment of the present invention provides;
Fig. 4 illustrates the process apparatus structure schematic diagram of the another kind of periodic task that the embodiment of the present invention provides.
Detailed description of the invention
It is more fully described the exemplary embodiment of the disclosure below with reference to accompanying drawings. Although accompanying drawing showing the exemplary embodiment of the disclosure, it being understood, however, that may be realized in various forms the disclosure and should do not limited by embodiments set forth here. On the contrary, it is provided that these embodiments are able to be best understood from the disclosure, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Embodiments provide the processing method of a kind of periodic task, as it is shown in figure 1, described method includes:
101, when receive add new pending periodic task instruction time, obtain identification information corresponding to pending periodic task and cycle time.
Wherein, described identification information can be the title of pending periodic task, ID (Identity, identity number) number etc.
102, identification information corresponding for pending periodic task and cycle time are added in pre-set list.
Wherein, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding. Described pre-set list can configure according to the actual requirements.
103, according to the cycle time that each pending periodic task is corresponding, whether detection pre-set list exists the identification information that the pending periodic task outside the cycle of being in is corresponding.
Such as, pre-set list exists the identification information that 3 pending periodic tasks are corresponding, respectively task a, task b, task c, cycle time corresponding for task a is 10 seconds, cycle time corresponding for task b is 1 hour, cycle time corresponding for task c is 2 hours, calculating current time and these 3 pending periodic task last times respectively runs succeeded the difference between the execution time, the difference obtained respectively 11 seconds, 10 minutes, 2 hours, it is possible to determine that task a and task c is in that the cycle is outer and task b was in the cycle.
If 104 detect the identification information that pending periodic task that in pre-set list, existence is in outside the cycle is corresponding, then obtain the pending periodic task corresponding with identification information and perform.
The processing method of a kind of periodic task that the embodiment of the present invention provides, when receive add new pending periodic task instruction time, first obtain identification information corresponding to described pending periodic task and cycle time; Then described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding; Finally according to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding; If existing, then obtain the pending periodic task corresponding with described identification information and perform. Compared with needing, with currently for different periodic task demands, the mode that processes respectively, the present invention is by by the identification information of newly-increased pending periodic task and add to cycle time in pre-set list, by pre-set list, the task of be there is a need to periodically perform is managed, and then achieve the task that encapsulation be there is a need to periodically perform, it can be carried out unified management, greatly reduce the development cost to newly-increased pending periodic task. And allowing periodic task be easy to management especially unified for periodic task encapsulation and management, code is easy to read, and decreases the probability that related realization goes wrong. For including being periodically detected renewal, periodically updating the demands such as configuration information can add easily and manage.
Embodiments provide the processing method of another kind of periodic task, as in figure 2 it is shown, described method includes:
201, when receive add new pending periodic task instruction time, obtain identification information corresponding to pending periodic task and cycle time.
Wherein, described identification information can be the title of pending periodic task, No. ID etc.
For the embodiment of the present invention, described step 201 specifically may include that and obtains, by preset getTaskName interface function, the identification information that described pending periodic task is corresponding, and obtains, by preset getPeriodic interface function, the cycle time that described pending periodic task is corresponding. Wherein, described preset getTaskName interface function and described preset getPeriodic interface function can configure according to the actual requirements.
202, identification information corresponding for pending periodic task and cycle time are added in pre-set list.
Wherein, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding. Described pre-set list can configure according to the actual requirements.
For the embodiment of the present invention, before described step 202, it is also possible to including: by preset postDelayed interface function, it is judged that whether described pre-set list exists described identification information; If being absent from, then perform described step 202. Wherein, described preset postDelayed interface function can configure according to the actual requirements. It should be noted that, by judging whether described pre-set list exists described identification information, can avoid being saved in pre-set list by identification information corresponding for the pending periodic task repeated, and then avoid same pending periodic task is carried out repeated detection, it is possible to improve the efficiency of detection.
203, each pending successful execution time periodic task last time and current time in pre-set list is obtained.
204, according to each pending successful execution time periodic task last time and current time, the reference time that each pending periodic task is corresponding is calculated.
For the embodiment of the present invention, described step 204 specifically may include that the described current time of calculating and the difference between described each pending successful execution time periodic task last time, obtains the reference time that described each pending periodic task is corresponding.
205, whether detection pre-set list exist the reference time identification information corresponding more than or equal to the pending periodic task of corresponding cycle time.
For the embodiment of the present invention, described step 205 specifically may include that by preset onPost interface function, detects and whether there is the reference time identification information corresponding more than or equal to the pending periodic task of corresponding cycle time in described pre-set list. Wherein, described preset onPost interface function can configure according to the actual requirements.
Such as, pre-set list exists the identification information that 3 pending periodic tasks are corresponding, respectively task 1, task 2, task 3, the cycle time of task 1 correspondence is 30 seconds, the cycle time of task 2 correspondence is 10 hours, cycle time corresponding for task c is 2 weeks, calculating current time and these 3 pending periodic task last times respectively runs succeeded the difference between the execution time, the difference obtained respectively 45 seconds, 30 minutes, 1 week, it is possible to determine that task a is in that the cycle is outer and task b and task c was in the cycle.
If 206 detect there is the reference time identification information corresponding more than or equal to the pending periodic task of corresponding cycle time in pre-set list, then obtain the pending periodic task corresponding with identification information and perform.
Further, described method can also include: according to the cycle time that described each pending periodic task is corresponding, according to preset time interval detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding. Wherein, described preset time interval can configure in the actual demand of user, it is also possible to being configured by system default, the embodiment of the present invention does not limit. Such as, described preset time interval is configurable to 0.1s, 1s etc.
Further, described method can also include: performs all of pending periodic task in pre-set list by preset postAllNow interface function; Pending periodic task is re-executed by preset resume interface function; Suspended by preset stop interface function and perform pending periodic task; By preset start interface function initialization data. It should be noted that can better be controlled the execution of periodic task by these preset interface functions, conveniently it is managed.
The processing method of another kind of periodic task that the embodiment of the present invention provides, when receive add new pending periodic task instruction time, first obtain identification information corresponding to described pending periodic task and cycle time; Then described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding; Finally according to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding; If existing, then obtain the pending periodic task corresponding with described identification information and perform. Compared with needing, with currently for different periodic task demands, the mode that processes respectively, the present invention is by by the identification information of newly-increased pending periodic task and add to cycle time in pre-set list, by pre-set list, the task of be there is a need to periodically perform is managed, and then achieve the task that encapsulation be there is a need to periodically perform, it can be carried out unified management, greatly reduce the development cost to newly-increased pending periodic task. And allowing periodic task be easy to management especially unified for periodic task encapsulation and management, code is easy to read, and decreases the probability that related realization goes wrong. For including being periodically detected renewal, periodically updating the demands such as configuration information can add easily and manage.
Further, as implementing of method described in Fig. 1, the process device of a kind of periodic task is embodiments provided, as it is shown on figure 3, described device includes: acquiring unit 31, adding device 32, detection unit 33, performance element 34.
Described acquiring unit 31, it is possible to for when receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time.
Described adding device 32, may be used for the identification information that obtained by described acquiring unit 31 and add in pre-set list described cycle time, described pre-set list is preserved different pending periodic task identification information corresponding respectively and cycle time corresponding to each pending periodic task.
Described detection unit 33, it is possible to for the cycle time corresponding according to described each pending periodic task, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding.
Described acquiring unit 31, it is also possible to if detecting, for described detection unit 33, the identification information that pending periodic task that in described pre-set list, existences is in outside the cycle is corresponding, then the pending periodic task that acquisition is corresponding with described identification information.
Described performance element 34, it is possible to for performing the pending periodic task corresponding with described identification information.
It should be noted that other of each functional unit involved by the process device of a kind of periodic task of embodiment of the present invention offer describe accordingly, it is possible to reference to the corresponding description in Fig. 1, do not repeat them here.
The process device of a kind of periodic task that the embodiment of the present invention provides, when receive add new pending periodic task instruction time, first obtain identification information corresponding to described pending periodic task and cycle time; Then described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding; Finally according to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding; If existing, then obtain the pending periodic task corresponding with described identification information and perform. Compared with needing, with currently for different periodic task demands, the mode that processes respectively, the present invention is by by the identification information of newly-increased pending periodic task and add to cycle time in pre-set list, by pre-set list, the task of be there is a need to periodically perform is managed, and then achieve the task that encapsulation be there is a need to periodically perform, it can be carried out unified management, greatly reduce the development cost to newly-increased pending periodic task. And allowing periodic task be easy to management especially unified for periodic task encapsulation and management, code is easy to read, and decreases the probability that related realization goes wrong. For including being periodically detected renewal, periodically updating the demands such as configuration information can add easily and manage.
Further, as implementing of method described in Fig. 2, embodiments providing the process device of another kind of periodic task, as shown in Figure 4, described device includes: acquiring unit 41, adding device 42, detection unit 43, performance element 44.
Described acquiring unit 41, it is possible to for when receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time.
Described adding device 42, may be used for the identification information that obtained by described acquiring unit 41 and add in pre-set list described cycle time, described pre-set list is preserved different pending periodic task identification information corresponding respectively and cycle time corresponding to each pending periodic task.
Described detection unit 43, it is possible to for the cycle time corresponding according to described each pending periodic task, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding.
Described acquiring unit 41, it is also possible to if detecting, for described detection unit 43, the identification information that pending periodic task that in described pre-set list, existences is in outside the cycle is corresponding, then the pending periodic task that acquisition is corresponding with described identification information.
Described performance element 44, it is possible to for performing the pending periodic task corresponding with described identification information.
Further, described device also includes: computing unit 45.
Described acquiring unit 41, it is also possible to be used for obtaining in described pre-set list each pending successful execution time periodic task last time and current time.
Described computing unit 45, it is possible to for each pending successful execution time periodic task last time obtained according to described acquiring unit 41 and described current time, calculate the reference time that each pending periodic task is corresponding.
Described detection unit 43, specifically may be used for detecting whether there is the identification information corresponding more than or equal to the pending periodic task of corresponding cycle time of described reference time in described pre-set list.
Described computing unit 45, specifically may be used for calculating the difference between described current time and described each pending successful execution time periodic task last time, obtains the reference time that described each pending periodic task is corresponding.
Described detection unit 43, it is also possible to for the cycle time corresponding according to described each pending periodic task, according to preset time interval detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
Described acquiring unit 41, specifically may be used for obtaining, by preset getTaskName interface function, the identification information that described pending periodic task is corresponding, and obtain, by preset getPeriodic interface function, the cycle time that described pending periodic task is corresponding.
Described detection unit 43, specifically may be used for the cycle time corresponding according to described each pending periodic task, by preset onPost interface function detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
Further, described device also includes: judging unit 46.
Described judging unit 46, it is possible to for by preset postDelayed interface function, it is judged that whether there is described identification information in described pre-set list.
Described adding device 42, if specifically may be used for described judging unit 46 to judge to be absent from described pre-set list described identification information, then adds to described identification information and described cycle time in pre-set list.
It should be noted that other of each functional unit involved by the process device of the another kind of periodic task of embodiment of the present invention offer describe accordingly, it is possible to reference to the corresponding description in Fig. 2, do not repeat them here.
The process device of another kind of periodic task that the embodiment of the present invention provides, when receive add new pending periodic task instruction time, first obtain identification information corresponding to described pending periodic task and cycle time; Then described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding; Finally according to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding; If existing, then obtain the pending periodic task corresponding with described identification information and perform. Compared with needing, with currently for different periodic task demands, the mode that processes respectively, the present invention is by by the identification information of newly-increased pending periodic task and add to cycle time in pre-set list, by pre-set list, the task of be there is a need to periodically perform is managed, and then achieve the task that encapsulation be there is a need to periodically perform, it can be carried out unified management, greatly reduce the development cost to newly-increased pending periodic task. And allowing periodic task be easy to management especially unified for periodic task encapsulation and management, code is easy to read, and decreases the probability that related realization goes wrong. For including being periodically detected renewal, periodically updating the demands such as configuration information can add easily and manage.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, certain embodiment there is no the part described in detail, it is possible to referring to the associated description of other embodiments.
It is understood that the correlated characteristic in said method and device can reference mutually. It addition, " first ", " second " in above-described embodiment etc. is for distinguishing each embodiment, and do not represent the quality of each embodiment.
Those skilled in the art is it can be understood that arrive, for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, it is possible to reference to the corresponding process in preceding method embodiment, do not repeat them here.
Not intrinsic to any certain computer, virtual system or miscellaneous equipment relevant in algorithm and the display of this offer. Various general-purpose systems can also with use based on together with this teaching. As described above, the structure constructed required by this kind of system is apparent from. Additionally, the present invention is also not for any certain programmed language. It is understood that, it is possible to utilize various programming language to realize the content of invention described herein, and the description above language-specific done is the preferred forms in order to disclose the present invention.
In description mentioned herein, describe a large amount of detail. It is to be appreciated, however, that embodiments of the invention can be put into practice when not having these details. In some instances, known method, structure and technology it are not shown specifically, in order to do not obscure the understanding of this description.
Similarly, it is to be understood that, one or more in order to what simplify that the disclosure helping understands in each inventive aspect, herein above in the description of the exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or descriptions thereof sometimes. But, the method for the disclosure should be construed to and reflect an intention that namely the present invention for required protection requires feature more more than the feature being expressly recited in each claim. More precisely, as the following claims reflect, inventive aspect is in that all features less than single embodiment disclosed above. Therefore, it then follows claims of detailed description of the invention are thus expressly incorporated in this detailed description of the invention, wherein each claim itself as the independent embodiment of the present invention.
Those skilled in the art are appreciated that, it is possible to carry out the module in the equipment in embodiment adaptively changing and they being arranged in one or more equipment different from this embodiment. Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition. Except at least some in such feature and/or process or unit excludes each other, it is possible to adopt any combination that all processes or the unit of all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment are combined. Unless expressly stated otherwise, each feature disclosed in this specification (including adjoint claim, summary and accompanying drawing) can be replaced by the alternative features providing purpose identical, equivalent or similar.
In addition, those skilled in the art it will be appreciated that, although embodiments more described herein include some feature included in other embodiments rather than further feature, but the combination of the feature of different embodiment means to be within the scope of the present invention and form different embodiments. Such as, in the following claims, the one of any of embodiment required for protection can mode use in any combination.
The all parts embodiment of the present invention can realize with hardware, or realizes with the software module run on one or more processor, or realizes with their combination. It will be understood by those of skill in the art that the some or all functions of some or all parts in the processing method of a kind of periodic task that microprocessor or digital signal processor (DSP) can be used in practice to realize according to embodiments of the present invention and device. The present invention is also implemented as part or all the equipment for performing method as described herein or device program (such as, computer program and computer program). The program of such present invention of realization can store on a computer-readable medium, or can have the form of one or more signal. Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described rather than limits the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment without departing from the scope of the appended claims. In the claims, any reference marks that should not will be located between bracket is configured to limitations on claims. Word " comprises " and does not exclude the presence of the element or step not arranged in the claims. Word "a" or "an" before being positioned at element does not exclude the presence of multiple such element. The present invention by means of including the hardware of some different elements and can realize by means of properly programmed computer. In the unit claim listing some devices, several in these devices can be through same hardware branch and specifically embody. Word first, second and third use do not indicate that any order. Can be title by these word explanations.
A1, a kind of periodic task processing method, including:
When receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time;
Described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding;
According to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding;
If existing, then obtain the pending periodic task corresponding with described identification information and perform.
A2, periodic task as described in A1 processing method, the described cycle time corresponding according to described each pending periodic task, before detecting the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding, described method also includes:
Obtain each pending successful execution time periodic task last time and current time in described pre-set list;
According to described each pending successful execution time periodic task last time and described current time, calculate the reference time that each pending periodic task is corresponding;
The described cycle time corresponding according to described each pending periodic task, the identification information detecting the pending periodic task whether existing outside the cycle of being in described pre-set list corresponding includes:
Detect and whether described pre-set list exists the identification information corresponding more than or equal to the pending periodic task of corresponding cycle time of described reference time.
A3, periodic task as described in A2 processing method, described according to described each pending successful execution time periodic task last time and described current time, the reference time calculating each pending periodic task corresponding includes:
Calculate the difference between described current time and described each pending successful execution time periodic task last time, obtain the reference time that described each pending periodic task is corresponding.
A4, periodic task as described in A1 processing method, described method also includes:
According to the cycle time that described each pending periodic task is corresponding, according to preset time interval detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
A5, periodic task as described in A1 processing method, identification information that the described pending periodic task of described acquisition is corresponding and including cycle time:
Obtain, by preset getTaskName interface function, the identification information that described pending periodic task is corresponding, and obtain, by preset getPeriodic interface function, the cycle time that described pending periodic task is corresponding.
A6, periodic task as described in A1 processing method, the described cycle time corresponding according to described each pending periodic task, the identification information detecting the pending periodic task whether existing outside the cycle of being in described pre-set list corresponding includes:
According to the cycle time that described each pending periodic task is corresponding, by preset onPost interface function detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
A7, periodic task as described in A1 processing method, described described identification information and described cycle time are added in pre-set list before, described method also includes:
By preset postDelayed interface function, it is judged that whether described pre-set list exists described identification information;
Described add described identification information and described cycle time to pre-set list and include:
If being absent from, then described identification information and described cycle time are added in pre-set list.
B8, a kind of periodic task process device, including:
Acquiring unit, for when receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time;
Adding device, add in pre-set list for the identification information that described acquiring unit is obtained and described cycle time, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding;
Detection unit, for the cycle time corresponding according to described each pending periodic task, detects the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding;
Described acquiring unit, if being additionally operable to the identification information that pending periodic task that described detection unit detects that in described pre-set list, existence is in outside the cycle is corresponding, then obtains the pending periodic task corresponding with described identification information;
Performance element, for performing the pending periodic task corresponding with described identification information.
B9, periodic task as described in B8 process device, described device also includes: computing unit;
Described acquiring unit, is additionally operable to obtain in described pre-set list each pending successful execution time periodic task last time and current time;
Described computing unit, for each pending successful execution time periodic task last time obtained according to described acquiring unit and described current time, calculates the reference time that each pending periodic task is corresponding;
Whether described detection unit, exist the identification information corresponding more than or equal to the pending periodic task of corresponding cycle time of described reference time specifically for detecting in described pre-set list.
B10, periodic task as described in B9 process device,
Described computing unit, specifically for calculating the difference between described current time and described each pending successful execution time periodic task last time, obtains the reference time that described each pending periodic task is corresponding.
B11, periodic task as described in B8 process device,
Described detection unit, is additionally operable to the cycle time corresponding according to described each pending periodic task, according to preset time interval detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
B12, periodic task as described in B8 process device,
Described acquiring unit, specifically for obtaining, by preset getTaskName interface function, the identification information that described pending periodic task is corresponding, and obtains, by preset getPeriodic interface function, the cycle time that described pending periodic task is corresponding.
B13, periodic task as described in B8 process device,
Described detection unit, specifically for the cycle time corresponding according to described each pending periodic task, by preset onPost interface function detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
B14, periodic task as described in B8 process device, described device also includes: judging unit;
Described judging unit, for by preset postDelayed interface function, it is judged that whether there is described identification information in described pre-set list;
Described adding device, if judging to be absent from described identification information in described pre-set list specifically for described judging unit, then adds to described identification information and described cycle time in pre-set list.

Claims (10)

1. the processing method of a periodic task, it is characterised in that including:
When receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time;
Described identification information and described cycle time are added in pre-set list, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding;
According to the cycle time that described each pending periodic task is corresponding, detect the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding;
If existing, then obtain the pending periodic task corresponding with described identification information and perform.
2. the processing method of periodic task according to claim 1, it is characterized in that, the described cycle time corresponding according to described each pending periodic task, before detecting the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding, described method also includes:
Obtain each pending successful execution time periodic task last time and current time in described pre-set list;
According to described each pending successful execution time periodic task last time and described current time, calculate the reference time that each pending periodic task is corresponding;
The described cycle time corresponding according to described each pending periodic task, the identification information detecting the pending periodic task whether existing outside the cycle of being in described pre-set list corresponding includes:
Detect and whether described pre-set list exists the identification information corresponding more than or equal to the pending periodic task of corresponding cycle time of described reference time.
3. the processing method of periodic task according to claim 2, it is characterized in that, described according to described each pending successful execution time periodic task last time and described current time, the reference time calculating each pending periodic task corresponding includes:
Calculate the difference between described current time and described each pending successful execution time periodic task last time, obtain the reference time that described each pending periodic task is corresponding.
4. the processing method of periodic task according to claim 1, it is characterised in that described method also includes:
According to the cycle time that described each pending periodic task is corresponding, according to preset time interval detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
5. the processing method of periodic task according to claim 1, it is characterised in that identification information that the described pending periodic task of described acquisition is corresponding and including cycle time:
Obtain, by preset getTaskName interface function, the identification information that described pending periodic task is corresponding, and obtain, by preset getPeriodic interface function, the cycle time that described pending periodic task is corresponding.
6. the processing method of periodic task according to claim 1, it is characterized in that, the described cycle time corresponding according to described each pending periodic task, the identification information detecting the pending periodic task whether existing outside the cycle of being in described pre-set list corresponding includes:
According to the cycle time that described each pending periodic task is corresponding, by preset onPost interface function detects in described pre-set list whether there is the identification information that the pending periodic task outside the cycle of being in is corresponding.
7. the processing method of periodic task according to claim 1, it is characterised in that described described identification information and described cycle time are added in pre-set list before, described method also includes:
By preset postDelayed interface function, it is judged that whether described pre-set list exists described identification information;
Described add described identification information and described cycle time to pre-set list and include:
If being absent from, then described identification information and described cycle time are added in pre-set list.
8. the process device of a periodic task, it is characterised in that including:
Acquiring unit, for when receive add new pending periodic task instruction time, obtain identification information corresponding to described pending periodic task and cycle time;
Adding device, add in pre-set list for the identification information that described acquiring unit is obtained and described cycle time, described pre-set list is preserved the identification information of different pending periodic task correspondence respectively and the cycle time that each pending periodic task is corresponding;
Detection unit, for the cycle time corresponding according to described each pending periodic task, detects the identification information that the pending periodic task whether existing outside the cycle of being in described pre-set list is corresponding;
Described acquiring unit, if being additionally operable to the identification information that pending periodic task that described detection unit detects that in described pre-set list, existence is in outside the cycle is corresponding, then obtains the pending periodic task corresponding with described identification information;
Performance element, for performing the pending periodic task corresponding with described identification information.
9. the process device of periodic task according to claim 8, it is characterised in that described device also includes: computing unit;
Described acquiring unit, is additionally operable to obtain in described pre-set list each pending successful execution time periodic task last time and current time;
Described computing unit, for each pending successful execution time periodic task last time obtained according to described acquiring unit and described current time, calculates the reference time that each pending periodic task is corresponding;
Whether described detection unit, exist the identification information corresponding more than or equal to the pending periodic task of corresponding cycle time of described reference time specifically for detecting in described pre-set list.
10. the process device of periodic task according to claim 9, it is characterised in that
Described computing unit, specifically for calculating the difference between described current time and described each pending successful execution time periodic task last time, obtains the reference time that described each pending periodic task is corresponding.
CN201510967738.XA 2015-12-21 2015-12-21 Periodic task processing method and apparatus Pending CN105630585A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201510967738.XA CN105630585A (en) 2015-12-21 2015-12-21 Periodic task processing method and apparatus
PCT/CN2016/110141 WO2017107843A1 (en) 2015-12-21 2016-12-15 Periodic task processing method and apparatus, computer program, and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510967738.XA CN105630585A (en) 2015-12-21 2015-12-21 Periodic task processing method and apparatus

Publications (1)

Publication Number Publication Date
CN105630585A true CN105630585A (en) 2016-06-01

Family

ID=56045564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510967738.XA Pending CN105630585A (en) 2015-12-21 2015-12-21 Periodic task processing method and apparatus

Country Status (2)

Country Link
CN (1) CN105630585A (en)
WO (1) WO2017107843A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017107843A1 (en) * 2015-12-21 2017-06-29 北京奇虎科技有限公司 Periodic task processing method and apparatus, computer program, and readable medium
CN107545053A (en) * 2017-08-24 2018-01-05 郑州云海信息技术有限公司 A kind of group system caching query method and apparatus
CN114629817A (en) * 2022-03-23 2022-06-14 天津国能津能滨海热电有限公司 Control method and device of alarm device and electronic equipment

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109597678B (en) * 2018-10-09 2023-07-21 创新先进技术有限公司 Task processing method and device
CN111008072A (en) * 2019-12-25 2020-04-14 青梧桐有限责任公司 Task scheduling method and device, storage medium and electronic equipment
CN111353719A (en) * 2020-03-11 2020-06-30 深圳市元征科技股份有限公司 Diagnostic task execution method, device, equipment and medium
CN111767128A (en) * 2020-06-23 2020-10-13 北京字节跳动网络技术有限公司 Method and device for executing timing task

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020174164A1 (en) * 2001-05-17 2002-11-21 Kunihiko Hayashi Task allocation time decision apparatus and method of deciding task allocation time
CN101901164A (en) * 2009-05-27 2010-12-01 北京金山软件有限公司 Time plan scheduler module and method
CN102129393A (en) * 2011-03-09 2011-07-20 南京恩瑞特实业有限公司 Universal timed task management realization method
CN105138598A (en) * 2015-08-05 2015-12-09 深圳联友科技有限公司 Method and system for remotely timing task

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101615131B (en) * 2008-06-27 2016-04-27 中国电信股份有限公司 The dispatching method of the storage means of timing task information and device and timed task
CN103530179A (en) * 2013-09-30 2014-01-22 大唐移动通信设备有限公司 Method and device for processing timed task
CN103645909A (en) * 2013-12-30 2014-03-19 中国烟草总公司湖南省公司 Handling method and device for timed task
CN104156265A (en) * 2014-08-08 2014-11-19 乐得科技有限公司 Timed task processing method and processing device
CN105630585A (en) * 2015-12-21 2016-06-01 北京奇虎科技有限公司 Periodic task processing method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020174164A1 (en) * 2001-05-17 2002-11-21 Kunihiko Hayashi Task allocation time decision apparatus and method of deciding task allocation time
CN101901164A (en) * 2009-05-27 2010-12-01 北京金山软件有限公司 Time plan scheduler module and method
CN102129393A (en) * 2011-03-09 2011-07-20 南京恩瑞特实业有限公司 Universal timed task management realization method
CN105138598A (en) * 2015-08-05 2015-12-09 深圳联友科技有限公司 Method and system for remotely timing task

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017107843A1 (en) * 2015-12-21 2017-06-29 北京奇虎科技有限公司 Periodic task processing method and apparatus, computer program, and readable medium
CN107545053A (en) * 2017-08-24 2018-01-05 郑州云海信息技术有限公司 A kind of group system caching query method and apparatus
CN107545053B (en) * 2017-08-24 2021-01-22 苏州浪潮智能科技有限公司 Cluster system cache query method and device
CN114629817A (en) * 2022-03-23 2022-06-14 天津国能津能滨海热电有限公司 Control method and device of alarm device and electronic equipment

Also Published As

Publication number Publication date
WO2017107843A1 (en) 2017-06-29

Similar Documents

Publication Publication Date Title
CN105630585A (en) Periodic task processing method and apparatus
US10019265B2 (en) Selectively blocking branch prediction for a predetermined number of instructions
CN105389191A (en) Software upgrading method, apparatus and system based on local area network
CN109643346B (en) Control flow integrity
CN105094862A (en) Method for detecting whether application program is installed or not and browser
US9665412B2 (en) Programmable logic controller and event-driven programming method thereof
CN105550104A (en) Application program performance test method and device
CN104346206A (en) Method and system for recovering installation of unloaded software
CN105589847B (en) The article identification method and device of Weight
JP2018014046A (en) Verification system and verification method
CN103885798A (en) Data processing method and electronic device
US9652245B2 (en) Branch prediction for indirect jumps by hashing current and previous branch instruction addresses
CN105335192A (en) Information processing method and electronic equipment
CN107239689B (en) Verification information identification method and system based on crowdsourcing
CN109582388B (en) Parameter configuration method, device and equipment
CN105630545A (en) Browser starting method and apparatus
CN104317645B (en) A kind of method and device of Application Instance listening port
CN107045606B (en) Method and apparatus for monitoring execution of program code
CN104216814A (en) Log compression monitoring method and log compression monitoring device
US9262168B2 (en) Computer processor with instruction for execution based on available instruction sets
CN112328288A (en) Method, system, equipment and storage medium for updating server component
CN105468379A (en) Script file execution method and device
CN105809026A (en) Permission configuration method and apparatus for process
CN109271197A (en) A kind of method, apparatus and computer equipment for detection data packet conflict
US10761502B2 (en) Method for operating an automation component

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160601