CN108710541A - A kind of execution method and device of timed task - Google Patents

A kind of execution method and device of timed task Download PDF

Info

Publication number
CN108710541A
CN108710541A CN201810494485.2A CN201810494485A CN108710541A CN 108710541 A CN108710541 A CN 108710541A CN 201810494485 A CN201810494485 A CN 201810494485A CN 108710541 A CN108710541 A CN 108710541A
Authority
CN
China
Prior art keywords
timed task
log
message
task
timed
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.)
Granted
Application number
CN201810494485.2A
Other languages
Chinese (zh)
Other versions
CN108710541B (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.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance Group 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 Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201810494485.2A priority Critical patent/CN108710541B/en
Publication of CN108710541A publication Critical patent/CN108710541A/en
Application granted granted Critical
Publication of CN108710541B publication Critical patent/CN108710541B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Abstract

This application discloses a kind of execution method and devices of timed task, including, when timed task, which reaches, executes the time, the log-on message of the timed task is inquired according to the number of the timed task, judge whether the log-on message of the timed task is in the lock state, if it is not, then updating and locking the log-on message, so that its to other nodes be in can not editing mode, and execute the timed task.The execution method and device of the timed task, when timed task reaches and executes the time, whether the log-on message that node inquires the timed task first is locked, and illustrates that other nodes have begun to execute the timed task in locking, is not repeated to execute the timed task;The log-on message is then locked when not locking and executes the timed task so that other nodes can not update log-on message and repeat the timed task, while avoiding timed task from repeating, ensure that the high availability that timed task executes.

Description

A kind of execution method and device of timed task
Technical field
The present invention relates to field of computer technology, and more specifically, it relates to the execution methods and dress of a kind of timed task It sets.
Background technology
Timed task is had been widely used at present in many scenes of Software for Design.Such as the reconciliation of financial system needs Timed task carries out batch progress data cleansing every a cycle and needs timed task, and it is fixed that large data filing also needs When task dispatching.Ensure the High Availabitity of timed task and accurate execution, is the hot spot that technical staff pays close attention in field.
In order to ensure the high availability of timed task, timed task is usually solved using cluster environment in actual conditions High Availabitity problem.In cluster environment, in order to avoid multiple nodes of same time are performed simultaneously a timed task, cause same The case where a task polygon execution, it is common practice to which a timed task is deployed on a server node.Though in this way It so avoids multiple server nodes and repeats the problem of some fixes timed task, but there are still timed tasks to execute The not high problem of availability, such as once the server node of deployment timed task breaks down, this timed task cannot be just Often execute.
Invention content
In view of this, the present invention provides a kind of execution method and device of timed task, it is fixed in cluster environment to realize When task high availability, while avoiding repeating for timed task.
To achieve the above object, the present invention provides the following technical solutions:
A kind of execution method of timed task is applied to any one node in cluster environment, including:
When timed task, which reaches, executes the time, the registration of the timed task is inquired according to the number of the timed task Information;
Judge whether the log-on message of the timed task is in the lock state;
If it is not, then update and lock the log-on message so that its be in other nodes can not editing mode;
Execute the timed task.
Optionally, before the log-on message of timed task described in the coded query according to timed task, further include:
Determine and store the log-on message of each timed task.
Optionally, the update and lock the log-on message so that its to other nodes be in can not editing mode, packet It includes:
It updates the version number in the log-on message and executes temporal information, and locking the log-on message makes it for it His node is in can not editing mode.
Optionally, after the completion of the execution timed task, further include:
The task execution result information in the log-on message is updated, and unlocks updated log-on message.
Optionally, the log-on message is stored in relevant database or non-relational database.
Optionally, before whether the log-on message for judging the timed task is in the lock state, further include:
The time, which is finally executed, according to the task in log-on message judges whether the timed task has exceeded task execution Window phase;
If so, into the update and the log-on message is locked, so that it is in not editable shape to other nodes The step of state.
Optionally, after the log-on message of the timed task is in the lock state, further include:
The time, which is finally executed, according to the task in log-on message judges whether the timed task has exceeded clocking error Window phase;
If so, into the update and the log-on message is locked, so that it is in not editable shape to other nodes The step of state.
A kind of executive device of timed task is applied to any one node in cluster environment, including:
Information inquiry module, for when timed task reaches and executes the time, being inquired according to the number of the timed task The log-on message of the timed task;
Judgment module is locked, for judging whether the log-on message of the timed task is in the lock state;
Update module is locked, for when the judging result of the locking judgment module is no, updating and locking the note Volume information so that its to other nodes be in can not editing mode;
Task execution module, for executing the timed task.
A kind of computer readable storage medium, is stored thereon with computer program, which realizes when being executed by processor The execution method of timed task described in any of the above-described kind.
A kind of electronic equipment, including:
Processor;And
Memory, the executable instruction for storing the processor;
Wherein, the processor is configured to execute the timing described in any of the above-described kind via the executable instruction is executed The execution method of task.
It can be seen via above technical scheme that compared with prior art, the embodiment of the invention discloses a kind of timed tasks Execution method and device, including, when timed task reach execute the time when, according to the number of the timed task inquiry described in The log-on message of timed task, judges whether the log-on message of the timed task is in the lock state, if it is not, then updating and locking The fixed log-on message so that its to other nodes be in can not editing mode, and execute the timed task.The timing is appointed The execution method and device of business, when timed task reaches and executes the time, node inquires the registration letter of the timed task first Whether breath is locked, and illustrates that other nodes have begun to execute the timed task in locking, it is described fixed to be not repeated to execute When task;The log-on message is then locked when not locking and executes the timed task so that other nodes can not be more New registration information simultaneously repeats the timed task, while avoiding timed task from repeating, ensure that timed task The high availability of execution.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of the execution method of timed task disclosed by the embodiments of the present invention;
Fig. 2 is the execution method flow diagram of another timed task disclosed by the embodiments of the present invention;
Fig. 3 is the flow chart of the execution method of another timed task disclosed by the embodiments of the present invention;
Fig. 4 is a kind of structural schematic diagram of the executive device of timed task disclosed by the embodiments of the present invention;
Fig. 5 is the structural schematic diagram of the executive device of another timed task disclosed by the embodiments of the present invention;
Fig. 6 is the structural schematic diagram of the executive device of another timed task disclosed by the embodiments of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Fig. 1 is a kind of flow chart of the execution method of timed task disclosed by the embodiments of the present invention, shown in Figure 1, can To include:
Step 101:When timed task, which reaches, executes the time, the timing is inquired according to the number of the timed task and is appointed The log-on message of business.
In the present embodiment, the execution method of the timed task can be applied to any one node in cluster environment. When system has registered existing timed task and reached the execution time, present node can go to look into according to the number of timed task Ask the log-on message of the timed task.Wherein, the number of the timed task can be business module mark, timed task ID Etc. the identification information that can uniquely determine some timed task.
The log-on message can with but be not limited to include that business module type, lock mark, version number, task finally execute The information such as time, the server node IP address for executing task, task execution situation.The log-on message can be stored in third Method, and storage medium, such as relevant database or non-relational database.
Step 102:Judge whether the log-on message of the timed task is in the lock state, if it is not, entering step 103.
After the log-on message for finding the timed task, whether the log-on message of the timed task is first determined whether Through being locked by other server nodes.If being in the lock state, illustrate that other server nodes are executing the timing Task, current server node, which will not be repeated again, executes the timed task, does not do any operation.If the log-on message does not have It is in the lock state, then illustrates that other server nodes execute the timed task not yet, then current server node can be with As described in following step 103, the log-on message of the timed task is locked, and starts to execute the timed task.
Step 103:Update and lock the log-on message so that its to other nodes be in can not editing mode.
In the case where the log-on message of the timed task does not lock, determine that current server node can be held The row timed task.Since the Servers-all node in cluster is before executing timed task, it will first inquire and judge to determine When task log-on message whether be locked, therefore, before current server node executes the timed task, it is necessary first to Update in the log-on message can newer information, such as task execution final time, the server node IP that executes task The information such as location, while it is lock-out state that can change lock mark, also updates the log-on message to avoid other server nodes And the timed task is executed, cause the timed task repeating in different server node.
Step 104:Execute the timed task.
After locking the log-on message of the timed task, present node can execute the timed task.It is described fixed When task according to itself action, may be finished quickly, it is also possible to need execute a period of time after can just be finished. The execution time of the timed task with the action that its own task includes, and executes the node of the timed task Self attributes and operation conditions are related.
In the present embodiment, the execution method of the timed task when timed task reaches and executes the time, look into first by node Whether the log-on message for asking the timed task is locked, and illustrates that other nodes have begun to execute the timing times in locking Business, is not repeated to execute the timed task;The log-on message is then locked when not locking and executes the timed task, So that other nodes can not update log-on message and repeat the timed task, repeated avoiding timed task Meanwhile it ensure that the high availability that timed task executes.
On the basis of the above disclosed embodiments of the present invention, Fig. 2 discloses the execution method of another timed task Flow chart, with reference to shown in Fig. 2, the method may include:
Step 201:Determine and store the log-on message of each timed task.
The log-on message for predefining and having stored each timed task, convenient for subsequently needing to execute timed task When, server node can find and lock the log-on message of the timed task, then execute the timed task.It avoids Other server nodes repeat the timed task.
Step 202:When timed task, which reaches, executes the time, the timing is inquired according to the number of the timed task and is appointed The log-on message of business.
Step 203:Judge whether the log-on message of the timed task is in the lock state, if it is not, entering step 204.
Step 204:It updates the version number in the log-on message and executes temporal information, and lock the log-on message to make It is in other nodes can not editing mode.
In this implementation, the version number in the log-on message can be used for realizing optimistic lock mechanism.According to timed task Coded query described in timed task log-on message lock-out state when, while the version number in the log-on message can be looked into Go out, is needed according to version number therein as Rule of judgment when locking the log-on message of the timed task.If the version number It is identical as version number when inquiry, i.e., it does not change, illustrates that other server nodes do not update the log-on message, can incite somebody to action The log-on message of the timed task locks, and does not allow other server nodes to execute corresponding timed task, and will be described Version number adds 1, when log-on message to inquire the timed task in other server nodes, prompts had server node Executing the timed task.Specifically, the information such as time and lock-out state are finally executed come more new task according to version number, Version number adds 1, prevents other server nodes same period from taking over the timed task.Wherein, the task finally execute the time can To be at the beginning of this executes the timed task.
Step 205:Execute the timed task.
Step 206:The task execution result information in the log-on message is updated, and unlocks updated log-on message.
After the timed task is finished, execution result information can be updated into log-on message, the execution It is success or failure that result information, which can select value,.Meanwhile it needing updated log-on message, i.e. the log-on message solution of new version Lock, when needing to execute the timed task next time to facilitate, server node can lock under new log-on message and execution The timed task in one period.
In the present embodiment, the execution method of the timed task is determining and stores the log-on message of each timed task, Convenient for subsequently when task at that time reaches and executes the time, server node can find corresponding according to the number of timed task Log-on message.After executing timed task, the task execution result information in the log-on message is updated, and unlocks update Log-on message afterwards, when needing to execute convenient for timed task described in next period, server node can lock new registration letter Cease and execute the timed task in next period.
Fig. 3 is the flow chart of the execution method of another timed task disclosed by the embodiments of the present invention, as shown in figure 3, institute The method of stating may include:
Step 301:When timed task, which reaches, executes the time, the timing is inquired according to the number of the timed task and is appointed The log-on message of business.
Step 302:The time, which is finally executed, according to the task in log-on message judges whether the timed task has exceeded Task execution window phase, if not, entering step 303;If so, entering step 305.
Wherein, the task execution window phase is usually arranged as being far longer than the execution time of the timed task.For example, The execution period of about 10 minutes or so the execution time of the timed task, the timed task are once a day, then described Task execution window phase could be provided as 5 hours, 10 hours etc..The timed task is being executed to avoid some server node During suddenly break down or fortuitous event, cause the timed task log-on message never be unlocked, other Server node can not update the log-on message, and the case where can not execute the timed task.
Step 303:Judge whether the log-on message of the timed task is in the lock state, if not, entering step 304。
Step 304:The time, which is finally executed, according to the task in log-on message judges whether the timed task has exceeded Clocking error window phase, if so, entering step 305.
Since in cluster environment, server node is large number of, also inevitably there is clock between different server nodes Difference, in this case, if the execution time of the timed task is very short, only 30 seconds, first server node executed Bi Suoshu timed tasks and the log-on message of the timed task is unlocked, and second server node is than described first 1 minute evening of clock of server node, after the first server node has executed the timed task, the second service Device node can execute the timed task again according to temporal, result in repeating for the timed task in this way.For The generation for avoiding such case in this implementation, is configured with a clocking error window phase, the clocking error window phase when Length can be determined according to the execution duration of the clocking error range of Servers-all node in cluster and timed task.Such as The execution time of timed task is about 15 seconds, and the clocking error range of Servers-all node is less than 1 minute in cluster, then described Clocking error window phase could be provided as 1 minute.
It is not locked in the log-on message of the timed task, and it is true according to the task in log-on message finally to execute the time When the fixed timed task is without departing from clocking error window phase, illustrate that the timed task had executed in current period , with regard to no longer being repeated to it.
Step 305:Update and lock the log-on message so that its to other nodes be in can not editing mode.
It is not locked in the log-on message of the timed task, and it is true according to the task in log-on message finally to execute the time When the fixed timed task has exceeded clocking error window phase, illustrate that there are no execution in current period for the timed task It crosses, can update and lock the log-on message, and execute the timed task.
Step 306:Execute the timed task.
Step 307:The task execution result information in the log-on message is updated, and unlocks updated log-on message.
In the present embodiment, increases and judge the step of whether timed task is beyond task execution window phase, avoid the last time The node of timed task failure in the process of implementation is executed, for a long time not by the log-on message solution of the timed task Lock, and influence the case where timed task subsequently normally executes.It increases and judges whether timed task exceeds clocking error window The step of mouth phase, avoids the timed task one and executes in the period, weight of the different server node to the timed task It is multiple to execute.
For each method embodiment above-mentioned, for simple description, therefore it is all expressed as a series of combination of actions, but Be those skilled in the art should understand that, the present invention is not limited by the described action sequence because according to the present invention, certain A little steps can be performed in other orders or simultaneously.Secondly, it those skilled in the art should also know that, is retouched in specification The embodiment stated belongs to preferred embodiment, and involved action and module are not necessarily essential to the invention.
Method is described in detail in aforementioned present invention disclosed embodiment, diversified forms can be used for the method for the present invention Device realize that therefore the invention also discloses a kind of devices, and specific embodiment is given below and is described in detail.
Fig. 4 is a kind of structural schematic diagram of the executive device of timed task disclosed by the embodiments of the present invention, referring to Fig. 4 institutes Show, the executive device 40 of the timed task may include:
Information inquiry module 401, for when timed task reaches and executes the time, being looked into according to the number of the timed task Ask the log-on message of the timed task.
In the present embodiment, the execution method of the timed task can be applied to any one node in cluster environment. When system has registered existing timed task and reached the execution time, present node can go to look into according to the number of timed task Ask the log-on message of the timed task.Wherein, the number of the timed task can be business module mark, timed task ID Etc. the identification information that can uniquely determine some timed task.
The log-on message can with but be not limited to include that business module type, lock mark, version number, task finally execute The information such as time, the server node IP address for executing task, task execution situation.The log-on message can be stored in third Method, and storage medium, such as relevant database or non-relational database.
Judgment module 402 is locked, for judging whether the log-on message of the timed task is in the lock state.
After the log-on message for finding the timed task, whether the log-on message of the timed task is first determined whether Through being locked by other server nodes.If being in the lock state, illustrate that other server nodes are executing the timing Task, current server node, which will not be repeated again, executes the timed task, does not do any operation.If the log-on message does not have It is in the lock state, then illustrates that other server nodes execute the timed task not yet.
Update module 403 is locked, for when the judging result of the locking judgment module 402 is no, updating and locking The log-on message so that its to other nodes be in can not editing mode.
In the case where the log-on message of the timed task does not lock, determine that current server node can be held The row timed task.Since the Servers-all node in cluster is before executing timed task, it will first inquire and judge to determine When task log-on message whether be locked, therefore, before current server node executes the timed task, it is necessary first to Update in the log-on message can newer information, such as task execution final time, the server node IP that executes task The information such as location, while it is lock-out state that can change lock mark, also updates the log-on message to avoid other server nodes And the timed task is executed, cause the timed task repeating in different server node.
Task execution module 404, for executing the timed task.
After locking the log-on message of the timed task, present node can execute the timed task.It is described fixed When task according to itself action, may be finished quickly, it is also possible to need execute a period of time after can just be finished. The execution time of the timed task with the action that its own task includes, and executes the node of the timed task Self attributes and operation conditions are related.
In the present embodiment, the executive device of the timed task when timed task reaches and executes the time, look into first by node Whether the log-on message for asking the timed task is locked, and illustrates that other nodes have begun to execute the timing times in locking Business, is not repeated to execute the timed task;The log-on message is then locked when not locking and executes the timed task, So that other nodes can not update log-on message and repeat the timed task, repeated avoiding timed task Meanwhile it ensure that the high availability that timed task executes.
On the basis of the above disclosed embodiments of the present invention, Fig. 5 discloses the executive device of another timed task Structural schematic diagram, shown in Figure 5, the executive device 50 of the timed task may include:
Log-on message memory module 501, the log-on message for determining and storing each timed task.
The log-on message for predefining and having stored each timed task, convenient for subsequently needing to execute timed task When, server node can find and lock the log-on message of the timed task, then execute the timed task.It avoids Other server nodes repeat the timed task.
Information inquiry module 401, for when timed task reaches and executes the time, being looked into according to the number of the timed task Ask the log-on message of the timed task.
Judgment module 402 is locked, for judging whether the log-on message of the timed task is in the lock state.
Update module 403 is locked, for when the judging result of the locking judgment module 403 is no, updating the note Version number in volume information and execution temporal information, and locking the log-on message makes it be in not editable for other nodes State.
In this implementation, the version number in the log-on message can be used for realizing optimistic lock mechanism.According to timed task Coded query described in timed task log-on message lock-out state when, while the version number in the log-on message can be looked into Go out, is needed according to version number therein as Rule of judgment when locking the log-on message of the timed task.If the version number It is identical as version number when inquiry, i.e., it does not change, illustrates that other server nodes do not update the log-on message, can incite somebody to action The log-on message of the timed task locks, and does not allow other server nodes to execute corresponding timed task, and will be described Version number adds 1, when log-on message to inquire the timed task in other server nodes, prompts had server node Executing the timed task.Specifically, the information such as time and lock-out state are finally executed come more new task according to version number, Version number adds 1, prevents other server nodes same period from taking over the timed task.
Task execution module 404, for executing the timed task.
Unlocked state 502 is updated, for updating the task execution result information in the log-on message, and after unlocking update Log-on message.
After the timed task is finished, execution result information can be updated into log-on message, the execution It is success or failure that result information, which can select value,.Meanwhile it needing updated log-on message, i.e. the log-on message solution of new version Lock, when needing to execute the timed task next time to facilitate, server node can lock under new log-on message and execution The timed task in one period.
In the present embodiment, the executive device of the timed task is determining and stores the log-on message of each timed task, Convenient for subsequently when task at that time reaches and executes the time, server node can find corresponding according to the number of timed task Log-on message.After executing timed task, the task execution result information in the log-on message is updated, and unlocks update Log-on message afterwards, when needing to execute convenient for timed task described in next period, server node can lock new registration letter Cease and execute the timed task in next period.
Fig. 6 is the structural schematic diagram of the executive device of another timed task disclosed by the embodiments of the present invention, such as Fig. 6 institutes Show, the executive device 60 of the timed task may include:
Information inquiry module 401, for when timed task reaches and executes the time, being looked into according to the number of the timed task Ask the log-on message of the timed task.
First window phase judgment module 601, for according to the task in log-on message finally execute the time judge it is described fixed When task whether exceeded task execution window phase.
Wherein, the task execution window phase is usually arranged as being far longer than the execution time of the timed task.For example, The execution period of about 10 minutes or so the execution time of the timed task, the timed task are once a day, then described Task execution window phase could be provided as 5 hours, 10 hours etc..The timed task is being executed to avoid some server node During suddenly break down or fortuitous event, cause the timed task log-on message never be unlocked, other Server node can not update the log-on message, and the case where can not execute the timed task.
Judgment module 402 is locked, for when the judging result of the first window phase judgment module 601 is no, judging Whether the log-on message of the timed task is in the lock state.
Second window phase judgment module 602 is used for when the judging result of the locking judgment module 402 is no, according to Task in log-on message finally executes the time and judges whether the timed task has exceeded clocking error window phase.
Since in cluster environment, server node is large number of, also inevitably there is clock between different server nodes Difference, in this case, if the execution time of the timed task is very short, only 30 seconds, first server node executed Bi Suoshu timed tasks and the log-on message of the timed task is unlocked, and second server node is than described first 1 minute evening of clock of server node, after the first server node has executed the timed task, the second service Device node can execute the timed task again according to temporal, result in repeating for the timed task in this way.For The generation for avoiding such case in this implementation, is configured with a clocking error window phase, the clocking error window phase when Length can be determined according to the execution duration of the clocking error range of Servers-all node in cluster and timed task.Such as The execution time of timed task is about 15 seconds, and the clocking error range of Servers-all node is less than 1 minute in cluster, then described Clocking error window phase could be provided as 1 minute.
It is not locked in the log-on message of the timed task, and it is true according to the task in log-on message finally to execute the time When the fixed timed task is without departing from clocking error window phase, illustrate that the timed task had executed in current period , with regard to no longer being repeated to it.
Lock update module 403, for the judging result in the first window phase judgment module 601 be when, or The judging result of the second window phase judgment module 602 is when being, to update and lock the log-on message, so that it is to other Node is in can not editing mode.
Task execution module 404, for executing the timed task.
Unlocked state 502 is updated, for updating the task execution result information in the log-on message, and after unlocking update Log-on message.
In the present embodiment, the function module for judging whether timed task exceeds task execution window phase is increased, is avoided The node of timed task failure in the process of implementation is once executed, for a long time not by the log-on message of the timed task Unlock, and influence the case where timed task subsequently normally executes.It increases and judges whether timed task exceeds clocking error The function module of window phase avoids the timed task one and executes in the period, and different server node appoints the timing Business repeats.
The executive device of any one timed task in above-described embodiment includes processor and memory, above-mentioned Information inquiry module, locking judgment module in embodiment, locking update module, task execution module, log-on message store mould Block, update unlocked state, first window phase judgment module, second window phase judgment module etc. are stored in as program module In reservoir, the above procedure module being stored in the memory is executed by processor to realize corresponding function.
Include kernel in processor, is gone in memory to transfer corresponding program module by kernel.Kernel can be arranged one Or it is multiple, the processing of return visit data is realized by adjusting kernel parameter.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/ Or the forms such as Nonvolatile memory, if read-only memory (ROM) or flash memory (flash RAM), memory include at least one deposit Store up chip.
An embodiment of the present invention provides a kind of storage mediums, are stored thereon with program, real when which is executed by processor The execution method of timed task described in existing above-described embodiment.
An embodiment of the present invention provides a kind of processor, the processor is for running program, wherein described program is run The execution method of timed task described in Shi Zhihang above-described embodiments.
Further, a kind of electronic equipment, including processor and memory are present embodiments provided.Wherein memory is used for The executable instruction of the processor is stored, the processor is configured to execute above-mentioned reality via the executable instruction is executed Apply the execution method of the timed task described in example.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other The difference of embodiment, just to refer each other for identical similar portion between each embodiment.For device disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related place is said referring to method part It is bright.
It should also be noted that, herein, relational terms such as first and second and the like are used merely to one Entity or operation are distinguished with another entity or operation, without necessarily requiring or implying between these entities or operation There are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant are intended to contain Lid non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also include other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest range caused.

Claims (10)

1. a kind of execution method of timed task is applied to any one node in cluster environment, which is characterized in that including:
When timed task, which reaches, executes the time, the registration that the timed task is inquired according to the number of the timed task is believed Breath;
Judge whether the log-on message of the timed task is in the lock state;
If it is not, then update and lock the log-on message so that its be in other nodes can not editing mode;
Execute the timed task.
2. the execution method of timed task according to claim 1, which is characterized in that in the volume according to timed task Before code inquires the log-on message of the timed task, further include:
Determine and store the log-on message of each timed task.
3. the execution method of timed task according to claim 1, which is characterized in that the update simultaneously locks the registration Information so that its to other nodes be in can not editing mode, including:
It updates the version number in the log-on message and executes temporal information, and locking the log-on message makes it for other sections Point is in can not editing mode.
4. the execution method of timed task according to claim 1, which is characterized in that execute the timed task described After the completion, further include:
The task execution result information in the log-on message is updated, and unlocks updated log-on message.
5. the execution method of timed task according to claim 1, which is characterized in that the log-on message is stored in relationship Type database or non-relational database.
6. the execution method of timed task according to any one of claims 1 to 4, which is characterized in that judge it is described fixed When task log-on message whether be in the lock state before, further include:
The time, which is finally executed, according to the task in log-on message judges whether the timed task has exceeded task execution window Phase;
If so, into the update and lock the log-on message so that its be in other nodes can not editing mode Step.
7. the execution method of timed task according to any one of claims 1 to 4, which is characterized in that appoint in the timing After the log-on message of business is in the lock state, further include:
The time, which is finally executed, according to the task in log-on message judges whether the timed task has exceeded clocking error window Phase;
If so, into the update and lock the log-on message so that its be in other nodes can not editing mode Step.
8. a kind of executive device of timed task is applied to any one node in cluster environment, which is characterized in that including:
Information inquiry module is used for when timed task reaches and executes the time, according to the inquiry of the number of the timed task The log-on message of timed task;
Judgment module is locked, for judging whether the log-on message of the timed task is in the lock state;
Update module is locked, for when the judging result of the locking judgment module is no, updating and locking the registration letter Breath so that its to other nodes be in can not editing mode;
Task execution module, for executing the timed task.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor The execution method of claim 1~7 any one of them timed task is realized when row.
10. a kind of electronic equipment, which is characterized in that including:
Processor;And
Memory, the executable instruction for storing the processor;
Wherein, the processor is configured to carry out perform claim 1~7 any one of them of requirement via the execution executable instruction The execution method of timed task.
CN201810494485.2A 2018-05-22 2018-05-22 Timed task execution method and device Active CN108710541B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810494485.2A CN108710541B (en) 2018-05-22 2018-05-22 Timed task execution method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810494485.2A CN108710541B (en) 2018-05-22 2018-05-22 Timed task execution method and device

Publications (2)

Publication Number Publication Date
CN108710541A true CN108710541A (en) 2018-10-26
CN108710541B CN108710541B (en) 2022-02-01

Family

ID=63869402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810494485.2A Active CN108710541B (en) 2018-05-22 2018-05-22 Timed task execution method and device

Country Status (1)

Country Link
CN (1) CN108710541B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714411A (en) * 2018-12-25 2019-05-03 浪潮电子信息产业股份有限公司 The task timing of springboot micro services frame executes method, apparatus, equipment and medium
CN110196765A (en) * 2019-05-30 2019-09-03 苏州浪潮智能科技有限公司 Timed task processing method, device, equipment and computer readable storage medium
CN110515714A (en) * 2019-08-15 2019-11-29 浙江万朋教育科技股份有限公司 A kind of task balance dispatching method based on group system
CN111459951A (en) * 2020-02-25 2020-07-28 深圳联友科技有限公司 Method and device for supporting cluster through timing task

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
CN103761148A (en) * 2014-01-26 2014-04-30 北京京东尚科信息技术有限公司 Control method for cluster timing scheduling tasks
US20150052529A1 (en) * 2013-08-14 2015-02-19 International Business Machines Corporation Efficient task scheduling using a locking mechanism
CN105700943A (en) * 2015-12-31 2016-06-22 上海百事通信息技术股份有限公司 Distributed task scheduling method and system
CN106095585A (en) * 2016-06-22 2016-11-09 中国建设银行股份有限公司 Task requests processing method, device and enterprise information system
CN106991002A (en) * 2017-02-08 2017-07-28 网易无尾熊(杭州)科技有限公司 Method and apparatus for realizing Portable Batch System

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150052529A1 (en) * 2013-08-14 2015-02-19 International Business Machines Corporation Efficient task scheduling using a locking mechanism
CN103761148A (en) * 2014-01-26 2014-04-30 北京京东尚科信息技术有限公司 Control method for cluster timing scheduling tasks
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
CN105700943A (en) * 2015-12-31 2016-06-22 上海百事通信息技术股份有限公司 Distributed task scheduling method and system
CN106095585A (en) * 2016-06-22 2016-11-09 中国建设银行股份有限公司 Task requests processing method, device and enterprise information system
CN106991002A (en) * 2017-02-08 2017-07-28 网易无尾熊(杭州)科技有限公司 Method and apparatus for realizing Portable Batch System

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714411A (en) * 2018-12-25 2019-05-03 浪潮电子信息产业股份有限公司 The task timing of springboot micro services frame executes method, apparatus, equipment and medium
CN110196765A (en) * 2019-05-30 2019-09-03 苏州浪潮智能科技有限公司 Timed task processing method, device, equipment and computer readable storage medium
CN110515714A (en) * 2019-08-15 2019-11-29 浙江万朋教育科技股份有限公司 A kind of task balance dispatching method based on group system
CN111459951A (en) * 2020-02-25 2020-07-28 深圳联友科技有限公司 Method and device for supporting cluster through timing task

Also Published As

Publication number Publication date
CN108710541B (en) 2022-02-01

Similar Documents

Publication Publication Date Title
CN108710541A (en) A kind of execution method and device of timed task
CN106709704B (en) Intelligent contract upgrading method based on license chain
CN110300984B (en) Changing smart contracts recorded in a blockchain
US7496912B2 (en) Methods and arrangements for ordering changes in computing systems
CN105808633B (en) Data archiving method and system
CN107608689A (en) The update method of application program, device and electronic equipment in client
CN109242500A (en) Block chain transaction validation verification method, apparatus and storage medium
EP3864504B1 (en) Changeset conflict rebasing
CN108491252B (en) Distributed transaction processing method and distributed system
US10528756B2 (en) Method for managing information using tree structure based on blockchain, server and terminal using the same
US10282457B1 (en) Distributed transactions across multiple consensus groups
JP2011233063A (en) Program and method for data management, and node device
CN104363107B (en) A kind of security baseline check method and equipment
CN110347590A (en) The interface testing control method and device of operation system
CN109634959A (en) A kind of block index method and block index device
CN115017158A (en) Node information query method
CN111316297A (en) Techniques for coordinating code for infrastructure modeling
CN116523661A (en) Claim settlement method, device, equipment and storage medium based on artificial intelligence
CN110232143A (en) Pass through the question and answer data query method and its equipment of block chain
CN109635043A (en) A kind of method, apparatus, equipment and the medium of information of vehicles storage
AU2020323807B2 (en) Ledger verifiable-pruning system
CN113377762A (en) Publishing system and method for block chain subchain
US11469884B1 (en) Decentralized techniques for managing device administration rights
CN111464580B (en) Method and device for selecting main server
CN113468224A (en) Method and device for storing and inquiring state data and executing transaction in block chain

Legal Events

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