Timing task configuration method and device, medium and equipment

By automatically logging in to the distributed scheduling service when the business management system is started and updating the executor and timing tasks, the problem of manual configuration in the prior art is solved, and efficient and automated task management is achieved.

CN119718458APending Publication Date: 2025-03-28SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411671349.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When the existing distributed task scheduling platform adds a timed task or executor, users need to manually log in to the management interface for configuration, which makes it time-consuming and easy to miss when the task volume is large, affecting the normal operation of the business.

Method used

When the business management system is started, the distributed scheduling service is automatically logged in to the distributed scheduling service, obtain cookies information, judge and update pre-configured executors and timing tasks, and automatically register and configure tasks through annotations and configuration files.

Benefits of technology

It enables users to automatically configure and update timing tasks and executors without manual operations, significantly improving task management efficiency and flexibility, avoiding omissions and human errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718458A_ABST
    Figure CN119718458A_ABST
Patent Text Reader

Abstract

The invention provides a timed task configuration method and device, a medium and equipment. The method comprises the following steps: when a business management system is started, logging in a distributed scheduling service, acquiring cookies information during logging in, and storing the cookies information in a cache; according to the cookies information, whether a pre-configured actuator exists or not is judged; if not, newly adding an actuator; if yes, performing information updating on the actuator; for the actuator, obtaining a method with a first annotation and a second annotation at the same time, cyclically traversing the timed tasks corresponding to the method, and checking whether each traversed timed task exists or not; wherein the first annotation is used for describing task related information, and the second annotation is used for describing task automatic registration information; if not, newly adding the timed task; and if yes, performing information updating on the timed task according to the first annotation. The task management efficiency and flexibility can be remarkably improved, omission can be avoided, and human errors are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of scheduled task management, and in particular to a scheduled task configuration method, device, medium and equipment. Background Art

[0002] The current distributed task scheduling platform XXL-JOB is an open source distributed task scheduling framework designed for Java environment and aims to provide efficient scheduled task management solutions. It consists of the scheduling center, namely XXL-JOB Admin, and the executor, namely XXL-JOB Executor. The scheduling center is responsible for the creation, management and monitoring of scheduled tasks, while the executor actually executes the scheduled tasks, and the executor supports distributed deployment. XXL-JOB allows users to flexibly configure tasks through cron expressions and fixed intervals, and has the functions of retrying and dynamically adjusting failed tasks. In addition, it provides detailed task execution status and logging functions to ensure reliable execution and real-time monitoring of tasks. The design of this framework enables it to meet various task scheduling needs and is suitable for scenarios that require efficient task management and monitoring.

[0003] Usually, when adding a scheduled task or executor, you need to log in to the management interface of the distributed task scheduling platform and manually add the relevant executors and tasks. This process is not only time-consuming, but also prone to omissions when the task volume is large, thus affecting the normal operation of the business. Summary of the invention

[0004] In view of at least one of the above technical problems, an embodiment of the present invention provides a scheduled task configuration method and apparatus, medium, and equipment.

[0005] According to a first aspect, a scheduled task configuration method provided by an embodiment of the present invention includes:

[0006] When the business management system is started, log in to the distributed scheduling service, obtain the cookies information during login, and save the cookies information in the cache;

[0007] According to the cookies information in the cache, determine whether the pre-configured executor exists; if not, add a new executor; if it exists, update the information of the executor;

[0008] For the executor, obtain a method having both a first annotation and a second annotation, loop through the scheduled tasks corresponding to the method, and check whether each traversed scheduled task exists; wherein the first annotation is used to describe task-related information, and the second annotation is used to describe task automatic registration information;

[0009] If it does not exist, a new scheduled task is created; if it exists, the information of the scheduled task is updated according to the first annotation.

[0010] In one embodiment, the method further includes: pre-configuring login-related information of the distributed scheduling service in a configuration file; wherein the login-related information includes the server address, user name, password and executor information of the distributed scheduling service; correspondingly, the logging in to the distributed scheduling service includes: logging in to the distributed scheduling service according to the login-related information.

[0011] In one embodiment, judging whether a pre-configured executor exists according to the cookies information in the cache includes:

[0012] Determine the name of the executor that executes the scheduled task according to the scheduled task corresponding to the task related information in the first annotation;

[0013] According to the cookies information and the name of the executor, the executor list interface is called to obtain an executor list formed by each executor associated with the name obtained by the executor list interface through fuzzy query;

[0014] It is determined whether there is an executor with the name in the executor list, so as to determine whether the executor exists.

[0015] In one embodiment, the method for obtaining a data file having both a first annotation and a second annotation includes:

[0016] Filter out each method having the second annotation, and store each filtered method and the scheduled task corresponding to the method as a mapping data in the first mapping table;

[0017] Traversing the first mapping table, and checking whether a method in each traversed mapping data has the first annotation;

[0018] The method determined to have the first annotation after checking is regarded as a method having both the first annotation and the second annotation.

[0019] In one embodiment, before obtaining the method having both the first annotation and the second annotation, the method further includes: creating a customized first annotation, and marking the first annotation in the method marked as a scheduled task and having the second annotation.

[0020] In one embodiment, before looping through the scheduled tasks corresponding to the method, the method further includes:

[0021] When the business management system is started, monitoring the initialization completion event through the application monitoring interface;

[0022] After monitoring the initialization completion event, the context object in the backend framework is obtained through the application context acquisition interface, and each scheduled task corresponding to the method with the first annotation and the second annotation is obtained through the context object.

[0023] In one embodiment, updating the information of the scheduled task according to the first annotation includes: updating the execution time of the scheduled task according to the task execution time in the task-related information in the first annotation; and / or updating the information of the executor includes: updating the information of the executor according to the executor information in the configuration file.

[0024] According to a second aspect, a timed task configuration device provided by an embodiment of the present invention includes:

[0025] An information acquisition module is used to log in to the distributed scheduling service when the business management system is started, obtain the cookies information during the login, and save the cookies information in the cache;

[0026] A first judgment module is used to judge whether a pre-configured executor exists according to the cookies information in the cache; if not, a new executor is added; if it exists, information of the executor is updated;

[0027] A second judgment module is used to obtain a method having both a first annotation and a second annotation for the executor, loop through the scheduled tasks corresponding to the method, and check whether each traversed scheduled task exists; wherein the first annotation is used to describe task related information, and the second annotation is used to describe task automatic registration information;

[0028] The task processing module is used to add a scheduled task if it does not exist; if it exists, update the information of the scheduled task according to the first annotation.

[0029] In one embodiment, the device may further include:

[0030] A file configuration module is used to pre-configure login-related information of the distributed scheduling service in a configuration file; wherein the login-related information includes the server address, user name, password and executor information of the distributed scheduling service; correspondingly, the login to the distributed scheduling service in the information acquisition module includes: logging in to the distributed scheduling service according to the login-related information.

[0031] In one embodiment, the first judgment module is specifically used to: determine the name of the executor that executes the scheduled task according to the scheduled task corresponding to the task-related information in the first annotation; call the executor list interface according to the cookies information and the name of the executor to obtain the executor list formed by each executor associated with the name obtained by fuzzy query through the executor list interface; and determine whether there is an executor with the name in the executor list to determine whether the executor exists.

[0032] In one embodiment, the second judgment module is specifically used to: filter out each method having the second annotation, and store each filtered method and the scheduled task corresponding to the method as a mapping data in the first mapping table; traverse the first mapping table to check whether the method in each traversed mapping data has the first annotation; and treat the method that is determined to have the first annotation after inspection as a method having both the first annotation and the second annotation.

[0033] In one embodiment, before acquiring the method having both the first annotation and the second annotation, the second judgment module is further used to: create a customized first annotation, and mark the first annotation in the method marked as a scheduled task and having the second annotation.

[0034] In one embodiment, before looping through the scheduled tasks corresponding to the method, the second judgment module is also used to: when the business management system is started, listen to the initialization completion event through the application listening interface; after listening to the initialization completion event, obtain the context object in the backend framework through the application context acquisition interface, and obtain each scheduled task corresponding to the method with the first annotation and the second annotation through the context object.

[0035] In one embodiment, the updating of information of the scheduled task according to the first annotation in the first judgment module includes: updating the execution time of the scheduled task according to the task execution time in the task-related information in the first annotation; and / or, the updating of information of the executor in the task processing module includes: updating the information of the executor according to the executor information in the configuration file.

[0036] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.

[0037] According to a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0038] The scheduled task configuration method, device, medium, and equipment provided in the embodiment of the present invention log in to the distributed scheduling service when the business management system is started, obtain the cookies information at the time of login, and determine whether the pre-configured executor exists based on the cookies information; if not, add a new executor; if it exists, update the information of the executor; obtain a method with both the first annotation and the second annotation, check whether the scheduled task corresponding to the method exists, if not, add a new scheduled task; if it exists, update the information of the scheduled task. It can be seen that in the embodiment of the present invention, automatic user login, creation or update of executors, and creation or update of scheduled tasks can be realized without manual operation by the user, which can significantly improve the efficiency and flexibility of task management. Since no human intervention is required, omissions can be avoided and human errors can be reduced, that is, the risk of failures that may be caused by manual operations can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of a flow chart of a method for configuring a scheduled task in an embodiment of the present invention;

[0040] Figure 2 It is a structural block diagram of a timing task configuration device in one embodiment of the present invention. DETAILED DESCRIPTION

[0041] In a first aspect, an embodiment of the present invention provides a method for configuring a scheduled task. Figure 1 The method comprises the following steps S110 to S140:

[0042] S110, when the business management system is started, log in to the distributed scheduling service, obtain the cookies information during the login, and save the cookies information in the cache;

[0043] Among them, the distributed scheduling service is the XXL-JOB service. XXL-JOB is a lightweight distributed task scheduling service, and its core design goal is to be fast to develop, easy to learn, lightweight, and easy to expand.

[0044] Specifically, you can log in to the XXL-JOB service through HTTP request, obtain and save the login cookie information to the cache. The cache, for example, is Redis. Redis is Remote Dictionary Server, which is an open source log-type, Key-Value database written in ANSI C language, supporting the network, memory-based and persistent, and provides multiple language APIs.

[0045] Among them, cookie information refers to user login information stored using small data files.

[0046] In one embodiment, the method may further include: pre-configuring the login related information of the distributed scheduling service in a configuration file; wherein the login related information includes the server address, user name, password and executor information of the distributed scheduling service;

[0047] Correspondingly, the logging into the distributed scheduling service in S110 may include: logging into the distributed scheduling service according to the login related information.

[0048] It can be seen that the server address, user name, and password required to log in to the distributed scheduling service are configured in advance in the configuration file, so as to facilitate logging in to the distributed scheduling service in S110. At the same time, the relevant information of each executor is configured in the configuration file for subsequent use. For example, it can be used to determine which scheduled tasks each executor needs to execute.

[0049] In one embodiment, before obtaining the method having both the first annotation and the second annotation in S130, the method further includes: creating a customized first annotation, and setting the first annotation in the method marked as a scheduled task and having the second annotation.

[0050] It can be seen that the first annotation is customized in advance, and the first annotation is used to describe the relevant information of each scheduled task that the executor needs to execute. The first annotation is @XxlJobRegister, which is used to declare the cron expression of the scheduled task, task description, person in charge, routing strategy, that is, the scheduling method of the scheduled task, task status and other information.

[0051] The second annotation is @XxlJob, which is originally set in the method marked as a scheduled task to realize the automatic registration and configuration of the scheduled task. When the first annotation is set in the method marked as a scheduled task and having the second annotation, these methods have both the first annotation and the second annotation. The method here refers to the function that realizes the scheduled task.

[0052] S120, judging whether a pre-configured executor exists according to the cookies information in the cache; if not, adding a new executor; if existing, updating information of the executor;

[0053] In one embodiment, determining whether a pre-configured executor exists according to the cookies information in the cache in S120 may include:

[0054] S121. Determine the name of an executor that executes the scheduled task according to the scheduled task corresponding to the task related information in the first annotation;

[0055] S122, calling an executor list interface according to the cookies information and the name of the executor, to obtain an executor list formed by each executor associated with the name obtained by the executor list interface through fuzzy query;

[0056] S123: Determine whether there is an executor with the name in the executor list, so as to determine whether the executor exists.

[0057] That is to say, according to the scheduled task involved in the task related information in the first annotation and the configuration file obtained by the previous configuration, it is possible to determine which executor is required to execute the scheduled task, that is, to obtain the name a of the executor required to execute the scheduled task. Based on the cookies information and the name a of the executor, the executor list interface is called. The executor list interface uses fuzzy query to query and obtain a list of names of existing executors that are fuzzily related to the name a of the executor, that is, the executor list. Among them, fuzzy query is different from precise query. It can only query executors with the same or similar names as the input executor name, for example, executors with names a, a11, ba, and A2. This query method can greatly improve the query speed and reduce the pressure on the backend. After obtaining the executor list, it is determined whether there is an executor named a in the executor list, so as to know whether the executor named a that needs to be used already exists. If it does not exist, create an executor named a. If it already exists, the relevant information of the executor can be updated.

[0058] In S120, if it is found through query that the executor required to execute the scheduled task already exists, the relevant information of the executor is updated to ensure the accuracy of the information and facilitate subsequent search. Specifically, the process of updating the information of the executor may include: updating the name of the executor according to the executor information in the configuration file. The configuration file may include the name, deployment location, validity period, etc. of the executor, and the information of each executor in the backend is kept consistent with the relevant information of the executor in the configuration file through the update.

[0059] S130, for the executor, obtain a method having both a first annotation and a second annotation, loop through the scheduled tasks corresponding to the method, and check whether each traversed scheduled task exists; wherein the first annotation is used to describe task-related information, and the second annotation is used to describe task automatic registration information;

[0060] It can be seen that since each executor is responsible for executing one or more scheduled tasks, before the executor executes the scheduled tasks, it is necessary to determine whether the scheduled tasks that the executor needs to execute exist. The methods corresponding to the scheduled tasks that the executor needs to execute should have both the first annotation and the second annotation. Therefore, in S130, the method with both the first annotation and the second annotation is obtained, and then it is determined whether the scheduled task corresponding to the method exists.

[0061] In one embodiment, the method for obtaining the first annotation and the second annotation in S130 may include S131 to S133:

[0062] S131, filter out each method having the second annotation, and store each method obtained by the filter and the scheduled task corresponding to the method as a mapping data in the first mapping table;

[0063] S132, traversing the first mapping table, and checking whether a method in each traversed mapping data has the first annotation;

[0064] S133. Treat the method that is checked and determined to have the first annotation as a method that has both the first annotation and the second annotation.

[0065] It can be seen that the methods with the second annotation are first filtered out. Specifically, the MethodIntrospector.selectMethods method can be used to filter out all methods with the second annotation @XxlJob, and then stored in and stored in Map<Method,XxlJob> The first mapping table filterMap of the type. Method is a method, and XxlJob is a scheduled task. Then, the methods in the first mapping table filterMap are traversed to see if they have the first annotation, and the methods in the first mapping table filterMap with the first annotation are regarded as methods with both the first annotation and the second annotation.

[0066] Among them, XxlJob in the first mapping table filterMap is only the name of the scheduled task, and does not mean that the scheduled task really exists, so it needs to be further confirmed in subsequent steps.

[0067] In one embodiment, before looping through the scheduled tasks corresponding to the method, the method may further include the following two steps 1 and 2:

[0068] 1. When the business management system is started, monitor the initialization completion event through the application monitoring interface;

[0069] It can be seen that when the business management system is started, you can use ApplicationListener <applicationreadyevent>The interface monitors whether the initialization completion event of the business management system is completed.

[0070] 2. After monitoring the initialization completion event, obtain the context object in the backend framework through the application context acquisition interface, and obtain each scheduled task corresponding to the method with the first annotation and the second annotation through the context object.

[0071] It can be seen that once the initialization completion event is monitored, it means that the business management system has been started. Then, the ApplicationContext object of the backend Spring framework, i.e., the context object, can be obtained through the setApplicationContext method of the ApplicationContextAware interface, and the scheduled task corresponding to the method can be obtained through the context object.

[0072] ApplicationContextAware is an interface that identifies a class that wants to be notified of the Spring application context. Classes that implement this interface will automatically receive the ApplicationContext object after being initialized by the Spring container.

[0073] After obtaining a method having both the first annotation and the second annotation, a scheduled task corresponding to the method is obtained, and then it is determined by traversal whether the corresponding scheduled task has been created.

[0074] S140. If it does not exist, then add a scheduled task; if it does exist, then update the scheduled task information according to the first annotation.

[0075] It can be seen that if it already exists, there is no need to create it again, just update the relevant information. If it does not exist, it needs to be created, that is, add a new scheduled task.

[0076] In one embodiment, updating the scheduled task information according to the first annotation may include: updating the execution time of the scheduled task according to the task execution time in the task related information in the first annotation.

[0077] It can be seen that the execution time of the scheduled task can be updated to ensure the consistency of the execution time and ensure that the scheduled task is executed as expected.

[0078] In the embodiment of the present invention, after the business management system is started, it automatically initiates a request to the XXL-JOB service to detect the existence status of the executor and related scheduled tasks defined in the configuration file. If it is found that an executor or task has not been registered in the XXL-JOB service, it will automatically add a new operation; if it already exists, it will update the operation, thereby achieving the purpose of automatic configuration. The above process covers multiple functions such as executor query, executor addition, task query, and task addition.

[0079] It can be seen that in the embodiment of the present invention, automatic user login, creation or update of executors, and creation or update of scheduled tasks can be realized without manual operation by the user, which can significantly improve the efficiency and flexibility of task management. Since no manual intervention is required, omissions can be avoided and human errors can be reduced, that is, the risk of failures that may be caused by manual operations can be reduced. Moreover, by adjusting the relevant parameters in the first annotation and configuration file, the parameter adjustment of the scheduled task can be achieved, which is simple, convenient, easy to maintain, and conducive to optimizing the accuracy and response speed of task scheduling. In short, the embodiment of the present invention makes the management of scheduled tasks more efficient, stable and easy to maintain.

[0080] In a second aspect, an embodiment of the present invention provides a timed task configuration device, see Figure 2 , the device 100 comprises:

[0081] The information acquisition module 110 is used to log in to the distributed scheduling service when the business management system is started, obtain the cookies information during the login, and save the cookies information in the cache;

[0082] The first judgment module 120 is used to judge whether a pre-configured executor exists according to the cookies information in the cache; if not, add a new executor; if yes, update the information of the executor;

[0083] The second judgment module 130 is used to obtain a method having both a first annotation and a second annotation for the executor, loop through the scheduled tasks corresponding to the method, and check whether each traversed scheduled task exists; wherein the first annotation is used to describe task related information, and the second annotation is used to describe task automatic registration information;

[0084] The task processing module 140 is used to add a scheduled task if it does not exist; if it exists, update the information of the scheduled task according to the first annotation.

[0085] In one embodiment, the device may further include:

[0086] A file configuration module is used to pre-configure login-related information of the distributed scheduling service in a configuration file; wherein the login-related information includes the server address, user name, password and executor information of the distributed scheduling service; correspondingly, the login to the distributed scheduling service in the information acquisition module includes: logging in to the distributed scheduling service according to the login-related information.

[0087] In one embodiment, the first judgment module is specifically used to: determine the name of the executor that executes the scheduled task according to the scheduled task corresponding to the task-related information in the first annotation; call the executor list interface according to the cookies information and the name of the executor to obtain the executor list formed by each executor associated with the name obtained by fuzzy query through the executor list interface; and determine whether there is an executor with the name in the executor list to determine whether the executor exists.

[0088] In one embodiment, the second judgment module is specifically used to: filter out each method having the second annotation, and store each filtered method and the scheduled task corresponding to the method as a mapping data in the first mapping table; traverse the first mapping table to check whether the method in each traversed mapping data has the first annotation; and treat the method that is determined to have the first annotation after inspection as a method having both the first annotation and the second annotation.

[0089] In one embodiment, before acquiring the method having both the first annotation and the second annotation, the second judgment module is further used to: create a customized first annotation, and mark the first annotation in the method marked as a scheduled task and having the second annotation.

[0090] In one embodiment, before looping through the scheduled tasks corresponding to the method, the second judgment module is also used to: when the business management system is started, listen to the initialization completion event through the application listening interface; after listening to the initialization completion event, obtain the context object in the backend framework through the application context acquisition interface, and obtain each scheduled task corresponding to the method with the first annotation and the second annotation through the context object.

[0091] In one embodiment, the updating of information of the scheduled task according to the first annotation in the first judgment module includes: updating the execution time of the scheduled task according to the task execution time in the task-related information in the first annotation; and / or, the updating of information of the executor in the task processing module includes: updating the information of the executor according to the executor information in the configuration file.

[0092] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0093] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0094] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.

[0095] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0096] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0097] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0098] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0099] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0100] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.

[0101] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0102] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0103] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0104] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.< / applicationreadyevent>

Claims

1. A method for configuring a scheduled task, characterized in that: include: When the business management system is started, log in to the distributed scheduling service, obtain the cookies information during login, and save the cookies information in the cache; According to the cookies information in the cache, determine whether the pre-configured executor exists; if not, add a new executor; if it exists, update the information of the executor; For the executor, obtain a method having both a first annotation and a second annotation, loop through the scheduled tasks corresponding to the method, and check whether each traversed scheduled task exists; wherein the first annotation is used to describe task-related information, and the second annotation is used to describe task automatic registration information; If it does not exist, a new scheduled task is created; if it exists, the information of the scheduled task is updated according to the first annotation.

2. The method according to claim 1, characterized in that: Also includes: Pre-configure the distributed scheduling service login related information in the configuration file; wherein the login related information includes the server address, user name, password and executor information of the distributed scheduling service; Correspondingly, the logging into the distributed scheduling service includes: logging into the distributed scheduling service according to the login related information.

3. The method according to claim 1, characterized in that The determining, according to the cookies information in the cache, whether a pre-configured executor exists includes: Determine the name of the executor that executes the scheduled task according to the scheduled task corresponding to the task related information in the first annotation; According to the cookies information and the name of the executor, the executor list interface is called to obtain an executor list formed by each executor associated with the name obtained by the executor list interface through fuzzy query; It is determined whether there is an executor with the name in the executor list, so as to determine whether the executor exists.

4. The method according to claim 1, characterized in that: The method for obtaining a first annotation and a second annotation at the same time includes: Filter out each method having the second annotation, and store each filtered method and the scheduled task corresponding to the method as a mapping data in the first mapping table; Traversing the first mapping table, and checking whether a method in each traversed mapping data has the first annotation; The method determined to have the first annotation after inspection is regarded as a method having both the first annotation and the second annotation.

5. The method according to claim 1, characterized in that Before obtaining the method having both the first annotation and the second annotation, the method further includes: A customized first annotation is created, and the first annotation is marked in a method marked as a scheduled task and having the second annotation.

6. The method according to claim 1, characterized in that Before looping through the scheduled tasks corresponding to the method, the method further includes: When the business management system is started, monitoring the initialization completion event through the application monitoring interface; After monitoring the initialization completion event, the context object in the backend framework is obtained through the application context acquisition interface, and each scheduled task corresponding to the method with the first annotation and the second annotation is obtained through the context object.

7. The method according to claim 2, characterized in that: The updating of information of the scheduled task according to the first annotation includes: updating the execution time of the scheduled task according to the task execution time in the task related information in the first annotation; And / or, the updating the information of the executor includes: updating the information of the executor according to the executor information in the configuration file.

8. A timed task configuration device, characterized in that: include: An information acquisition module is used to log in to the distributed scheduling service when the business management system is started, obtain the cookies information during the login, and save the cookies information in the cache; A first judgment module is used to judge whether a pre-configured executor exists according to the cookies information in the cache; if not, a new executor is added; if it exists, information of the executor is updated; A second judgment module is used to obtain a method having both a first annotation and a second annotation for the executor, loop through the scheduled tasks corresponding to the method, and check whether each traversed scheduled task exists; wherein the first annotation is used to describe task related information, and the second annotation is used to describe task automatic registration information; The task processing module is used to add a scheduled task if it does not exist; if it exists, update the information of the scheduled task according to the first annotation.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

10. A computing device, characterized in that: The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.