CN114968529A - Timer implementation method and related product - Google Patents

Timer implementation method and related product Download PDF

Info

Publication number
CN114968529A
CN114968529A CN202210602947.4A CN202210602947A CN114968529A CN 114968529 A CN114968529 A CN 114968529A CN 202210602947 A CN202210602947 A CN 202210602947A CN 114968529 A CN114968529 A CN 114968529A
Authority
CN
China
Prior art keywords
task
system timer
instruction
project
timing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210602947.4A
Other languages
Chinese (zh)
Inventor
徐欢
叶振东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xishima Data Technology Co ltd
Original Assignee
Shenzhen Xishima Data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xishima Data Technology Co ltd filed Critical Shenzhen Xishima Data Technology Co ltd
Priority to CN202210602947.4A priority Critical patent/CN114968529A/en
Publication of CN114968529A publication Critical patent/CN114968529A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic

Landscapes

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

Abstract

The application relates to the technical field of timer implementation, and particularly discloses a timer implementation method and a related product, wherein the method comprises the following steps: acquiring task contents of tasks selected by a user in a preset task library through a system timer of a host; acquiring the execution time of a task input by a user and the execution period of the task through a JAVA SERVLET project maintained by a host; establishing a timing task through a system timer according to task content, task execution time and task execution period, wherein the timing task is created by calling a cmd command through java by the system timer; executing a timing task through a system timer to obtain a task instruction; acquiring a task instruction through a JAVA SERVLET project, and determining a target service corresponding to the task instruction according to the task instruction and a preset task library; and executing the function corresponding to the target service through the JAVA SERVLET project.

Description

Timer implementation method and related product
Technical Field
The invention relates to the technical field of timer implementation, and particularly discloses a timer implementation method and a related product.
Background
At present, to implement the task of the timer, a timing task or a timing task framework carried by the framework is generally adopted. A thread can also be started, the timing time is dormant, and then the timed task is started after dormancy is finished. However, for the JAVA SERVLET project, the above two approaches cannot be adapted, and relatively much modification is required, and the compatibility is not well controlled.
Disclosure of Invention
In order to solve the above problems in the prior art, embodiments of the present application provide a timer implementation method and a related product, which can effectively achieve the objective of enabling a JAVA SERVLET project to complete execution of a timing task at low cost on the premise of guaranteeing memory security and thread security without integrating a timing frame and modifying the frame.
In a first aspect, an embodiment of the present application provides a timer implemented method, including:
acquiring task contents of tasks selected by a user in a preset task library through a system timer of a host;
acquiring the execution time of a task input by a user and the execution period of the task through a JAVA SERVLET project maintained by a host;
establishing a timing task through a system timer according to task content, task execution time and task execution period, wherein the timing task is created by calling a cmd command through java by the system timer;
executing a timing task through a system timer to obtain a task instruction;
acquiring a task instruction through a JAVA SERVLET project, and determining a target service corresponding to the task instruction according to the task instruction and a preset task library;
and executing the function corresponding to the target service through the JAVA SERVLET project.
In a second aspect, an embodiment of the present application provides a timer implementing apparatus, including:
the system comprises an acquisition unit, a task library acquisition unit and a task processing unit, wherein the acquisition unit is used for acquiring task contents of tasks selected by a user in a preset task library through a system timer of a host;
the acquisition unit is also used for acquiring the execution time of the task input by the user and the execution cycle of the task through a JAVA SERVLET project maintained by the host;
the processing unit is used for establishing a timing task according to task content, task execution time and task execution period through a system timer, wherein the timing task is created by calling cmd commands through java by the system timer;
the processing unit is also used for executing a timing task through a system timer to obtain a task instruction;
the acquisition unit is also used for acquiring the task instruction through a JAVA SERVLET project and determining a target service corresponding to the task instruction according to the task instruction and a preset task library;
and the processing unit is also used for executing the function corresponding to the target service through the JAVA SERVLET item.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor coupled to the memory, the memory for storing a computer program, the processor for executing the computer program stored in the memory to cause the electronic device to perform the method of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, the computer program causing a computer to perform the method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program, the computer operable to cause the computer to perform a method according to the first aspect.
The implementation of the embodiment of the application has the following beneficial effects:
it can be seen that, in the embodiment of the present application, first, the task content of the task selected by the user in the preset task library is obtained through the system timer of the host, and the execution time of the task and the execution cycle of the task input by the user are obtained through the JAVA SERVLET item maintained by the host. And then, establishing a timing task through a system timer according to the task content, the execution time of the task and the execution period of the task, wherein the timing task is created by calling a cmd command through java by the system timer. The system timer carried by the host is utilized, and a new timer frame is not required to be integrated. And then, executing the timing task through a system timer to obtain a task instruction. And the host acquires the task instruction through the JAVA SERVLET project and determines a target service corresponding to the task instruction according to the task instruction and a preset task library. And connecting the JAVA SERVLET item with a system timer to acquire a task instruction. And finally, the host executes the function corresponding to the target service through the JAVA SERVLET project.
The method can effectively achieve the aim of enabling the JAVA SERVLET project to finish the execution of the timing task at low cost on the premise of ensuring the memory safety and thread safety on the basis of not integrating a timing frame and modifying the frame.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a system framework diagram of a method implemented by a timer according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for implementing a timer according to an embodiment of the present disclosure;
fig. 3A is an internal interaction diagram of an apparatus implemented by a timer, taking an integrated redis database as an example, according to an embodiment of the present application;
fig. 3B is an internal interaction diagram of an apparatus implemented by a timer, for example, by installing a curl plug-in, according to an embodiment of the present application;
fig. 4 is a schematic hardware structure diagram of a timer implementation apparatus according to an embodiment of the present disclosure;
fig. 5 is a block diagram illustrating functional modules of a timer implementation apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art without any inventive work based on the embodiments in the present application are within the scope of protection of the present application.
The terms "first," "second," "third," and "fourth," etc. in the description and claims of this application and the accompanying drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, result, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by a person skilled in the art that the embodiments described herein can be combined with other embodiments.
First, referring to fig. 1, fig. 1 is a system framework diagram of a method for implementing a timer according to an embodiment of the present application, including: the system comprises a user terminal 100, a timer implementation device 101 and a preset task library 102.
Specifically, first, a user selects task content of a task from a preset task library 102 through a user terminal 100, and the user inputs an execution time of the task and an execution period of the task into a timer implementation device 101 at the user terminal 100. Then, a system timer in the device 101 is realized by a timer, and a timed task is established according to the task content, the execution time of the task, and the execution cycle of the task. Then, the timer implementing device 101 executes the timing task by using the system timer to obtain a task instruction, and sends the obtained task instruction to the JAVA SERVLET item in the timer implementing device 101. Then, the timer realizes that the JAVA SERVLET project in the device 101 acquires the task instruction, and determines the target service corresponding to the task instruction according to the task instruction and the preset task library 102. Finally, the function corresponding to the target service executed by the JAVA SERVLET entry in the device 101 is realized through the timer.
The method can effectively achieve the aim of enabling the JAVA SERVLET project to finish the execution of the timing task at low cost on the premise of ensuring the memory safety and thread safety on the basis of not integrating a timing frame and modifying the frame.
Referring to fig. 2, fig. 2 is a schematic flowchart of a method for implementing a timer according to an embodiment of the present disclosure. The method is applied to the host, and the method realized by the timer comprises the following steps:
201: and acquiring the task content of the task selected by the user in the preset task library through a system timer of the host.
Before the system timer acquires the task content of the task selected by the user in the preset task library, the function of the timer needs to be relatively modified due to the original JAVA SERVLET project, the workload for modification is quite large, and the compatibility is not well controlled. Therefore, in order to realize the timer function under the premise of easier and safer operation, the system timer carried by the host is combined with the JAVA SERVLET item to realize the function of the JAVA SERVLET item timer. But since the function of the timer is to be implemented between the system timer and the JAVA SERVLET entry, the two need to be linked. The middleware linking the two can be, but is not limited to, integrating a redis database on a JAVA SERVLET project, or installing a curl plug-in on the redis database. The middleware has the function of linking a system timer with a JAVA SERVLET project, wherein the system timer executes a timing task at a fixed time, and sends a task instruction to the JAVA SERVLET project through the middleware to inform the JAVA SERVLET project of the timing task to be executed so as to perform subsequent operation. Thus, either the redis database or the curl plug-in is just one way to tell the JAVA SERVLET entry what timing tasks to perform.
Illustratively, when the middleware is a redis database, before the system timer acquires the task content of the task selected by the user in the preset task library, the redis database is integrated for the JAVA SERVLET project, and the redis database is started. Snooping of the redis queue in the redis database is created by the JAVA SERVLET entry. When a task instruction is monitored in the redis queue, the JAVA SERVLET item executes a task according to the task instruction. And sending a task instruction to the redis queue by using the publish-subscribe function of the redis database, monitoring the task instruction of the queue to be redis, and performing subsequent operation.
Illustratively, when the middleware is a curl plug-in, before the system timer acquires the task content of the task selected by the user in the preset task library, the curl plug-in is installed for the JAVA SERVLET project. A curl plug-in acts as a request by which the JAVA SERVLET entry is informed of what timing tasks should be performed when a task instruction is received.
After the system timer is linked with the JAVA SERVLET item through the middleware, the process of timing task implementation can be started.
Specifically, the user first selects task content of a task to be regularly realized from a preset task library. In the host, a JAVA SERVLET project is integrated, and a preset task library maintained by the JAVA SERVLET project contains a series of tasks that can be realized by the JAVA SERVLET project. Therefore, the user selects the task content of the task to be realized from the preset task library and sends the task content to the system timer.
202: and acquiring the execution time of the task input by the user and the execution period of the task through a JAVA SERVLET project maintained by the host.
Specifically, after selecting the task content of the task to be realized in the preset task library, the user inputs the execution time and the execution period of the task to be executed to the JAVA SERVLET project, so that the timed task can be established subsequently.
203: and establishing a timing task through a system timer according to the task content, the execution time of the task and the execution period of the task.
Illustratively, the timed task is created by the system timer through a java invocation cmd command. The JAVA SERVLET project itself may have problems if it is to integrate a timer framework or to implement a timer task by starting a thread. If the integrated timer framework is time-consuming and labor-consuming, the project is easy to be overstaffed and huge, the old project is not necessarily compatible, the old project is not convenient to reform, and pure JAVA SERVLET cannot be compatible. If the thread is started to realize the function of the timer, the problems of thread confusion, false death and the like are easily caused, the memory overflow is easily caused, and the troubleshooting is wrong and tedious. Thus, by way of example, combining the system timer with the JAVA SERVLET project may avoid the above problems and may save costs by using the system timer on its own. The system timer can establish a timing task according to the task content of the task selected by the user from the preset task library and the input execution time and execution period of the task. For example, in the case of a JAVA SERVLET project integrated redis database, when a timed task that a user wants to implement is to execute a service of 1024 × 1024 at 12, the system timer may set up a timed task by calling cmd command through JAVA according to the task content, execution time and execution cycle of the timed task, where the cmd command is as follows: at 12:00PUBLISH TaskScheduled "calc 1024".
204: and executing the timing task through a system timer to obtain a task instruction.
Specifically, after the system timer creates the timing task, the system timer determines each execution time of the timing task according to the execution time of the task and the execution period of the task. The system timer determines the starting time and the ending time of the first execution of the timing task according to the execution time of the task and the execution period of the task. Then, the system timer determines the execution time of each time of the timing task according to the starting time and the ending time of the first execution of the timing task and the execution period of the task. The system timer then performs the timing task at each execution time. For example, task 1 may be executed at 12:00 for an execution period of once every 24 hours. From this, it can be determined that the start time of the first execution of task 1 is 12:00 and the end time is 12:00 on the second day. According to the execution period, the execution time of each time of the timing task can be determined to be 12:00 of each day. At 12:00 of day, the system timer performs task 1.
Illustratively, when the JAVA SERVLET project is integrated with the redis database, the system timer executes the timing task and generates a task instruction corresponding to the timing task. The system timer then issues a task instruction to the redis queue. And then, the JAVA SERVLET item obtains a task instruction through monitoring a redis queue. For example, when the timing task that the user wants to implement is to execute a service of 1024 × 1024 at 12, the system timer may set up a timing task by calling cmd command through java according to the task content of the timing task, the execution time and the execution period, wherein the cmd command is as follows: at 12:00PUBLISH TaskScheduled "calc 1024". At 12, the system timer executes the timing task, generates a task instruction 'calc 1024', and the system timer issues the task instruction 'calc 1024' to the redis queue. And the JAVA SERVLET item obtains a task instruction 'calc 1024' through monitoring a redis queue.
Illustratively, a curl plug-in is installed for a JAVA SERVLET project. After the system timer executes the timing task, a task instruction corresponding to the timing task is generated, and the task instruction is sent to the JAVA SERVLET project through an interface of a curl plug-in. At this time, the system timer sends a request to the JAVA SERVLET item through the interface of the curl plug-in, and the request is a task instruction. The JAVA SERVLET project subsequently realizes the task according to the task instruction. For example, when the timing task that the user wants to implement is to execute a service of 1024 × 1024 at 12, the system timer may set up a timing task by calling cmd command through java according to the task content of the timing task, the execution time and the execution period, wherein the cmd command is as follows: at 12:00curl-X GET "http:// localhost:5001/api/carryOuttaskName ═ calc 1024". At 12, the system timer executes a timing task to generate a task instruction 'calc 1024', and the system timer sends the task instruction 'calc 1024' to the JAVA SERVLET item through an interface of a curl plug-in to request the JAVA SERVLET item to subsequently implement the task.
205: and acquiring the task instruction through a JAVA SERVLET project, and determining a target service corresponding to the task instruction according to the task instruction and a preset task library.
Specifically, after the JAVA SERVLET item acquires a task instruction sent by a system timer, the task instruction is matched with a plurality of task instructions in a preset task library. And when the same task instruction is matched, determining the target service corresponding to the task instruction. As shown in table 1, the matching situation between the task instruction and the service in the preset task library is as shown.
Table 1:
Figure BDA0003668844560000051
206: and executing the function corresponding to the target service through the JAVA SERVLET project.
Specifically, after the JAVA SERVLET project acquires the task instruction, the task instruction is matched with a preset task library to obtain a corresponding service and a function corresponding to the service. The service corresponding to the task instruction in the preset task library and the function corresponding to the service are all functions which can be realized by the JAVA SERVLET project. As shown in table 1, the traffic is matched to the function. After the target service is determined, the JAVA SERVLET project directly realizes the function according to the function corresponding to the target service, and the timer function of the JAVA SERVLET project is completed.
Generally, as shown in fig. 3A, fig. 3A is an internal interaction diagram of a device implemented by a timer, taking an integrated redis database as an example, provided in an embodiment of the present application. As shown in fig. 3B, fig. 3B is an internal interaction diagram of a device implemented by a timer, taking installing a curl plug as an example, provided in the embodiment of the present application. Before the JAVA SERVLET item realizes the function of the timer, the JAVA SERVLET item is integrated into a redis database or is provided with a Curl plug-in unit, and the system timer is associated with the JAVA SERVLET item. After the user selects the timing task to be realized and inputs the execution time and the execution period of the timing task, the system timer creates the timing task, and the timing task transmits a task instruction to the JAVA SERVLET project to realize the task selected by the user at the time input by the user. Equivalently, a system timer sends a task instruction to the JAVA SERVLET project at a specific time to remind the JAVA SERVLET project to realize the task selected by the user. The system timer is similar to an alarm clock or a prompter, and prompts a JAVA SERVLET project to specifically complete any task through a task instruction at the time selected by a user. After the JAVA SERVLET item acquires the task instruction, the target service and the function corresponding to the target service are determined according to the task instruction and the preset task library, and finally the function is realized by the JAVA SERVLET item. Further, the timer function of the JAVA SERVLET entry is completed. Namely, a system timer is used for prompting the JAVA SERVLET project to realize a specific task at a specific moment.
It can be seen that in the embodiments of the present application, there are the following benefits:
before the JAVA SERVLET item realizes the function of the timer, the JAVA SERVLET item is integrated into a redis database or a curl plug-in is installed, and the system timer is associated with the JAVA SERVLET item. After a user selects a timing task to be realized and inputs the execution time and the execution period of the timing task, the system timer creates the timing task, and the timing task sends a task instruction to a JAVA SERVLET project to realize the task selected by the user according to the time input by the user. Equivalently, the JAVA SERVLET project is reminded at a specific time through a system timer to realize the task selected by the user. The system timer is similar to an alarm clock or a prompter, and prompts a JAVA SERVLET project to specifically complete any task through a task instruction at the time selected by a user. After the JAVA SERVLET project acquires the task instruction, determining the target service and the function corresponding to the target service according to the task instruction and the preset task library, and finally realizing the function by the JAVA SERVLET project. Further, the timer function of the JAVA SERVLET entry is completed.
The method can effectively achieve the aim of enabling the JAVA SERVLET project to finish the execution of the timing task at low cost on the premise of ensuring the memory safety and thread safety on the basis of not integrating a timing frame and modifying the frame.
Referring to fig. 4, fig. 4 is a schematic diagram of a hardware structure of a timer implementation apparatus according to an embodiment of the present disclosure. The timer implementing means 400 comprises at least one processor 401, a communication line 402, a memory 403 and at least one communication interface 404.
In this embodiment, the processor 401 may be a general processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more ics for controlling the execution of programs according to the present disclosure.
Communication link 402, which may include a path, carries information between the aforementioned components.
The communication interface 404 may be any transceiver or other device (e.g., an antenna, etc.) for communicating with other devices or communication networks, such as an ethernet, RAN, Wireless Local Area Network (WLAN), etc.
The memory 403 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
In this embodiment, the memory 403 may be independent and connected to the processor 401 through the communication line 402. The memory 403 may also be integrated with the processor 401. The memory 403 provided by the embodiments of the present application may generally have a nonvolatile property. The memory 403 is used for storing computer-executable instructions for executing the present invention, and is controlled by the processor 401. The processor 401 is configured to execute computer-executable instructions stored in the memory 403, thereby implementing the methods provided in the embodiments described below.
In alternative embodiments, computer-executable instructions may also be referred to as application code, which is not specifically limited in this application.
In alternative embodiments, processor 401 may include one or more CPUs, such as CPU0 and CPU1 of FIG. 4.
In alternative embodiments, the timer-implemented apparatus 400 may include multiple processors, such as processor 401 and processor 407 in fig. 4. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores that process data (e.g., computer program instructions).
In an optional embodiment, if one of the timer implementation apparatuses 400 is a server, for example, the server may be an independent server, or may be a cloud server that provides basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, web service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), big data and an artificial intelligence platform. The timer implementation apparatus 400 under JAVA SERVLET may further include an output device 405 and an input device 406. An output device 405 is in communication with the processor 401 and may display information in a variety of ways. For example, the output device 405 may be a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display device, a Cathode Ray Tube (CRT) display device, a projector (projector), or the like. The input device 406 is in communication with the processor 401 and may receive user input in a variety of ways. For example, the input device 406 may be a mouse, a keyboard, a touch screen device, or a sensing device, among others.
A timer implementing apparatus 400 described above may be a general-purpose device or a special-purpose device. The embodiment of the present application does not limit the type of the timer implementation apparatus 400.
Referring to fig. 5, fig. 5 is a block diagram illustrating functional blocks of a timer implementation apparatus 500 according to an embodiment of the present disclosure. As shown in fig. 5, the timer implementing apparatus 500 includes:
an obtaining unit 501, configured to obtain task content of a task selected by a user in a preset task library through a system timer of a host;
the obtaining unit 501 is further configured to obtain an execution time of a task and an execution cycle of the task, where the execution time is input by a user, through a JAVA SERVLET item maintained by a host;
the processing unit 502 is configured to establish a timing task according to task content, task execution time and task execution cycle by using a system timer, where the timing task is created by using java to invoke a cmd command by using the system timer;
the processing unit 502 is further configured to execute a timing task through a system timer to obtain a task instruction;
the obtaining unit 501 is further configured to obtain a task instruction through a JAVA SERVLET project, and determine a target service corresponding to the task instruction according to the task instruction and a preset task library;
the processing unit 502 is further configured to execute a function corresponding to the target service through the JAVA SERVLET project.
In an embodiment of the present invention, before acquiring task content of a task selected by a user in a preset task library through a system timer of a host, the processing unit 502 is specifically configured to:
integrating a redis database for the JAVA SERVLET project and starting the redis database;
creating monitoring on a redis queue in a redis database through a JAVA SERVLET project;
in an embodiment of the present invention, in terms of obtaining a task instruction by executing a timing task through a system timer, the processing unit 502 is specifically configured to:
executing the timing task through a system timer to generate a task instruction corresponding to the timing task;
issuing a task instruction to a redis queue through a system timer;
and monitoring a redis queue through a JAVA SERVLET project to obtain a task instruction.
In an embodiment of the present invention, before acquiring task content of a task selected by a user in a preset task library through a system timer of a host, the processing unit 502 is specifically configured to:
a curl plug-in is installed for the JAVA SERVLET project.
In an embodiment of the present invention, in terms of obtaining a task instruction by executing a timing task through a system timer, the processing unit 502 is specifically configured to:
and executing the timing task through a system timer, generating a task instruction corresponding to the timing task, and sending the task instruction to the project through an interface of the curl plug-in.
In an embodiment of the present invention, in terms of determining a target service corresponding to a task instruction according to the task instruction and a preset task library, the processing unit 502 is specifically configured to:
determining a target instruction according to a task instruction and a plurality of task instructions in a preset task library through a JAVA SERVLET project;
and taking the service corresponding to the target instruction as the target service through the JAVA SERVLET project.
In the embodiment of the present invention, in terms of executing a timing task by a system timer, the processing unit 502 is specifically configured to:
determining each execution time of the timing task according to the execution time of the task and the execution period of the task through a system timer;
the timing task is executed at each execution time by a system timer.
In an embodiment of the present invention, in determining each execution time of the timed task according to the execution time of the task and the execution cycle of the task by using the system timer, the processing unit 502 is specifically configured to:
determining the starting time and the ending time of the first execution of the timing task according to the execution time of the task and the execution period of the task by a system timer;
and determining the execution time of each time of the timing task by the system timer according to the starting time and the ending time of the first execution of the timing task and the execution period of the task.
In an embodiment of the present invention, in terms of implementing a function by executing a target service through a JAVA SERVLET project, the processing unit 502 is specifically configured to:
determining a function corresponding to the target service according to a preset task library through a JAVA SERVLET project;
and executing the target service through the JAVA SERVLET project to realize the function.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 6, the electronic device 600 includes a transceiver 601, a processor 602, and a memory 603. Connected to each other by a bus 604. The memory 603 is used to store computer programs and data, and can transfer data stored in the memory 603 to the processor 602.
The processor 602 is configured to read the computer program in the memory 603 to perform the following operations:
acquiring task contents of tasks selected by a user in a preset task library through a system timer of a host;
acquiring the execution time of a task input by a user and the execution period of the task through a JAVA SERVLET project maintained by a host;
establishing a timing task through a system timer according to task content, task execution time and task execution period, wherein the timing task is created by calling a cmd command through java by the system timer;
executing a timing task through a system timer to obtain a task instruction;
acquiring a task instruction through a JAVA SERVLET project, and determining a target service corresponding to the task instruction according to the task instruction and a preset task library;
and executing the function corresponding to the target service through the JAVA SERVLET project.
In an embodiment of the present invention, before acquiring task content of a task selected by a user in a preset task library through a system timer of a host, the processor 602 is specifically configured to perform the following operations:
integrating a redis database for the JAVA SERVLET project and starting the redis database;
creating monitoring on a redis queue in a redis database through a JAVA SERVLET project;
in an embodiment of the present invention, in terms of obtaining a task instruction by executing a timing task through a system timer, the processor 602 is specifically configured to perform the following operations:
executing the timing task through a system timer to generate a task instruction corresponding to the timing task;
issuing a task instruction to a redis queue through a system timer;
and monitoring a redis queue through a JAVA SERVLET project to obtain a task instruction.
In an embodiment of the present invention, before acquiring task content of a task selected by a user from a preset task library by using a system timer of a host, the processor 602 is specifically configured to perform the following operations:
a curl plug-in is installed for the JAVA SERVLET project.
In an embodiment of the present invention, in terms of obtaining a task instruction by executing a timing task through a system timer, the processor 602 is specifically configured to perform the following operations:
and executing the timing task through a system timer, generating a task instruction corresponding to the timing task, and sending the task instruction to the project through an interface of the curl plug-in.
In an embodiment of the present invention, in terms of determining a target service corresponding to a task instruction according to the task instruction and a preset task library, the processor 602 is specifically configured to perform the following operations:
determining a target instruction according to a task instruction and a plurality of task instructions in a preset task library through a JAVA SERVLET project;
and taking the service corresponding to the target instruction as the target service through the JAVA SERVLET project.
In the embodiment of the present invention, in terms of executing the timing task by the system timer, the processor 602 is specifically configured to perform the following operations:
determining each execution time of the timing task according to the execution time of the task and the execution period of the task through a system timer;
the timing task is executed at each execution time by the system timer.
In the embodiment of the present invention, in determining each execution time of the timed task according to the execution time of the task and the execution cycle of the task by the system timer, the processor 602 is specifically configured to perform the following operations:
determining the initial time and the termination time of the first execution of the timing task according to the execution time of the task and the execution period of the task through a system timer;
and determining the execution time of each time of the timing task by the system timer according to the starting time and the ending time of the first execution of the timing task and the execution period of the task.
In an embodiment of the present invention, in terms of executing a function corresponding to a target service through a JAVA SERVLET item, the processor 602 is specifically configured to perform the following operations:
determining a function corresponding to the target service according to a preset task library through a JAVA SERVLET project;
and executing the target service through the JAVA SERVLET project to realize the function.
It should be understood that the timer implementing device in the present application may include a smart Phone (e.g., an Android Phone, an iOS Phone, a Windows Phone, etc.), a tablet computer, a palm computer, a notebook computer, a Mobile Internet device MID (MID), a robot or a wearable device, etc. The above timer implementation devices are only examples, not exhaustive, and include but are not limited to the above timer implementation devices. In practical applications, the timer implementation apparatus may further include: intelligent vehicle-mounted terminal, computer equipment and the like.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention can be implemented by combining software and a hardware platform. With this understanding in mind, all or part of the technical solutions of the present invention that contribute to the background can be embodied in the form of a software product, which can be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of the embodiments or some parts of the embodiments of the present invention.
Accordingly, the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement part or all of the steps of any one of the video search determination methods as described in the above method embodiments. For example, the storage medium may include a hard disk, a floppy disk, an optical disk, a magnetic tape, a magnetic disk, a flash memory, and the like.
Embodiments of the present application also provide a computer program product comprising 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 any one of the timer-implemented methods as described in the above method embodiments.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are all alternative embodiments and that the acts and modules referred to are not necessarily required by the application.
In the above embodiments, the description of each embodiment has its own weight, and for parts that are not described in detail in a certain embodiment, reference may be made to the description of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware, or may be implemented in the form of a software program module.
The integrated units, if implemented in the form of software program modules and sold or used as stand-alone products, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a memory and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, and the memory may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented, and specific examples have been applied herein to illustrate the principles and embodiments of the present application, but the foregoing detailed description of the embodiments is only provided to help understand the method and its core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A timer-implemented method, applied to a host, the method comprising:
acquiring task contents of tasks selected by a user in a preset task library through a system timer of the host;
acquiring the execution time of the task and the execution period of the task input by the user through a JAVA SERVLET project maintained by the host;
establishing a timing task according to the task content, the task execution time and the task execution period through the system timer, wherein the timing task is created by the system timer through a java call cmd command;
executing the timing task through the system timer to obtain a task instruction;
acquiring the task instruction through the JAVA SERVLET project, and determining a target service corresponding to the task instruction according to the task instruction and the preset task library;
and executing the function corresponding to the target service through the JAVA SERVLET project.
2. The method according to claim 1, wherein before acquiring task contents of a task selected by a user in a preset task library through a system timer of the host, the method further comprises:
integrating a redis database for the JAVA SERVLET project and starting the redis database;
creating monitoring on a redis queue in the redis database through the JAVA SERVLET project;
executing the timing task through the system timer to obtain a task instruction, wherein the task instruction comprises:
executing the timing task through the system timer to generate a task instruction corresponding to the timing task;
issuing, by the system timer, the task instruction to the redis queue;
and monitoring the redis queue through the JAVA SERVLET item to obtain the task instruction.
3. The method according to claim 1, wherein before acquiring task contents of a task selected by a user in a preset task library through a system timer of the host, the method further comprises:
installing a curl plug-in for the JAVA SERVLET project;
the executing the timing task by the system timer to obtain a task instruction comprises:
executing the timing task through the system timer, generating a task instruction corresponding to the timing task, and sending the task instruction to the project through an interface of the curl plug-in.
4. The method according to claim 1, wherein the determining a target service corresponding to the task instruction according to the task instruction and the preset task library comprises:
determining a target instruction according to the task instruction and a plurality of task instructions in the preset task library through the JAVA SERVLET project;
and using the service corresponding to the target instruction as the target service through the JAVA SERVLET project.
5. The method according to any of claims 1-4, wherein said performing the timing task by the system timer comprises:
determining each execution time of the timing task according to the execution time of the task and the execution period of the task through the system timer;
and executing the timing task at each execution time through the system timer.
6. The method of claim 5, wherein determining, by the system timer, each execution time of the timed task according to the execution time of the task and the execution period of the task comprises:
determining the starting time and the ending time of the first execution of the timing task according to the execution time of the task and the execution period of the task by the system timer;
and determining the execution time of each time of the timing task according to the starting time and the ending time of the first execution of the timing task and the execution period of the task by the system timer.
7. The method of claim 1, wherein the performing the function corresponding to the target service through the JAVA SERVLET entry comprises:
determining a function corresponding to the target service according to the preset task library through the JAVA SERVLET project;
and executing the target service through the JAVA SERVLET project to realize the function.
8. A timer implementing apparatus, comprising: an acquisition unit and a processing unit;
the acquisition unit is used for acquiring task contents of tasks selected by a user in a preset task library through a system timer of the host;
the obtaining unit is further used for obtaining the execution time of the task and the execution cycle of the task input by the user through a JAVA SERVLET project maintained by the host;
the processing unit is used for establishing a timing task according to the task content, the execution time of the task and the execution cycle of the task through the system timer, wherein the timing task is created by calling a cmd command through java by the system timer;
the processing unit is also used for executing the timing task through the system timer to obtain a task instruction;
the acquisition unit is further used for acquiring the task instruction through the JAVA SERVLET project and determining a target service corresponding to the task instruction according to the task instruction and the preset task library;
and the processing unit is also used for executing the function corresponding to the target service through the JAVA SERVLET project.
9. An electronic device, comprising: a processor and a memory, the processor being coupled to the memory, the memory for storing a computer program, the processor for executing the computer program stored in the memory to cause the electronic device to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which is executed by a processor to implement the method according to any one of claims 1-7.
CN202210602947.4A 2022-05-30 2022-05-30 Timer implementation method and related product Pending CN114968529A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210602947.4A CN114968529A (en) 2022-05-30 2022-05-30 Timer implementation method and related product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210602947.4A CN114968529A (en) 2022-05-30 2022-05-30 Timer implementation method and related product

Publications (1)

Publication Number Publication Date
CN114968529A true CN114968529A (en) 2022-08-30

Family

ID=82956975

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210602947.4A Pending CN114968529A (en) 2022-05-30 2022-05-30 Timer implementation method and related product

Country Status (1)

Country Link
CN (1) CN114968529A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292023A (en) * 2022-10-08 2022-11-04 北京中科网威信息技术有限公司 Timing task processing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292023A (en) * 2022-10-08 2022-11-04 北京中科网威信息技术有限公司 Timing task processing method and device

Similar Documents

Publication Publication Date Title
US9386264B2 (en) Augmenting capabilities of a host device
TWI672027B (en) Data processing method, device and system in webpage
CN112035768A (en) Page rendering method and device for fast application, storage medium and electronic equipment
CN112243033B (en) Method, device and equipment for acquiring memory information and computer readable storage medium
CN113220366A (en) Sub-application starting method and device, terminal and server
CN114968529A (en) Timer implementation method and related product
CN112558833A (en) Application running method and device and electronic equipment
CN116048771B (en) Resource scheduling method and related equipment
CN108009226B (en) Promotion content display implementation method based on intelligent terminal application and intelligent terminal
CN115291773A (en) Tree structure data display method and device
CN115421693A (en) Method and device for realizing micro front-end architecture, computer equipment and storage medium
CN113891441A (en) Network connection method and device and electronic equipment
CN111611077A (en) Task parameter processing method, terminal and storage medium
CN107180107B (en) Method and system for uploading selected files by mobile phone attachment under Ionic framework
CN111552898A (en) Flowchart drawing method and device based on Html5, computer equipment and storage medium
CN114268653B (en) Equipment calling method, device, equipment, medium and product
CN113886796B (en) K8S-based service deployment method and device, electronic equipment and storage medium
CN113778673B (en) Data processing method, storage medium and apparatus
CN113268300B (en) Information display method and device
CN109189320A (en) A kind of control method of smart machine, storage medium and server
CN114281478B (en) Container operation method and device, electronic equipment and computer storage medium
CN114896013B (en) Page loading time length determining method and device, electronic equipment and storage medium
WO2023169157A1 (en) Sub application running method and apparatus, electronic device, program product, and storage medium
CN114675898A (en) Page jump method, computer device and computer readable storage medium
CN113094607A (en) Method and device for acquiring local resources

Legal Events

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