CN113794740A - Timer control method and system and readable storage medium - Google Patents

Timer control method and system and readable storage medium Download PDF

Info

Publication number
CN113794740A
CN113794740A CN202111354375.4A CN202111354375A CN113794740A CN 113794740 A CN113794740 A CN 113794740A CN 202111354375 A CN202111354375 A CN 202111354375A CN 113794740 A CN113794740 A CN 113794740A
Authority
CN
China
Prior art keywords
timer
information
network address
service
service object
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
CN202111354375.4A
Other languages
Chinese (zh)
Other versions
CN113794740B (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.)
Elane Inc
Original Assignee
Elane Inc
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 Elane Inc filed Critical Elane Inc
Priority to CN202111354375.4A priority Critical patent/CN113794740B/en
Publication of CN113794740A publication Critical patent/CN113794740A/en
Application granted granted Critical
Publication of CN113794740B publication Critical patent/CN113794740B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/28Timers or timing mechanisms used in protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention belongs to the technical field of ship data processing, and provides a timer control method and system and a readable storage medium. The timer control method comprises the following steps: receiving timer information and a network address or timer information sent by a timer agent; when timer information and a network address are received, determining a business object ID according to the timer information, and updating the network address of the corresponding business object according to the business object ID and the network address; when the timer information is received, determining the information type of the timer information; when the information type is timer notification information, binding a service object ID and a timer ID which are included in the timer information; and when the information type is the adding and deleting information of the timing task, adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information included by the timer information, and establishing a corresponding relation between the timing task and the timer ID.

Description

Timer control method and system and readable storage medium
Technical Field
The invention relates to the technical field of ships, in particular to a timer control method and system and a readable storage medium.
Background
The automatic identification system AIS for ships is an effective navigation aid widely used in modern times. The basic purpose of development is to provide effective collision prevention measures for ships. By installing the AIS equipment on the ship, the staff can visually see the surrounding environment and the running conditions of nearby ships. The monitoring system can perform early warning on the possible dangerous condition according to the course, the speed and other information of the ship and the peripheral ships.
The AIS system described above is designed with self-centric monitoring requirements. At a higher level, an inspection from a global perspective is required, and a role switch between global and self is required. The distributed service involved in the scheme is a technical implementation scheme for the requirement. This service-borne function 1) is monitored centrally on the selected vessel. 2) Global ship monitoring. The first function is embodied in AIS equipment, but workers cannot go to each ship at any time to feel and monitor. The second function is more mature products, such as ship communication network. To meet the functional requirements of condition 1), an efficient data service is required for support.
To meet the high performance access requirements, the data service must provide both computing and memory capabilities. 1) And calculating and generating various early warning data by taking each ship as a center. 2) And storing the early warning and state data of each ship. A single server has difficulty supporting both of the above capability requirements, especially computing power.
Both of the above problems are relatively easy to solve by distributed service design. And (4) taking the region as a division rule of the ship object, and managing the ships belonging to different servers in different regions. Computing and storage capabilities are expanded and performance requirements are met.
In the implementation logic of the ship early warning function, the use of a timer is generally involved, such as the timing detection of the operation condition of a peripheral ship, the warning without leaving a target ship for a long time, and the like. Conventional timing managers have their lifecycle and scope subordinate to a single service. This means that the timer will be disabled after the ship object has changed its home server due to navigation.
In the existing solution, after the service object generates the service migration, the related timer data is migrated, and the timer is created again. The design is complex and the realization is not uniform.
Disclosure of Invention
The present invention is directed to solving or improving at least one of the technical problems of the prior art.
To this end, the first aspect of the present invention provides a timer control method.
The invention provides a timer control method in a second aspect.
A third aspect of the present invention provides a timer control method.
A fourth aspect of the invention provides a timer control system.
A fifth aspect of the invention provides a timer control system.
A sixth aspect of the invention provides a timer control system.
A seventh aspect of the present invention provides a timer control system.
An eighth aspect of the invention provides a readable storage medium.
In view of the above, according to a first aspect of the present invention, a timer control method is provided, including: receiving timer information and a network address or timer information sent by a timer agent; when timer information and a network address are received, determining a business object ID according to the timer information, and updating the network address of the corresponding business object according to the business object ID and the network address; when the timer information is received, determining the information type of the timer information; when the information type is timer notification information, binding a service object ID and a timer ID which are included in the timer information; and when the information type is the adding and deleting information of the timing task, adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information included by the timer information, and establishing a corresponding relation between the timing task and the timer ID.
The timer control method provided by the invention is used for a timer server. The timer server interacts with the timer proxy and controls the timer of the service object through the timer proxy. When receiving the network address and the timer information sent by the timer agent, the service object is described to be migrated. And binding the service object ID with the network address by determining the service object ID in the timer information, so as to realize the update of the network address of the corresponding service object. When only timer information is received, further determining the information type of the timer information, and when the information type is determined to be timer notification information, namely the notification information of the timer is created by the service object, binding the service object ID and the timer ID in the timer information; and when the information type is determined to be the adding and deleting information of the timing task, adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information in the timing information, and establishing a corresponding relation between the timing task and the timer ID. The timer control method provided by the invention controls the timer based on the system architecture of the timer server, the timer proxy and the business object, the timer server exists independently of the business service, and the movement of the business object among different business servers can not cause the failure of the timer, thereby avoiding the problem of abnormal timing manager caused by adding/removing the timer again in the timing event processing logic in the traditional timer, and reducing the resource loss of the business service. And the timer information can be asynchronously responded and processed, and the problem that the timer manager is abnormal because the timer is added/removed again in the timing event processing logic is solved.
In addition, the traditional timer can only be developed and realized again in the self system, and the timer control method provides the capability of directly providing timing service for a third party.
The migration of the business object refers to the movement of the business object between the business servers, and specifically refers to the movement of the business object from one business server to another business server.
The timer control method according to the present invention may further include the following technical features:
in the above technical solution, the method further comprises: judging whether the timing task needs to be triggered or not according to the time information; when the timing task needs to be triggered, generating timing trigger information; determining a corresponding timer ID according to the corresponding relation between the timing task and the timer ID; determining a corresponding service object ID according to the timer ID, and determining a timer agent ID according to a network address corresponding to the service object ID; and sending the timing trigger information to a timer agent corresponding to the timer agent ID.
In the technical scheme, the time information is the timing time of the timing task in the timer, so that whether the timing task reaches the trigger time can be judged according to the time, and the timing trigger information is generated when the timing task needs to be triggered. Meanwhile, a business object to which the timing task belongs is determined according to the corresponding relation between the timing task and the timer ID, and the timer agent ID of the timer agent is further determined according to the network address corresponding to the business object ID, so that the timing trigger information can be sent to the corresponding timer agent, the timer agent is made to inform the corresponding business object, and the smooth triggering of the timing task is ensured.
The timer server may have a plurality of timers in a slot, which are organized in a data structure in the form of a list, such as list or vector. When time goes to slot 2, the timing manager needs to traverse this list, triggering the timer. If the logic for adding or deleting the timer again exists in the timer callback processing logic, the reference address of the list element is necessarily changed. At this time, the pointer currently used to traverse the list cannot be used, otherwise there is a serious problem of access exception.
The invention adopts an asynchronous processing mechanism, the operation of adding and deleting the timer again in the logic after the timer is triggered can be carried out only in the processing of the next time slice of the timer server, the access of the current timer list can not be influenced, and the problem of abnormal access can be avoided.
A second aspect of the present invention provides a timer control method, including: receiving timer information sent by a service object, wherein the timer information comprises the information type of the timer information; judging whether the information type is business object migration information or not; when the judgment result is yes, determining the network address of the service server after the service object is migrated, and sending the network address and the timer information to the timer server; and when the judgment result is negative, forwarding the timer information to the timer server.
The timer control method provided by the invention is used for timer proxy. The timer proxy is a bridge for the business object and the timer server. When receiving the timer information sent by the service object, firstly, judging whether the information type of the timer information is the service object migration information, if so, determining the network address of the service server after the service object migration, and sending the network address and the timer information to the timer server. Otherwise, the timer information is not required to be processed, and the timer information is directly forwarded to the timer server. Therefore, for the service object, the network address of the service server does not need to be considered when the service object is migrated, and for the timer agent, the information type only needs to be judged once without other data processing, so that the timing processing efficiency can be improved, and network resources are saved.
Specifically, the timer proxy may be deployed on a service server, and when a service object is migrated to the service server, the network address of the service server is the network address of the service server after the migration of the service object occurs.
A third aspect of the present invention provides a timer control method, including: generating timer information according to the service operation logic; wherein the timer information comprises any one or a combination of: the information type of the timer information, the service object ID, the timer ID, the newly added or deleted timing task information and the time information. The timer information is sent to a timer agent.
The timer control method provided by the invention is used for the business object. The creation of the timer is triggered automatically by the business object entirely according to the run logic, and the timing time is also determined by the business object. The timer server only needs to monitor the timing time according to the needs of the service object and inform the timer server that the timing time is up at the appointed time point. When the service object is migrated, the network addresses before and after the migration do not need to be considered, the network addresses only need to be processed by the timer agent, and the timer agent can acquire the network address of the service server after the migration. When a business object needs to add or delete a timing task, the timer ID and the corresponding requirement information of the added and deleted tasks are sent to the timer proxy, and the timer proxy interacts with the timer server so that the timer server controls the timing requirement of the timer server.
In any of the above technical solutions, the method further includes: and receiving timer trigger information forwarded by the timer agent, and responding to the timer trigger information.
In the technical scheme, the timer triggering is realized by receiving the timer triggering information forwarded by the timer agent and responding to the timer triggering information.
A fourth aspect of the present invention provides a timer control system, comprising: a memory storing programs or instructions; and the processor is used for realizing the steps of the timer control method according to the technical scheme when executing the program or the instruction.
The timer control system provided by the invention comprises a memory and a processor. The memory stores a program or instructions, and the processor can implement the steps of the timer control method according to any one of the above-mentioned embodiments when executing the program or instructions. Therefore, the timer control system has all the beneficial technical effects of the timer control method, and is not discussed in detail herein.
A fifth aspect of the present invention provides a timer control system, including: the receiving unit is used for receiving the timer information and the network address or the timer information sent by the timer agent; the migration unit is used for determining a service object ID according to the timer information when the timer information and the network address are received, and updating the network address of the corresponding service object according to the service object ID and the network address; a determining unit for determining an information type of the timer information when the timer information is received; the creating unit is used for binding the service object ID and the timer ID included by the timer information when the information type is the timer notification information; and the processing unit is used for adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information included by the timer information and establishing the corresponding relation between the timing task and the timer ID when the information type is the adding and deleting information of the timing task.
The timer control system provided by the invention is used for a timer server. The timer server interacts with the timer proxy and controls the timer of the service object through the timer proxy. When the receiving unit receives the network address and the timer information sent by the timer agent, the service object is described to be migrated. And binding the service object ID with the network address by determining the service object ID in the timer information, so as to realize the update of the network address of the corresponding service object. When the information type is determined to be timer notification information, namely the notification information of the timer is created by the service object, the service object ID and the timer ID in the timer information are bound through the creating unit; when the information type is determined to be the adding and deleting information of the timing task, the processing unit adds or deletes the timing task according to the timer ID, the adding and deleting information and the time information in the timing information and establishes the corresponding relation between the timing task and the timer ID. The timer control system provided by the invention controls the timer based on the system architecture of the timer server, the timer proxy and the business object, the timer server exists independently of the business service, and the movement of the business object among different business servers can not cause the failure of the timer, so that the problem of abnormal timing managers caused by adding/removing the timer again in the timing event processing logic in the traditional timer can be avoided, and the resource loss of the business service can be reduced. And the timer information can be asynchronously responded and processed, and the problem that the timer manager is abnormal because the timer is added/removed again in the timing event processing logic is solved.
In addition, the traditional timer can only be developed and realized again in the self system, and the timer control method provides the capability of directly providing timing service for a third party.
The migration of the business object refers to the movement of the business object between the business servers, and specifically refers to the movement of the business object from one business server to another business server.
A sixth aspect of the present invention provides a timer control system, comprising: the receiving unit is used for receiving the timer information sent by the service object, wherein the timer information comprises the information type of the timer information; the judging unit is used for judging whether the information type is business object migration information or not; the migration unit is used for determining the network address of the service server after the service object is migrated and sending the network address and the timer information to the timer server when the judgment result is yes; and the forwarding unit forwards the timer information to the timer server when the judgment result is negative.
The timer control system provided by the invention is used for timer proxy. The timer proxy is a bridge for the business object and the timer server. When the receiving unit receives the timer information sent by the service object, the judging unit judges whether the information type of the timer information is service object migration information or not, if so, the migration unit needs to determine the network address of the service server after the service object migration, and sends the network address and the timer information to the timer server. Otherwise, the timer information does not need to be processed, and the timer information is directly forwarded to the timer server through the forwarding unit. Therefore, for the service object, the network address of the service server does not need to be considered when the service object is migrated, and for the timer agent, the information type only needs to be judged once without other data processing, so that the timing processing efficiency can be improved, and network resources are saved.
Specifically, the timer proxy may be deployed on a service server, and when a service object is migrated to the service server, the network address of the service server is the network address of the service server after the migration of the service object occurs.
A seventh aspect of the present invention provides a timer control system, including: the generating unit is used for generating timer information according to the service operation logic; the timer information carries an information type identifier of the timer information, and the timer information includes any one of the following items or a combination thereof: service object ID, timer ID, adding or deleting timing task information and time information; a sending unit for sending the timer information to the timer agent.
The timer control system provided by the invention is used for the business object. The creation of the timer is triggered automatically by the business object entirely according to the run logic, and the timing time is also determined by the business object. The timer server only needs to monitor the timing time according to the needs of the service object and inform the timer server that the timing time is up at the appointed time point. When the service object is migrated, the network addresses before and after the migration do not need to be considered, the network addresses only need to be processed by the timer agent, and the timer agent can acquire the network address of the service server after the migration. When a business object needs to add or delete a timing task, the timer ID and the corresponding requirement information of the added and deleted tasks are sent to the timer proxy, and the timer proxy interacts with the timer server so that the timer server controls the timing requirement of the timer server.
An eighth aspect of the present invention provides a readable storage medium, on which a program or instructions are stored, which when executed by a processor, implement the steps of the timer control method according to the above technical solution.
The readable storage medium provided by the present invention, when the stored program or the instructions are executed, can implement the steps of the timer control method according to the above technical solution. Therefore, all the advantages of the timer control method are achieved, and are not discussed in detail here.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is one of the flow diagrams of a timer control method according to an embodiment of the present invention;
FIG. 2 is a second flowchart of a timer control method according to an embodiment of the present invention;
FIG. 3 is a third flowchart illustrating a timer control method according to an embodiment of the present invention;
FIG. 4 is a fourth flowchart of a timer control method according to an embodiment of the present invention;
FIG. 5 is a fifth flowchart illustrating a timer control method according to an embodiment of the present invention;
FIG. 6 is one of the schematic block diagrams of the timer control system of one embodiment of the present invention;
FIG. 7 is a second schematic block diagram of a timer control system in accordance with one embodiment of the present invention;
FIG. 8 is a third schematic block diagram of a timer control system in accordance with one embodiment of the present invention;
FIG. 9 is a fourth schematic block diagram of a timer control system of one embodiment of the present invention;
FIG. 10 is a system architecture diagram of a timer control system of one embodiment of the present invention;
fig. 11 is a schematic diagram of migration of a service server in the timer control system according to an embodiment of the present invention;
FIG. 12 is a schematic diagram of the timed registration of a business object of the timer control method according to one embodiment of the present invention;
fig. 13 is a diagram illustrating a new timing task of the timer control method according to an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
The timer control method and system, and the readable storage medium according to some embodiments of the present invention are described below with reference to fig. 1 to 13.
Example one
Fig. 1 is a flowchart illustrating a timer control method according to an embodiment of the present invention. The timer control method comprises the following steps:
step 102, receiving timer information and network address or timer information sent by a timer agent;
104, when receiving the timer information and the network address, determining a service object ID according to the timer information and updating the network address of the corresponding service object according to the service object ID and the network address;
step 106, when the timer information is received, determining the information type of the timer information;
step 108, when the information type is timer notification information, binding the service object ID and the timer ID included in the timer information;
and step 110, when the information type is the adding and deleting information of the timing task, adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information included by the timer information, and establishing a corresponding relation between the timing task and the timer ID.
The timer control method provided by the embodiment is used for a timer server. The timer server interacts with the timer proxy and controls the timer of the service object through the timer proxy. When receiving the network address and the timer information sent by the timer agent, the service object is described to be migrated. And binding the service object ID with the network address by determining the service object ID in the timer information, so as to realize the update of the network address of the corresponding service object. When only timer information is received, further determining the information type of the timer information, and when the information type is determined to be timer notification information, namely the notification information of the timer is created by the service object, binding the service object ID and the timer ID in the timer information; and when the information type is determined to be the adding and deleting information of the timing task, adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information in the timing information, and establishing a corresponding relation between the timing task and the timer ID. The timer control method provided in this embodiment controls the timer based on the system architecture of the timer server, the timer proxy and the service object, the timer server exists independently of the service, and the movement of the service object among different service servers does not cause the failure of the timer, so that the problem of abnormal timing manager caused by adding/removing the timer again in the timing event processing logic in the conventional timer can be avoided, and the resource loss of the service can be reduced. And the timer information can be asynchronously responded and processed, and the problem that the timer manager is abnormal because the timer is added/removed again in the timing event processing logic is solved.
In addition, the traditional timer can only be developed and realized again in the self system, and the timer control method provides the capability of directly providing timing service for a third party.
The migration of the business object refers to the movement of the business object between the business servers, and specifically refers to the movement of the business object from one business server to another business server.
Example two
Fig. 2 is a second flowchart of a timer control method according to an embodiment of the invention. The timer control method comprises the following steps:
step 202, receiving timer information and network address or timer information sent by a timer agent;
step 204, when receiving the timer information and the network address, determining a service object ID according to the timer information, and updating the network address of the corresponding service object according to the service object ID and the network address;
step 206, when the timer information is received, determining the information type of the timer information;
step 208, when the information type is timer notification information, binding the service object ID and the timer ID included in the timer information;
step 210, when the information type is the adding and deleting information of the timing task, adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information included by the timer information, and establishing a corresponding relation between the timing task and the timer ID;
step 212, judging whether the timing task needs to be triggered according to the time information; if yes, go to step 214;
step 214, generating timing trigger information;
step 216, determining a corresponding timer ID according to the corresponding relation between the timing task and the timer ID;
step 218, determining a corresponding service object ID according to the timer ID, and determining a timer proxy ID according to the network address corresponding to the service object ID;
step 220, sending the timing trigger information to the timer agent corresponding to the timer agent ID.
In this embodiment, the time information is the timing time of the timed task in the timer, so that whether the timed task reaches the trigger time can be determined according to the time, and the timed trigger information is generated when the timed task needs to be triggered. Meanwhile, a business object to which the timing task belongs is determined according to the corresponding relation between the timing task and the timer ID, and the timer agent ID of the timer agent is further determined according to the network address corresponding to the business object ID, so that the timing trigger information can be sent to the corresponding timer agent, the timer agent is made to inform the corresponding business object, and the smooth triggering of the timing task is ensured.
The timer server may have a plurality of timers in a slot, which are organized in a data structure in the form of a list, such as list or vector. When time goes to slot 2, the timing manager needs to traverse this list, triggering the timer. If the logic for adding or deleting the timer again exists in the timer callback processing logic, the reference address of the list element is necessarily changed. At this time, the pointer currently used to traverse the list cannot be used, otherwise there is a serious problem of access exception.
In the embodiment, an asynchronous processing mechanism is adopted, and the operation of adding and deleting the timer/timing task again in the logic triggered by the timer can be performed only in the processing of the next time slice of the timer server, so that the access of the current timer list cannot be influenced, and the problem of abnormal access can be avoided.
EXAMPLE III
Fig. 3 is a third flowchart illustrating a timer control method according to an embodiment of the invention. The timer control method comprises the following steps:
step 302, receiving timer information sent by a service object, wherein the timer information includes an information type of the timer information;
step 304, judging whether the information type is business object migration information;
step 306, when the judgment result is yes, determining the network address of the service server after the service object is migrated, and sending the network address and the timer information to the timer server;
and 308, when the judgment result is negative, forwarding the timer information to the timer server.
The timer control method provided by the embodiment is used for a timer agent. The timer proxy is a bridge for the business object and the timer server. When receiving the timer information sent by the service object, firstly, judging whether the information type of the timer information is the service object migration information, if so, determining the network address of the service server after the service object migration, and sending the network address and the timer information to the timer server. Otherwise, the timer information is not required to be processed, and the timer information is directly forwarded to the timer server. Therefore, for the service object, the network address of the service server does not need to be considered when the service object is migrated, and for the timer agent, the information type only needs to be judged once without other data processing, so that the timing processing efficiency can be improved, and network resources are saved.
Specifically, the timer proxy may be deployed on a service server, and when a service object is migrated to the service server, the network address of the service server is the network address of the service server after the migration of the service object occurs.
Example four
Fig. 4 is a fourth flowchart illustrating a timer control method according to an embodiment of the invention. The timer control method comprises the following steps:
step 402, generating timer information according to the service operation logic;
step 404, sending the timer information to a timer agent;
the timer information carries an information type identifier of the timer information, and the timer information includes any one of the following items or a combination thereof: service object ID, timer ID, adding or deleting timing task information, and time information.
The timer control method provided by the embodiment is used for a business object. The creation of the timer is triggered automatically by the business object entirely according to the run logic, and the timing time is also determined by the business object. The timer server only needs to monitor the timing time according to the needs of the service object and inform the timer server that the timing time is up at the appointed time point. When the service object is migrated, the network addresses before and after the migration do not need to be considered, the network addresses only need to be processed by the timer agent, and the timer agent can acquire the network address of the service server after the migration. When a business object needs to add or delete a timing task, the timer ID and the corresponding requirement information of the added and deleted tasks are sent to the timer proxy, and the timer proxy interacts with the timer server so that the timer server controls the timing requirement of the timer server.
EXAMPLE five
Fig. 5 is a fifth flowchart illustrating a timer control method according to an embodiment of the invention. The timer control method comprises the following steps:
step 502, generating timer information according to the service operation logic;
step 504, sending the timer information to a timer agent;
step 506, receiving the timer trigger information forwarded by the timer agent, and responding to the timer trigger information.
Wherein the timer information comprises any one or a combination of: creating notification information of a timer, migration notification information of a service object, and requirement information of adding or deleting a timing task, wherein the requirement information of the timing task comprises timing time of the timer.
In this embodiment, timer triggering is implemented by receiving and responding to timer trigger information forwarded by the timer agent.
EXAMPLE six
FIG. 6 is one of the schematic block diagrams of a timer control system 600 of one embodiment of the present invention. Wherein, this timer control system 600 includes:
a memory 602 storing programs or instructions;
processor 604, processor 604 implementing the steps of the timer control method as described in the embodiments above when the program or instructions are executed.
The timer control system 600 provided by the present embodiment includes a memory 602 and a processor 604. The memory 602 stores programs or instructions, and the processor 604 can implement the steps of the timer control method according to any one of the embodiments when executing the programs or instructions. Therefore, the timer control system 600 has all the beneficial technical effects of the timer control method, and is not discussed herein.
EXAMPLE seven
Fig. 7 is a second schematic block diagram of a timer control system 700 in accordance with an embodiment of the present invention. Among them, the timer control system 700 includes:
a receiving unit 702, configured to receive timer information and a network address or timer information sent by a timer agent;
a migration unit 704, configured to, when receiving the timer information and the network address, determine a service object ID according to the timer information, and update the network address of the corresponding service object according to the service object ID and the network address;
a determining unit 706, configured to determine an information type of the timer information when the timer information is received; the creating unit is used for binding the service object ID and the timer ID included by the timer information when the information type is the timer notification information;
the processing unit 708 is configured to, when the information type is the adding and deleting information of the timing task, add or delete the timing task according to the timer ID, the adding and deleting information, and the time information included in the timer information, and establish a corresponding relationship between the timing task and the timer ID.
The timer control system 700 provided in this embodiment is used for a timer server. The timer server interacts with the timer proxy and controls the timer of the service object through the timer proxy. When the receiving unit 702 receives the network address and the timer information sent by the timer agent, it indicates that the service object has migrated. The migration unit 704 determines the service object ID in the timer information, and binds the service object ID with the network address, thereby updating the network address of the corresponding service object. When only timer information is received, the determining unit 706 needs to further determine the information type of the timer information, and when the information type is determined to be timer notification information, that is, the notification information of the service object creation timer, the service object ID and the timer ID in the timer information are bound through the processing unit 708; when the information type is determined to be the adding and deleting information of the timing task, the processing unit adds or deletes the timing task according to the timer ID, the adding and deleting information and the time information in the timing information and establishes the corresponding relation between the timing task and the timer ID. The timer control system 700 provided by the invention controls the timer based on the system architecture of the timer server, the timer proxy and the business object, the timer server exists independently of the business service, and the movement of the business object among different business servers can not cause the failure of the timer, thereby avoiding the problem of abnormal timing manager caused by adding/removing the timer again in the timing event processing logic in the traditional timer, and reducing the resource loss of the business service. And the timer information can be asynchronously responded and processed, and the problem that the timer manager is abnormal because the timer is added/removed again in the timing event processing logic is solved.
In addition, the traditional timer can only be developed and realized again in the self system, and the timer control method provides the capability of directly providing timing service for a third party.
The migration of the business object refers to the movement of the business object between the business servers, and specifically refers to the movement of the business object from one business server to another business server.
Example eight
Fig. 8 is a third schematic block diagram of a timer control system 800 in accordance with an embodiment of the present invention. The timer control system 800 includes:
a receiving unit 802, configured to receive timer information sent by a service object, where the timer information includes an information type of the timer information;
a determining unit 804, configured to determine whether the information type is service object migration information;
a migration unit 806, configured to determine, when the determination result is yes, a network address of the service server after the migration of the service object, and send the network address and the timer information to the timer server;
and a forwarding unit 808, configured to forward the timer information to the timer server when the determination result is negative.
The timer control system 800 provided in this embodiment is used for a timer agent. The timer proxy is a bridge for the business object and the timer server. When the receiving unit 802 receives the timer information sent by the service object, the determining unit 804 determines whether the information type of the timer information is the service object migration information, if so, the migrating unit 806 needs to determine the network address of the service server after the service object migration, and sends the network address and the timer information to the timer server. Otherwise, the timer information does not need to be processed, and the timer information is directly forwarded to the timer server through the forwarding unit 808. Therefore, for the service object, the network address of the service server does not need to be considered when the service object is migrated, and for the timer agent, the information type only needs to be judged once without other data processing, so that the timing processing efficiency can be improved, and network resources are saved.
Specifically, the timer proxy may be deployed on a service server, and when a service object is migrated to the service server, the network address of the service server is the network address of the service server after the migration of the service object occurs.
Example nine
Fig. 9 is a fourth schematic block diagram of a timer control system 900 according to an embodiment of the present invention. The timer control system 900 includes:
a generating unit 902, configured to generate timer information according to the service operation logic;
a sending unit 904, configured to send the timer information to the timer agent;
the timer information carries an information type identifier of the timer information, and the timer information includes any one of the following items or a combination thereof: service object ID, timer ID, adding or deleting timing task information, and time information.
The timer control system 900 provided in this embodiment is used for business objects. The creation of the timer is triggered automatically by the business object entirely according to the run logic, and the timing time is also determined by the business object. The timer server only needs to monitor the timing time according to the needs of the service object and inform the timer server that the timing time is up at the appointed time point. When the service object is migrated, the network addresses before and after the migration do not need to be considered, the network addresses only need to be processed by the timer agent, and the timer agent can acquire the network address of the service server after the migration. When a business object needs to add or delete a timing task, the timer ID and the corresponding requirement information of the added and deleted tasks are sent to the timer proxy, and the timer proxy interacts with the timer server so that the timer server controls the timing requirement of the timer server.
Example ten
The present embodiment provides a readable storage medium on which a program or instructions are stored, which when executed by a processor implement the steps of the timer control method as in the above embodiments.
The present embodiment proposes a readable storage medium, which stores a program or instructions that, when executed, can implement the steps of the timer control method according to the above embodiment. Therefore, all the advantages of the timer control method are achieved, and are not discussed in detail here.
EXAMPLE eleven
In this embodiment, as shown in fig. 10, a system architecture of the Timer control system includes three parts, namely, a Timer manager (i.e., a Timer server), a Proxy manager (i.e., an agent manager), and a TimerProxy client (i.e., a Timer agent).
The Proxy manager manages timer agents for a plurality of traffic servers. In order to ensure the message transmission efficiency, a classic Server-Client mode is adopted, and the manager keeps long connection with the Proxy Client of the service Server. The network Timer manager implements the conventional Timer method, a Timer wheel implementation, on the server side. Unlike a traditional timer manager, this manager maintains the user (business object) id of the timer and its proxy address. The TimerProxy client is the bridge for information interaction. The business object can conveniently use the Timer through the Proxy, just like using the traditional local Timer manager. When the TimerProxy processes the timing notification of the network timer, the TimerProxy finds the service object reference according to the service object ID attached in the notification, and triggers the timer task.
When the service server is started, the service server notifies and registers the local TimerProxy to the network Timer manager. The business object adds and deletes the timing task to the network Timer service through the local TimerProxy, and the business object informs the network Timer manager through the business object when the migration is generated among the business servers. As shown in FIG. 11, business object B is migrated from Server A to Server B. The interaction of the business objects with the network timing manager is an asynchronous manner. The Timer manager sends a timing notification message to the service object after detecting the Timer trigger. The business object needs to have the capability to process asynchronous messages, respond to and process timing notifications in the logic that processes asynchronous messages. The timings of adding, deleting, and responding to the timing notice are shown in fig. 12 and 13.
The network timing manager uses the flow:
1) the timer agent is configured with a network timer network address.
2) A timer agent is started.
3) And each service object acquires a timer proxy and performs the addition and deletion of the timer and the migration work of the service object.
4) Each business object responds to the timing notice and processes the timing task.
When the business system rule is complex, logic for adding or deleting the timer again exists in the processing logic of the timing task. When the traditional timing manager processes the logic, the condition of reference access exception exists.
The timer manager has a plurality of timers in slot 2, which are organized in a data structure in the form of a list, such as list or vector. When time goes to slot 2, the timing manager needs to traverse this list, triggering the timer. If the logic for adding or deleting the timer again exists in the timer callback processing logic, the reference address of the list element is necessarily changed. At this time, the pointer currently used to traverse the list cannot be used, otherwise there is a serious problem of access exception.
The implementation of this embodiment is that the network timing server processes the timer information by using an asynchronous processing mechanism, and the operations of adding and deleting the timer again in the logic triggered by the timer are only performed in the processing of the next time slice of the network timing server, and the access of the current timer list is not affected.
The timer control method and the timer control system provided by the embodiment can achieve the following beneficial technical effects:
1) the network timing manager exists independently of the business service, so that the resource loss of the business service is reduced;
2) the asynchronous implementation mode of the network timer naturally solves the problem that the timer is added/removed again in the timing event processing logic to cause the abnormality of the timing manager;
3) the traditional timer can be developed and realized again only in the system of the traditional timer, and the scheme provides the capability of directly providing timing service for a third party.
In the description herein, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance unless explicitly stated or limited otherwise; the terms "connected," "mounted," "secured," and the like are to be construed broadly and include, for example, fixed connections, removable connections, or integral connections; may be directly connected or indirectly connected through an intermediate. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A timer control method, comprising:
receiving timer information and a network address or the timer information sent by a timer agent;
when the timer information and the network address are received, determining a business object ID according to the timer information, and updating the network address of the corresponding business object according to the business object ID and the network address;
when the timer information is received, determining the information type of the timer information;
when the information type is timer notification information, binding the service object ID and the timer ID included in the timer information;
and when the information type is timing task adding and deleting information, adding or deleting a timing task according to the timer ID, the adding and deleting information and the time information which are included by the timer information, and establishing a corresponding relation between the timing task and the timer ID.
2. The timer control method according to claim 1, further comprising:
judging whether the timing task needs to be triggered or not according to the time information;
when the timing task needs to be triggered, generating timing trigger information;
determining a corresponding timer ID according to the corresponding relation between the timing task and the timer ID;
determining a corresponding service object ID according to the timer ID, and determining a timer agent ID according to a network address corresponding to the service object ID;
and sending the timing trigger information to a timer agent corresponding to the timer agent ID.
3. A timer control method, comprising:
receiving timer information sent by a service object, wherein the timer information comprises the information type of the timer information;
judging whether the information type is business object migration information or not;
when the judgment result is yes, determining the network address of the service server after the service object is migrated, and sending the network address and the timer information to a timer server;
and when the judgment result is negative, forwarding the timer information to the timer server.
4. A timer control method, comprising:
generating timer information according to the service operation logic;
sending the timer information to a timer agent;
wherein the timer information comprises any one or a combination of: the information type of the timer information, the service object ID, the timer ID, the timing task adding or deleting information and the time information.
5. The timer control method according to claim 4, further comprising:
and receiving timer trigger information forwarded by the timer agent, and responding to the timer trigger information.
6. A timer control system, comprising:
a memory storing programs or instructions;
a processor implementing the steps of the timer control method of any one of claims 1 to 5 when executing the program or instructions.
7. A timer control system, comprising:
a receiving unit, configured to receive timer information and a network address or the timer information sent by a timer agent;
the migration unit is used for determining a service object ID according to the timer information when the timer information and the network address are received, and updating the network address of the corresponding service object according to the service object ID and the network address;
the determining unit is used for determining the information type of the timer information when the timer information is received;
a creating unit, configured to bind the service object ID and the timer ID included in the timer information when the information type is timer notification information;
and the processing unit is used for adding or deleting the timing task according to the timer ID, the adding and deleting information and the time information which are included by the timer information and establishing the corresponding relation between the timing task and the timer ID when the information type is the adding and deleting information of the timing task.
8. A timer control system, comprising:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving timer information sent by a service object, and the timer information comprises the information type of the timer information;
a judging unit, configured to judge whether the information type is service object migration information;
the migration unit is used for determining the network address of the service server after the service object is migrated and sending the network address and the timer information to the timer server when the judgment result is yes;
and the forwarding unit forwards the timer information to the timer server when the judgment result is negative.
9. A timer control system, comprising:
the generating unit is used for generating timer information according to the service operation logic;
wherein the timer information carries an information type identifier of the timer information, and the timer information includes any one of or a combination of the following items: service object ID, timer ID, adding or deleting timing task information and time information;
a sending unit, configured to send the timer information to a timer agent.
10. A readable storage medium on which a program or instructions are stored, characterized in that the program or instructions, when executed by a processor, implement the steps of the timer control method according to any one of claims 1 to 5.
CN202111354375.4A 2021-11-16 2021-11-16 Timer control method and system and readable storage medium Active CN113794740B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111354375.4A CN113794740B (en) 2021-11-16 2021-11-16 Timer control method and system and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111354375.4A CN113794740B (en) 2021-11-16 2021-11-16 Timer control method and system and readable storage medium

Publications (2)

Publication Number Publication Date
CN113794740A true CN113794740A (en) 2021-12-14
CN113794740B CN113794740B (en) 2022-03-11

Family

ID=78955229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111354375.4A Active CN113794740B (en) 2021-11-16 2021-11-16 Timer control method and system and readable storage medium

Country Status (1)

Country Link
CN (1) CN113794740B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060218429A1 (en) * 2005-03-25 2006-09-28 Microsoft Corporation Method and system for configuring a timer
US20090092099A1 (en) * 2006-06-14 2009-04-09 Huawei Technologies Co., Ltd. Method and Apparatus of Shifting Functional Entity In Wimax Network
CN101477386A (en) * 2009-01-12 2009-07-08 杭州华三通信技术有限公司 Timer implementing method and apparatus
CN101599818A (en) * 2008-06-05 2009-12-09 大唐移动通信设备有限公司 The method and the GTP information node of timer information are set for GTP message
CN101884028A (en) * 2007-12-03 2010-11-10 诺基亚公司 Method and apparatus for timer event management
CN102207888A (en) * 2011-05-09 2011-10-05 大唐移动通信设备有限公司 Method and device for managing timer
CN110262883A (en) * 2019-06-19 2019-09-20 深圳市道通科技股份有限公司 Task processing method, device and electronic equipment based on timer
CN110362351A (en) * 2019-06-06 2019-10-22 宁波麦度智联科技股份有限公司 A kind of execution method of the NBIOT application process system of low-power consumption
CN110968147A (en) * 2018-09-30 2020-04-07 武汉斗鱼网络科技有限公司 Timer creating method and device, electronic equipment and medium
CN111338774A (en) * 2020-02-21 2020-06-26 华云数据有限公司 Distributed timing task scheduling system and computing device
CN111381961A (en) * 2019-04-09 2020-07-07 深圳市鸿合创新信息技术有限责任公司 Method and device for processing timing task and electronic equipment

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060218429A1 (en) * 2005-03-25 2006-09-28 Microsoft Corporation Method and system for configuring a timer
US20090092099A1 (en) * 2006-06-14 2009-04-09 Huawei Technologies Co., Ltd. Method and Apparatus of Shifting Functional Entity In Wimax Network
CN101884028A (en) * 2007-12-03 2010-11-10 诺基亚公司 Method and apparatus for timer event management
CN101599818A (en) * 2008-06-05 2009-12-09 大唐移动通信设备有限公司 The method and the GTP information node of timer information are set for GTP message
CN101477386A (en) * 2009-01-12 2009-07-08 杭州华三通信技术有限公司 Timer implementing method and apparatus
CN102207888A (en) * 2011-05-09 2011-10-05 大唐移动通信设备有限公司 Method and device for managing timer
CN110968147A (en) * 2018-09-30 2020-04-07 武汉斗鱼网络科技有限公司 Timer creating method and device, electronic equipment and medium
CN111381961A (en) * 2019-04-09 2020-07-07 深圳市鸿合创新信息技术有限责任公司 Method and device for processing timing task and electronic equipment
CN110362351A (en) * 2019-06-06 2019-10-22 宁波麦度智联科技股份有限公司 A kind of execution method of the NBIOT application process system of low-power consumption
CN110262883A (en) * 2019-06-19 2019-09-20 深圳市道通科技股份有限公司 Task processing method, device and electronic equipment based on timer
CN111338774A (en) * 2020-02-21 2020-06-26 华云数据有限公司 Distributed timing task scheduling system and computing device

Also Published As

Publication number Publication date
CN113794740B (en) 2022-03-11

Similar Documents

Publication Publication Date Title
JP4945573B2 (en) Method and management agent for event notification correlation
US10880779B2 (en) User plane resource management method, user plane network element, and control plane network element
JPWO2015146355A1 (en) Update management system and update management method
CN112039769A (en) Method for processing route and network equipment
CN113794740B (en) Timer control method and system and readable storage medium
CN113726556A (en) Operation and maintenance method, system, storage medium and computing device for edge internet of things agent node
CN107517163B (en) Method and device for switching OSPF router identification
CN111314443A (en) Node processing method, device and equipment based on distributed storage system and medium
CN114629825A (en) Path detection method, device and node of computing power sensing network
CN113612636B (en) Software defined network topology discovery method and system
US5404501A (en) Fault-tolerant method of communicating between processes in a multi processor system by keeping track of the current node location of messages
CN113285836B (en) System and method for enhancing toughness of software system based on micro-service real-time migration
CN113179491B (en) Multi-network communication method, device, robot and storage medium
EP3424182B1 (en) Neighbor monitoring in a hyperscaled environment
CN107453995B (en) Designated router election method, device, router and communication system
CN111835544B (en) Monitoring method and system of virtual router based on user mode protocol stack
CN112994977A (en) Method for high availability of server host
CN113515458A (en) Method and system for reducing resource consumption of test environment based on Envoy plug-in
CN113157441A (en) Distributed decentralized load balancing method and system
WO2024024107A1 (en) Control of network load prediction start timing
CN111427672A (en) Intensive task distributed intelligent scheduling method and system
CN111611048A (en) Migration method and device of virtual machine in cloud computing environment and computer equipment
CN114225384B (en) Communication method, system, equipment and storage medium based on combinable GM instruction
JP2003030161A (en) Mobile agent fault monitoring method
CN116708295A (en) Traffic scheduling method, network equipment and system of computing power network

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