Timer implementation method and related products

By integrating system timers with Java Servlets projects and using Redis databases or curl plugins to create scheduled tasks, the compatibility and security issues of scheduled tasks in Java Servlets projects are resolved, enabling low-cost execution of scheduled tasks.

CN114968529BActive Publication Date: 2026-07-03SHENZHEN XISHIMA DATA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN XISHIMA DATA TECH CO LTD
Filing Date
2022-05-30
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In existing Java Servlet projects, scheduled tasks are not compatible and require significant modification work, resulting in poor compatibility and memory and thread safety issues.

Method used

By obtaining the task content and execution time through the host system timer, and combining it with the Java Servlet project, a scheduled task can be created using a Redis database or curl plugin, avoiding the need to integrate a timer framework. The system timer is used to execute the scheduled task and generate task instructions.

Benefits of technology

Without integrating a timing framework, this method ensures memory and thread safety and enables low-cost execution of scheduled tasks in Java Servlets projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968529B_ABST
    Figure CN114968529B_ABST
Patent Text Reader

Abstract

This application relates to the field of timer implementation technology, specifically disclosing a timer implementation method and related products. The method includes: obtaining the task content of a task selected by the user from a preset task library through the host's system timer; obtaining the execution time and execution cycle of the task input by the user through a JAVA SERVLET project maintained by the host; establishing a scheduled task through the system timer based on the task content, the task execution time, and the task execution cycle, wherein the scheduled task is created by the system timer by calling the cmd command via Java; executing the scheduled task through the system timer to obtain the task instruction; obtaining the task instruction through the JAVA SERVLET project, and determining the target business corresponding to the task instruction based on the task instruction and the preset task library; and executing the function corresponding to the target business through the JAVA SERVLET project.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of timer implementation technology, and specifically discloses a timer implementation method and related products. Background Technology

[0002] Currently, to implement timer tasks, the common approach is to use the built-in timer task or a timer task framework. Alternatively, a thread can be started, which sleeps for the specified time and then resumes the timer task upon completion. However, these two methods are not suitable for Java Servlets projects, and the modification work is quite extensive, with compatibility issues being difficult to manage. Summary of the Invention

[0003] To address the aforementioned problems in the existing technology, this application provides a timer implementation method and related products, which can effectively achieve the goal of enabling JAVA SERVLET projects to complete the execution of timed tasks at low cost, without integrating or modifying a timer framework, while ensuring memory safety and thread safety.

[0004] In a first aspect, embodiments of this application provide a method for implementing a timer, including:

[0005] The system timer on the host computer retrieves the task content of the task selected by the user from the preset task library.

[0006] Obtain the execution time and cycle of the task input by the user through the JAVA SERVLET project maintained by the host;

[0007] Using the system timer, scheduled tasks are created based on the task content, task execution time, and task execution cycle. These scheduled tasks are created by the system timer through Java calling cmd commands.

[0008] The system timer executes a scheduled task, and the task instruction is obtained.

[0009] Obtain task instructions through the JAVA SERVLET project, and determine the target business corresponding to the task instructions based on the task instructions and the preset task library;

[0010] The Java Servlet project executes the functions corresponding to the target business logic.

[0011] Secondly, embodiments of this application provide a timer implementation apparatus, comprising:

[0012] The acquisition unit is used to acquire the task content of the task selected by the user in the preset task library through the system timer of the host.

[0013] The acquisition unit is also used to acquire the execution time and execution cycle of the task input by the user through the JAVA SERVLET project maintained by the host.

[0014] The processing unit is used to create scheduled tasks based on the task content, task execution time, and task execution cycle through the system timer. The scheduled tasks are created by the system timer by calling cmd commands via Java.

[0015] The processing unit is also used to execute timed tasks through the system timer and obtain task instructions;

[0016] The acquisition unit is also used to acquire task instructions through the JAVA SERVLET project, and determine the target business corresponding to the task instructions based on the task instructions and the preset task library;

[0017] The processing unit is also used to execute the functions corresponding to the target business through the JAVA SERVLET project.

[0018] Thirdly, embodiments of this application provide an electronic device, including: a processor connected to a memory for storing a computer program, and the processor for executing the computer program stored in the memory to cause the electronic device to perform the method as described in the first aspect.

[0019] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that causes a computer to perform the method as described in the first aspect.

[0020] Fifthly, embodiments of this application provide a computer program product, the computer program product including a non-transitory computer-readable storage medium storing a computer program, and a computer operable to perform the method as described in the first aspect.

[0021] Implementing the embodiments of this application has the following beneficial effects:

[0022] As can be seen in this embodiment, firstly, the system timer on the host obtains the task content of the task selected by the user in the preset task library, and the execution time and execution cycle of the task input by the user are obtained through the JAVA SERVLET project maintained by the host. Then, the system timer establishes a scheduled task based on the task content, execution time, and execution cycle. This scheduled task is created by the system timer through Java calling the cmd command. The system timer on the host is used, eliminating the need to integrate a new timer framework. Next, the scheduled task is executed through the system timer to obtain the task instruction. The host then obtains the task instruction through the JAVA SERVLET project and determines the target business corresponding to the task instruction based on the task instruction and the preset task library. The JAVA SERVLET project is connected to the system timer to obtain the task instruction. Finally, the host executes the function corresponding to the target business through the JAVA SERVLET project.

[0023] It can effectively achieve the goal of enabling Java Servlet projects to execute scheduled tasks at low cost, without integrating or modifying a scheduling framework, while ensuring memory safety and thread safety. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0025] Figure 1 A system framework diagram of a timer implementation method provided for embodiments of this application;

[0026] Figure 2 A flowchart illustrating a timer implementation method provided in this application embodiment;

[0027] Figure 3A An internal interaction diagram of a timer-based device, taking an integrated Redis database as an example, provided for implementation of this application;

[0028] Figure 3B An internal interaction diagram of a device implemented using a timer, taking the installation of a curl plugin as an example, is provided for the implementation of this application.

[0029] Figure 4 A hardware structure diagram of a timer implementation device provided for an embodiment of this application;

[0030] Figure 5A functional module block diagram of a timer implementation device provided for embodiments of this application;

[0031] Figure 6 This is a schematic diagram of the structure of an electronic device provided for an embodiment of this application. Detailed Implementation

[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0033] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0034] In this document, the term "implementation" means that a specific feature, result, or characteristic described in connection with an implementation may be included in at least one implementation of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same implementation, nor is it a separate or alternative implementation mutually exclusive with other implementations. It will be explicitly and implicitly understood by those skilled in the art that the implementations described herein can be combined with other implementations.

[0035] First, refer to Figure 1 , Figure 1 A system framework diagram of a timer implementation method provided for an embodiment of this application includes: a user terminal 100, a timer implementation device 101, and a preset task library 102.

[0036] Specifically, firstly, the user selects the task content from the preset task library 102 through the user terminal 100, and inputs the task execution time and execution cycle into the timer implementation device 101 through the user terminal 100. Then, the system timer in the timer implementation device 101 establishes a timed task based on the task content, execution time, and execution cycle. Next, the timer implementation device 101 executes the timed task through the system timer, obtains the task instruction, and sends the obtained task instruction to the JAVA SERVLET project in the timer implementation device 101. Then, the JAVA SERVLET project in the timer implementation device 101 obtains the task instruction and determines the target business corresponding to the task instruction based on the task instruction and the preset task library 102. Finally, the JAVA SERVLET project in the timer implementation device 101 executes the function corresponding to the target business.

[0037] This method can effectively achieve the goal of enabling Java Servlet projects to execute scheduled tasks at low cost, without integrating or modifying a scheduling framework, while ensuring memory safety and thread safety.

[0038] See Figure 2 , Figure 2 This is a flowchart illustrating a timer implementation method provided in an embodiment of this application. The method is applied to a host computer and includes the following steps:

[0039] 201: Obtain the task content of the task selected by the user in the preset task library through the host's system timer.

[0040] Before the system timer retrieves the task content selected by the user from the preset task library, implementing timer functionality in the original JavaServlet project requires significant modification, which is labor-intensive and has poor compatibility. Therefore, to implement timer functionality more easily and securely, the host's built-in system timer is integrated with the JavaServlet project. However, to achieve timer functionality between the system timer and the JavaServlet project, they need to be linked. This middleware can be either an integrated Redis database on the JavaServlet project or a curl plugin installed on the Redis database, but is not limited to these two methods. The function of this middleware is to link the system timer and the JavaServlet project. When the system timer executes a scheduled task, it sends task instructions to the JavaServlet project through the middleware, informing the JavaServlet project which scheduled task to execute and subsequent operations. Therefore, both the Redis database and the curl plugin are just ways to inform the JavaServlet project which scheduled task to execute.

[0041] For example, when the middleware is a Redis database, before the system timer retrieves the task content selected by the user from the preset task library, the Redis database is integrated into the Java Servlet project and started. The Java Servlet project creates a listener for the Redis queue in the Redis database. When a task instruction is detected in the Redis queue, the Java Servlet project executes the task according to the instruction. By utilizing Redis's publish-subscribe functionality, task instructions are sent to the Redis queue, and the system listens for task instructions in the Redis queue to perform subsequent operations.

[0042] For example, when the middleware is the curl plugin, the curl plugin is installed on the Java Servlet project before the system timer obtains the task content of the task selected by the user in the preset task library. The curl plugin is equivalent to a request; when it receives a task instruction, it informs the Java Servlet project which scheduled task should be executed.

[0043] After linking the system timer with the Java Servlet project through middleware, the process of implementing the scheduled task can begin.

[0044] Specifically, the user first selects the task content they want to perform on a schedule from the preset task library. The host machine integrates a Java Servlet project, and the preset task library maintained by the Java Servlet project contains a series of tasks that the Java Servlet project can perform. Therefore, the user selects the desired task content from the preset task library and sends it to the system timer.

[0045] 202: Obtain the execution time and execution cycle of the task input by the user through the JAVA SERVLET project maintained by the host.

[0046] Specifically, after selecting the desired task content from the preset task library, the user inputs the desired execution time and execution cycle into the JAVASEVLET project, which facilitates the subsequent creation of scheduled tasks.

[0047] 203: Create scheduled tasks using system timers, based on task content, task execution time, and task execution cycle.

[0048] For example, scheduled tasks are created by the system timer through Java calling cmd commands. Integrating a timer framework into a Java Servlet project or implementing timer tasks by starting a thread can present problems. Integrating a timer framework is time-consuming and laborious, easily leading to a bloated project, potentially incompatible with older projects, hindering the modification of legacy projects, and incompatible with pure Java Servlet. Starting a thread to implement timer functionality can easily cause thread errors, freezes, and memory overflows, and troubleshooting is tedious. Therefore, combining the system timer with a Java Servlet project avoids these problems, and using the system's built-in timer saves costs. The system timer can create scheduled tasks based on the task content selected by the user from a preset task library and the input task execution time and cycle. For example, when integrating a Redis database into a JavaServlet project, if a user wants to implement a scheduled task to perform a calculation of 1024*1024 at 12:00, the system timer can create a scheduled task by calling the cmd command in Java, based on the task content, execution time, and execution cycle. The cmd command is as follows: at 12:00PUBLISHTaskScheduled"calc1024".

[0049] 204: The system timer executes a scheduled task and receives the task instruction.

[0050] Specifically, after creating a scheduled task, the system timer determines the execution time of each scheduled task based on the task's execution time and execution cycle. Specifically, the system timer determines the start and end times of the first execution of the scheduled task based on the task's execution time and execution cycle. Then, the system timer determines the execution time of each subsequent execution of the scheduled task based on the start and end times of the first execution and the task's execution cycle. The system timer then executes the scheduled task at each execution time. For example, if task 1's execution time is 12:00 and its execution cycle is once every 24 hours, then the first execution start time of task 1 can be determined to be 12:00, and the end time can be determined to be 12:00 the following day. Based on the execution cycle, the execution time of this scheduled task can be determined to be 12:00 every day. At 12:00 every day, the system timer executes task 1.

[0051] For example, when a Java Servlet project integrates with a Redis database, the system timer executes a scheduled task, generating the corresponding task instruction. Then, the system timer publishes the task instruction to the Redis queue. The Java Servlet project then receives the task instruction by listening to the Redis queue. For instance, if the user wants to implement a scheduled task to perform a calculation of 1024*1024 at 12:00, based on the task content, execution time, and execution cycle, the system timer can create a scheduled task by calling a command prompt (cmd) from Java. The cmd command would be: `at 12:00PUBLISH TaskScheduled "calc1024"`. At 12:00, the system timer executes the scheduled task, generating the task instruction "calc1024", and publishes it to the Redis queue. The Java Servlet project receives the task instruction "calc1024" by listening to the Redis queue.

[0052] For example, install the curl plugin on a Java Servlet project. After executing a scheduled task, the system timer generates a corresponding task instruction and sends it to the Java Servlet project through the curl plugin's interface. At this point, the system timer sends a request to the Java Servlet project through the curl plugin's interface; this request is the task instruction. The Java Servlet project then implements the task according to the task instruction. For instance, if the user wants to execute a 1024*1024 calculation at 12:00, based on the task content, execution time, and execution cycle, the system timer can create a scheduled task by calling a cmd command from Java. The cmd command is as follows: `at 12:00 curl -X GET "http: / / localhost:5001 / api / carryOut?taskName=calc1024"`. At 12:00, the system timer executes a scheduled task, generating the task instruction "calc1024". The system timer sends the task instruction "calc1024" to the JAVA SERVLET project through the curl plugin interface, requesting the JAVA SERVLET project to implement the task subsequently.

[0053] 205: Obtain task instructions through the JAVA SERVLET project, and determine the target business corresponding to the task instructions based on the task instructions and the preset task library.

[0054] Specifically, after receiving the task instruction sent by the system timer, the Java Servlet project matches the task instruction with multiple task instructions in the preset task library. When a matching task instruction is found, the target service corresponding to the task instruction is determined. As shown in Table 1, the matching status of task instructions and services in the preset task library is as follows.

[0055] Table 1:

[0056]

[0057] 206: Execute the functions corresponding to the target business through the JAVA SERVLET project.

[0058] Specifically, after receiving a task instruction, the Java Servlet project matches it with a preset task library to obtain the corresponding business logic and its associated functionality. The business logic and functionality corresponding to the task instructions in the preset task library are all functions that the Java Servlet project can implement. As shown in Table 1, business logic and functionality are matched. After determining the target business logic, the Java Servlet project directly implements the corresponding functionality, thus completing the timer function of the Java Servlet project.

[0059] Overall, such as Figure 3A As shown, Figure 3A This document provides an internal interaction diagram of a timer-based device, exemplified by an integrated Redis database, as an embodiment of this application. Figure 3B As shown, Figure 3B This application provides an internal interaction diagram of a timer implementation device, using the installation of the curl plugin as an example. Before implementing the timer function in a Java Servlet project, the Java Servlet project is first integrated with a Redis database or the Curl plugin is installed, linking the system timer with the Java Servlet project. After the user selects the scheduled task to be implemented and inputs the execution time and cycle, the system timer creates the scheduled task. This scheduled task sends a task instruction to the Java Servlet project at the time input by the user to implement the user-selected task. Essentially, the system timer sends a task instruction to the Java Servlet project at a specific time, reminding the Java Servlet project to implement the user-selected task. This system timer is similar to an alarm clock or reminder, prompting the Java Servlet project to complete a specific task at the user-selected time. After receiving the task instruction, the Java Servlet project determines the target business and its corresponding function based on the task instruction and a preset task library. Finally, the Java Servlet project implements this function, thus completing the timer function of the Java Servlet project. This means using a system timer to prompt a Java Servlet project to perform a specific task at a specific time.

[0060] It can be seen that the following advantages are available in the embodiments of this application:

[0061] Before implementing the timer functionality in a Java Servlet project, the Java Servlet project needs to be integrated with a Redis database or have a curl plugin installed to link the system timer with the Java Servlet project. After the user selects the scheduled task and inputs the execution time and cycle, the system timer creates the scheduled task. This task sends a task instruction to the Java Servlet project at the user-input time to execute the selected task. Essentially, the system timer reminds the Java Servlet project to perform the user-selected task at a specific time. This system timer acts like an alarm clock or reminder, prompting the Java Servlet project to complete the specific task at the user-selected time. After receiving the task instruction, the Java Servlet project determines the target business and its corresponding function based on the instruction and a preset task library. Finally, the Java Servlet project implements this function, thus completing the timer functionality of the Java Servlet project.

[0062] It can effectively achieve the goal of enabling Java Servlet projects to execute scheduled tasks at low cost, without integrating or modifying a scheduling framework, while ensuring memory safety and thread safety.

[0063] See Figure 4 , Figure 4 This is a schematic diagram of the hardware structure of a timer implementation device provided in an embodiment of this application. The timer implementation device 400 includes at least one processor 401, a communication line 402, a memory 403, and at least one communication interface 404.

[0064] In this embodiment, the processor 401 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present application.

[0065] Communication line 402 may include a path for transmitting information between the aforementioned components.

[0066] Communication interface 404 can be any transceiver-like device (such as an antenna) used to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN), etc.

[0067] The memory 403 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.

[0068] In this embodiment, the memory 403 can exist independently and be connected to the processor 401 via the communication line 402. Alternatively, the memory 403 can be integrated with the processor 401. The memory 403 provided in this embodiment is typically non-volatile. The memory 403 stores computer execution instructions for implementing the scheme of this application, and its execution is controlled by the processor 401. The processor 401 executes the computer execution instructions stored in the memory 403 to implement the method provided in the following embodiments of this application.

[0069] In an optional implementation, the computer execution instructions may also be referred to as application code, and this application does not specifically limit this.

[0070] In an alternative implementation, processor 401 may include one or more CPUs, for example... Figure 4 CPU0 and CPU1 in the CPU.

[0071] In an optional implementation, the timer implementation device 400 may include multiple processors, such as... Figure 4 Processors 401 and 407 are described herein. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).

[0072] In optional embodiments, if a timer implementation device 400 is a server, for example, it can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, then the timer implementation device 400 under JAVA SERVLET may further include an output device 405 and an input device 406. The output device 405 communicates with the processor 401 and can display information in various ways. For example, the output device 405 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device 406 communicates with the processor 401 and can receive user input in various ways. For example, the input device 406 can be a mouse, keyboard, touch screen device, or sensor device, etc.

[0073] The timer implementation device 400 described above can be a general-purpose device or a special-purpose device. The embodiments of this application do not limit the type of the timer implementation device 400.

[0074] See Figure 5 , Figure 5 This is a functional module block diagram of a timer implementation device 500 provided for an embodiment of this application. For example... Figure 5 As shown, the timer implementation device 500 includes:

[0075] The acquisition unit 501 is used to acquire the task content of the task selected by the user in the preset task library through the system timer of the host.

[0076] The acquisition unit 501 is also used to acquire the execution time and execution cycle of the task input by the user through the JAVA SERVLET project maintained by the host.

[0077] Processing unit 502 is used to create a timed task by means of a system timer, based on the task content, the task execution time and the task execution cycle. The timed task is created by the system timer by calling the cmd command through Java.

[0078] Processing unit 502 is also used to execute timed tasks through the system timer and obtain task instructions;

[0079] The acquisition unit 501 is also used to acquire task instructions through the JAVA SERVLET project, and determine the target business corresponding to the task instructions based on the task instructions and the preset task library.

[0080] The processing unit 502 is also used to execute the functions corresponding to the target business through the JAVA SERVLET project.

[0081] In an embodiment of the present invention, before obtaining the task content of the task selected by the user in the preset task library through the system timer of the host, the processing unit 502 is specifically used for:

[0082] Integrate the Redis database into a Java Servlet project and start the Redis database;

[0083] Create a listener for Redis queues in a Redis database using a Java Servlet project;

[0084] In an embodiment of the present invention, in obtaining task instructions by executing a timed task through a system timer, the processing unit 502 is specifically configured to:

[0085] Execute scheduled tasks using the system timer and generate corresponding task instructions for the scheduled tasks.

[0086] Publish task instructions to the Redis queue via system timers;

[0087] Task instructions are obtained by listening to the Redis queue through the Java Servlet project.

[0088] In an embodiment of the present invention, before obtaining the task content of the task selected by the user in the preset task library through the system timer of the host, the processing unit 502 is specifically used for:

[0089] Install the curl plugin for your Java Servlet project.

[0090] In an embodiment of the present invention, in obtaining task instructions by executing a timed task through a system timer, the processing unit 502 is specifically configured to:

[0091] The system timer executes scheduled tasks, generates corresponding task instructions, and sends these instructions to the project via the curl plugin interface.

[0092] In an embodiment of the present invention, in determining the target service corresponding to a task instruction based on a task instruction and a preset task library, the processing unit 502 is specifically used for:

[0093] Using a Java Servlet project, the target instruction is determined based on the task instructions and multiple task instructions in the preset task library;

[0094] The business logic corresponding to the target instruction is defined as the target business logic through the JAVA SERVLET project.

[0095] In an embodiment of the present invention, the processing unit 502 is specifically configured to: execute a timed task via a system timer.

[0096] The system timer determines the execution time of each scheduled task based on the task's execution time and cycle.

[0097] The system timer executes the scheduled task at each execution time.

[0098] In an embodiment of the present invention, in determining the execution time of each scheduled task based on the task's execution time and execution cycle using a system timer, the processing unit 502 is specifically configured to:

[0099] The start and end times of the first execution of a scheduled task are determined by the system timer, based on the task's execution time and cycle.

[0100] The system timer determines the execution time of each scheduled task based on the start and end times of the first execution of the scheduled task and the task's execution cycle.

[0101] In an embodiment of the present invention, in terms of executing target business and realizing functions through a JAVA SERVLET project, the processing unit 502 is specifically used for:

[0102] Using a Java Servlet project, determine the functions corresponding to the target business based on a pre-defined task library;

[0103] The target business logic is executed and the functionality is achieved through a Java Servlet project.

[0104] See Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided for an embodiment of this application. For example... Figure 6 As shown, the electronic device 600 includes a transceiver 601, a processor 602, and a memory 603. These are connected via a bus 604. The memory 603 stores computer programs and data, and can transfer data stored in the memory 603 to the processor 602.

[0105] Processor 602 is used to read the computer program in memory 603 and perform the following operations:

[0106] The system timer on the host computer retrieves the task content of the task selected by the user from the preset task library.

[0107] Obtain the execution time and cycle of the task input by the user through the JAVA SERVLET project maintained by the host;

[0108] Using the system timer, scheduled tasks are created based on the task content, task execution time, and task execution cycle. These scheduled tasks are created by the system timer through Java calling cmd commands.

[0109] The system timer executes a scheduled task, and the task instruction is obtained.

[0110] Obtain task instructions through the JAVA SERVLET project, and determine the target business corresponding to the task instructions based on the task instructions and the preset task library;

[0111] The Java Servlet project executes the functions corresponding to the target business logic.

[0112] In an embodiment of the present invention, before obtaining the task content of the task selected by the user in the preset task library through the system timer of the host, the processor 602 is specifically used to perform the following operations:

[0113] Integrate the Redis database into a Java Servlet project and start the Redis database;

[0114] Create a listener for Redis queues in a Redis database using a Java Servlet project;

[0115] In an embodiment of the present invention, in order to obtain task instructions by executing a timed task through a system timer, the processor 602 is specifically configured to perform the following operations:

[0116] Execute scheduled tasks using the system timer and generate corresponding task instructions for the scheduled tasks.

[0117] Publish task instructions to the Redis queue via system timers;

[0118] Task instructions are obtained by listening to the Redis queue through the Java Servlet project.

[0119] In an embodiment of the present invention, before obtaining the task content of the task selected by the user in the preset task library through the system timer of the host, the processor 602 is specifically used to perform the following operations:

[0120] Install the curl plugin for your Java Servlet project.

[0121] In an embodiment of the present invention, in order to obtain task instructions by executing a timed task through a system timer, the processor 602 is specifically configured to perform the following operations:

[0122] The system timer executes scheduled tasks, generates corresponding task instructions, and sends these instructions to the project via the curl plugin interface.

[0123] In an embodiment of the present invention, in determining the target service corresponding to a task instruction based on a task instruction and a preset task library, the processor 602 is specifically configured to perform the following operations:

[0124] Using a Java Servlet project, the target instruction is determined based on the task instructions and multiple task instructions in the preset task library;

[0125] The business logic corresponding to the target instruction is defined as the target business logic through the JAVA SERVLET project.

[0126] In an embodiment of the present invention, in executing a timed task via a system timer, the processor 602 is specifically configured to perform the following operations:

[0127] The system timer determines the execution time of each scheduled task based on the task's execution time and cycle.

[0128] The system timer executes the scheduled task at each execution time.

[0129] In an embodiment of the present invention, in determining the execution time of each timed task based on the task's execution time and execution cycle using a system timer, the processor 602 is specifically configured to perform the following operations:

[0130] The start and end times of the first execution of a scheduled task are determined by the system timer, based on the task's execution time and cycle.

[0131] The system timer determines the execution time of each scheduled task based on the start and end times of the first execution of the scheduled task and the task's execution cycle.

[0132] In an embodiment of the present invention, in terms of executing the function corresponding to the target business through a JAVA SERVLET project, the processor 602 is specifically used to perform the following operations:

[0133] Using a Java Servlet project, determine the functions corresponding to the target business based on a pre-defined task library;

[0134] The target business logic is executed and the functionality is achieved through a Java Servlet project.

[0135] It should be understood that the timer implementation device in this application may include smartphones (such as Android phones, iOS phones, Windows Phones, etc.), tablet computers, PDAs, laptops, mobile internet devices (MIDs), robots, or wearable devices, etc. The above-described timer implementation devices are merely examples and not exhaustive, and include, but are not limited to, the timer implementation devices described above. In practical applications, the above-described timer implementation devices may also include: intelligent vehicle terminals, computer equipment, etc.

[0136] Through the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software combined with a hardware platform. Based on this understanding, all or part of the technical solution of the present invention that contributes to the background art can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of the embodiments of the present invention.

[0137] Therefore, embodiments of this application also provide a computer-readable storage medium storing a computer program that is executed by a processor to implement some or all of the steps of any of the video search and determination methods described in the above method embodiments. For example, the storage medium may include a hard disk, floppy disk, optical disk, magnetic tape, magnetic disk, USB flash drive, flash memory, etc.

[0138] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of a method implemented by any of the timers described in the above method embodiments.

[0139] It should be noted that, for the sake of simplicity, the aforementioned methods are described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are optional, and the actions and modules involved are not necessarily essential to this application.

[0140] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0141] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0143] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software program module.

[0144] If the integrated unit is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0145] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage device, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0146] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The above description of the embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for implementing a timer, characterized in that, Applied to a host, the method includes: Integrate the Redis database into the Java Servlet project and start the Redis database; create a listener for the Redis queue in the Redis database through the Java Servlet project; The system timer of the host computer is used to obtain the task content of the task selected by the user in the preset task library; The execution time and execution cycle of the task input by the user are obtained through the JAVA SERVLET project maintained by the host. The system timer creates a scheduled task based on the task content, the task execution time, and the task execution cycle. The scheduled task is created by the system timer through Java calling cmd commands. The timed task is executed through the system timer to obtain task instructions, including: The system timer executes the scheduled task, generating a corresponding task instruction; the system timer publishes the task instruction to the Redis queue; the Java Servlet project listens to the Redis queue to obtain the task instruction. The task instruction is obtained through the JAVA SERVLET project, and the target business corresponding to the task instruction is determined based on the task instruction and the preset task library. The target business function is executed through the Java Servlet project.

2. The method according to claim 1, characterized in that, The step of determining the target service corresponding to the task instruction based on the task instruction and the preset task library includes: Using the Java Servlet project, the target instruction is determined based on the task instruction and multiple task instructions in the preset task library; The business corresponding to the target instruction is taken as the target business through the JAVA SERVLET project.

3. The method according to claim 1, characterized in that, The execution of the timed task via the system timer includes: The system timer determines the execution time of each scheduled task based on the task's execution time and execution cycle. The timed task is executed at each execution time via the system timer.

4. The method according to claim 3, characterized in that, The step of determining the execution time of each scheduled task by using the system timer based on the task's execution time and execution cycle includes: The start and end times of the first execution of the timed task are determined by the system timer based on the task's execution time and execution cycle. The system timer determines the execution time of each scheduled task based on the start and end times of the first execution of the scheduled task and the execution cycle of the task.

5. The method according to claim 1, characterized in that, The execution of the function corresponding to the target business through the Java Servlet project includes: Using the Java Servlet project, the function corresponding to the target business is determined based on the preset task library; The target business logic is executed through the Java Servlet project to achieve the desired functionality.

6. A method for implementing a timer, characterized in that, Applied to a host, the method includes: Install the curl plugin for a Java Servlet project; The system timer of the host computer is used to obtain the task content of the task selected by the user in the preset task library; The execution time and execution cycle of the task input by the user are obtained through the JAVA SERVLET project maintained by the host. The system timer creates a scheduled task based on the task content, the task execution time, and the task execution cycle. The scheduled task is created by the system timer through Java calling cmd commands. The timed task is executed through the system timer to obtain task instructions, including: The system timer executes the scheduled task, generates a task instruction corresponding to the scheduled task, and sends the task instruction to the Java Servlet project through the curl plugin interface. The task instruction is obtained through the JAVA SERVLET project, and the target business corresponding to the task instruction is determined based on the task instruction and the preset task library. The target business function is executed through the Java Servlet project.

7. The method according to claim 6, characterized in that, The step of determining the target service corresponding to the task instruction based on the task instruction and the preset task library includes: Using the Java Servlet project, the target instruction is determined based on the task instruction and multiple task instructions in the preset task library; The business corresponding to the target instruction is taken as the target business through the JAVA SERVLET project.

8. The method according to claim 6, characterized in that, The execution of the timed task via the system timer includes: The system timer determines the execution time of each scheduled task based on the task's execution time and execution cycle. The timed task is executed at each execution time via the system timer.

9. The method according to claim 8, characterized in that, The step of determining the execution time of each scheduled task by using the system timer based on the task's execution time and execution cycle includes: The start and end times of the first execution of the timed task are determined by the system timer based on the task's execution time and execution cycle. The system timer determines the execution time of each scheduled task based on the start and end times of the first execution of the scheduled task and the execution cycle of the task.

10. The method according to claim 6, characterized in that, The execution of the function corresponding to the target business through the Java Servlet project includes: Using the Java Servlet project, the function corresponding to the target business is determined based on the preset task library; The target business logic is executed through the Java Servlet project to achieve the desired functionality.

11. A timer implementation device, characterized in that, include: Acquisition unit and processing unit; The processing unit is used to integrate a Redis database into a Java Servlet project and start the Redis database; and to create a listener for the Redis queue in the Redis database through the Java Servlet project. The acquisition unit is used to acquire the task content of the task selected by the user in the preset task library through the system timer of the host. The acquisition unit is also used to acquire the execution time and execution cycle of the task input by the user through the JAVA SERVLET project maintained by the host; The processing unit is configured to establish a scheduled task based on the task content, the task execution time, and the task execution cycle using the system timer, wherein the scheduled task is created by the system timer through Java calling the cmd command; The processing unit is also configured to execute the timed task via the system timer to obtain task instructions, specifically for: The system timer executes the scheduled task, generating a corresponding task instruction; the system timer publishes the task instruction to the Redis queue; the Java Servlet project listens to the Redis queue to obtain the task instruction. The acquisition unit is also configured to acquire the task instruction through the JAVA SERVLET project, and determine the target business corresponding to the task instruction based on the task instruction and the preset task library; The processing unit is also used to execute the function corresponding to the target business through the JAVA SERVLET project.

12. A timer implementation device, characterized in that, include: Acquisition unit and processing unit; A processing unit used to install the curl plugin for Java Servlet projects; The acquisition unit is used to acquire the task content of the task selected by the user in the preset task library through the system timer of the host. The acquisition unit is also used to acquire the execution time and execution cycle of the task input by the user through the JAVA SERVLET project maintained by the host; The processing unit is configured to establish a scheduled task based on the task content, the task execution time, and the task execution cycle using the system timer, wherein the scheduled task is created by the system timer through Java calling the cmd command; The processing unit is also configured to execute the timed task via the system timer to obtain task instructions, specifically for: The system timer executes the scheduled task, generates a task instruction corresponding to the scheduled task, and sends the task instruction to the Java Servlet project through the curl plugin interface. The acquisition unit is also configured to acquire the task instruction through the JAVA SERVLET project, and determine the target business corresponding to the task instruction based on the task instruction and the preset task library; The processing unit is also used to execute the function corresponding to the target business through the JAVA SERVLET project.

13. An electronic device, characterized in that, include: A processor and a memory, the processor being connected to the memory, the memory being used to store a computer program, and the processor being used to execute the computer program stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-10.

14. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program that is executed by a processor to implement the method as described in any one of claims 1-10.