CN108427599A - Method, apparatus and storage medium is uniformly processed in asynchronous task - Google Patents
Method, apparatus and storage medium is uniformly processed in asynchronous task Download PDFInfo
- Publication number
- CN108427599A CN108427599A CN201710916221.7A CN201710916221A CN108427599A CN 108427599 A CN108427599 A CN 108427599A CN 201710916221 A CN201710916221 A CN 201710916221A CN 108427599 A CN108427599 A CN 108427599A
- Authority
- CN
- China
- Prior art keywords
- type
- asynchronous task
- service
- task
- asynchronous
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0631—Resource planning, allocation, distributing or scheduling for enterprises or organisations
- G06Q10/06316—Sequencing of tasks or work
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Human Resources & Organizations (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- Economics (AREA)
- Entrepreneurship & Innovation (AREA)
- Strategic Management (AREA)
- General Physics & Mathematics (AREA)
- Educational Administration (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- Operations Research (AREA)
- General Business, Economics & Management (AREA)
- Marketing (AREA)
- Game Theory and Decision Science (AREA)
- Development Economics (AREA)
- General Engineering & Computer Science (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of asynchronous tasks, and method, apparatus and storage medium is uniformly processed, and this method includes:The script of asynchronous task is generated according to the basic information of asynchronous task, and is added in database;The configuration information and asynchronous task class that asynchronous task is added in exploitation code add the type of service that asynchronous task is related in asynchronous task class, the processing type that each type of service is related to are arranged, and corresponding service logic is arranged for each processing type;Asynchronous task is received from client, the asynchronous task received is stored according to chronological order to task list;The asynchronous task received earliest is read from task list;Judgement processing is carried out to the type of service and processing type of asynchronous task by the first judgment step and the second judgment step, shortens the development time, improves working efficiency.
Description
Technical field
The present invention relates to asynchronous process technical fields more particularly to a kind of asynchronous task, and method, apparatus and meter is uniformly processed
Calculation machine readable storage medium storing program for executing.
Background technology
With the fast development of Internet technology, more and more work can automatically process completion by application system.
These application systems can be handled the different demands of different clients, different therefore, it is necessary to be developed for the demand of client
Asynchronous task application system.
Currently, in the project development and application process of asynchronous task application system, the demand of the usual same client relates to
And many asynchronous tasks, and increasing an asynchronous task newly every time, Software Development Engineer is required for doing following content change:1.
The script that the basic information of addition asynchronous task defines in the database, such as task encoding, task names and task author;2.
Increase the configuration information of asynchronous task, such as task encoding and task group, while newly-increased asynchronous task processing newly in code
JAVA classes;3. the implementing result of the newly-increased asynchronous task of concern.The asynchronous task base having the same being related to due to same requirements
Plinth information and configuration information, so as to cause each newly-increased asynchronous task, Software Development Engineer will execute some repeated works
Make, such as configures identical basic information.The human resources of development time and test are not only wasted in this way, but also also reduce work
Make efficiency.
Invention content
In view of the foregoing, method, apparatus and computer-readable storage is uniformly processed in a kind of asynchronous task of present invention offer
Medium can effectively shorten the development time, improve working efficiency.
To achieve the above object, method is uniformly processed in a kind of asynchronous task of present invention offer, and this method includes:
Database initialization step:The script that asynchronous task is generated according to the basic information of asynchronous task, which is added
It is added in database;
Code initialization step:The configuration information and asynchronous task class that asynchronous task is added in exploitation code, asynchronous
The type of service that asynchronous task is related to is added in task class, the processing type that each type of service is related to is set, and is each place
It manages type and corresponding service logic is set;
Receiving step:Asynchronous task is received from client, the asynchronous task received is stored according to chronological order
To task list;
Read step:The asynchronous task received earliest is read from task list;
First judgment step:Judge whether the type of service of the asynchronous task is defined industry in the asynchronous task class
Service type judges this asynchronous if the type of service of the asynchronous task is not defined type of service in asynchronous task class
The type of service of business is unknown type of service, prompts to execute failure, if the type of service of the asynchronous task is in asynchronous task class
Defined type of service then executes the second judgment step;And
Second judgment step:Judge whether the processing type of the asynchronous task is defined processing in the type of service
Type judges this asynchronous if the processing type of the asynchronous task is not defined processing type in the type of service
The processing type of business is unknown processing type, prompts to execute failure, if the processing type of the asynchronous task is the type of service
In defined processing type, then execute corresponding service logic.
Preferably, this method further includes:
Third judgment step:Judge whether corresponding service logic runs succeeded, if running succeeded, prompt execute at
Work(;Conversely, then prompting to execute failure.
Preferably, first judgment step further includes:
If the type of service of the asynchronous task read is not defined type of service in asynchronous task class, prompt this different
The type of service of step task is unknown type of service, and corresponding type of service is added in asynchronous task class.
Preferably, second judgment step further includes:
If the processing type of the asynchronous task read is not defined processing type in the type of service, prompting should
The processing type of asynchronous task is unknown processing type, and corresponding processing type is added in the type of service.
Preferably, this method further includes:
Recording step:The reason of recording the implementing result of each asynchronous task and executing failure, and count asynchronous task and hold
The number of row failure is recorded in a unified format in a asynchronous task implementing result inventory, is fed back to predetermined manner
Related personnel.
Preferably, this method further includes:
4th judgment step:Judge whether the number of asynchronous task failure is more than preset value;
If the number of asynchronous task failure is more than preset value, it is more than preset value to prompt the asynchronous task frequency of failure,
No longer execute the task;
If the number of asynchronous task failure is less than or equal to preset value, restarts and execute the asynchronous task.
In addition, the present invention also provides a kind of electronic device, which includes:Memory, processor and it is stored in institute
The asynchronous task unified processing system that can be run on memory and on the processor is stated, the asynchronous task, which is uniformly processed, is
System is executed by the processor, it can be achieved that following steps:
Database initialization step:The script that asynchronous task is generated according to the basic information of asynchronous task, which is added
It is added in database;
Code initialization step:The configuration information and asynchronous task class that asynchronous task is added in exploitation code, asynchronous
The type of service that asynchronous task is related to is added in task class, the processing type that each type of service is related to is set, and is each place
It manages type and corresponding service logic is set;
Receiving step:Asynchronous task is received from client, the asynchronous task received is stored according to chronological order
To task list;
Read step:The asynchronous task received earliest is read from task list;
First judgment step:Judge whether the type of service of the asynchronous task is defined industry in the asynchronous task class
Service type judges this asynchronous if the type of service of the asynchronous task is not defined type of service in asynchronous task class
The type of service of business is unknown type of service, prompts to execute failure, if the type of service of the asynchronous task is in asynchronous task class
Defined type of service then executes the second judgment step;And
Second judgment step:Judge whether the processing type of the asynchronous task is defined processing in the type of service
Type judges this asynchronous if the processing type of the asynchronous task is not defined processing type in the type of service
The processing type of business is unknown processing type, prompts to execute failure, if the processing type of the asynchronous task is the type of service
In defined processing type, then execute corresponding service logic.
Preferably, first judgment step further includes:
If the type of service of the asynchronous task read is not defined type of service in asynchronous task class, prompt this different
The type of service of step task is unknown type of service, and corresponding type of service is added in asynchronous task class.
Preferably, second judgment step further includes:
If the processing type of the asynchronous task read is not defined processing type in the type of service, prompting should
The processing type of asynchronous task is unknown processing type, and corresponding processing type is added in the type of service.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium
Storage medium includes asynchronous task unified processing system, can when the asynchronous task unified processing system is executed by processor
Realize that the arbitrary steps in method are uniformly processed in asynchronous task as described above.
Method, electronic device and computer readable storage medium is uniformly processed in asynchronous task proposed by the present invention, according to visitor
The demand at family adds in the database by the script of the basic information generation of asynchronous task, increases asynchronous newly in exploitation code
The configuration information and asynchronous task class of business add the type of service that timed task is related in asynchronous task class, and every for setting
The processing type and service logic that a type of service is related to, are uniformly processed the asynchronous task received from client, to contract later
The short development time improves the working efficiency of software engineer.
Description of the drawings
Fig. 1 is the schematic diagram of electronic device preferred embodiment of the present invention;
Fig. 2 is the functional block diagram of asynchronous task unified processing system preferred embodiment in Fig. 1;
Fig. 3 is the flow chart that method first embodiment is uniformly processed in asynchronous task of the present invention;
Fig. 4 is the flow chart that method second embodiment is uniformly processed in asynchronous task of the present invention.
Fig. 5 is the setting frame diagram of asynchronous task class of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific implementation mode
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
As shown in Figure 1, being the schematic diagram of 1 preferred embodiment of electronic device of the present invention.
In the present embodiment, electronic device 1 can be server, smart mobile phone, tablet computer, PC, portable meter
Calculation machine and other electronic equipments with calculation function.
The electronic device 1 includes:It memory 11, processor 12, display 13 and is stored on the memory 11 and can
The asynchronous task unified processing system 10 run on the processor 12.The electronic device 1 by network 2 connect one or
Multiple client 3 receives the asynchronous task of client from client 3, and by received task according to the priority of receiving time
In sequence storage to task list.The electronic device 1 can also be connect with database 4.In the present embodiment, it is deposited in database 4
There is the script that the basic information of asynchronous task generates.
Wherein, network 2 can be LAN, and wide area network, the network of Metropolitan Area Network (MAN) etc. type can be cable network,
It can be wireless network.
Client 3 can be desktop PC, notebook, tablet computer, mobile phone or it is other can pass through network with electricity
The terminal device that sub-device is communicated.
Memory 11 includes at least a type of readable storage medium storing program for executing.The readable storage medium storing program for executing of at least one type
It can be the non-volatile memory medium of such as flash memory, hard disk, multimedia card, card-type memory.In some embodiments, described to deposit
Reservoir 11 can be the internal storage unit of the electronic device 1, such as the hard disk of the electronic device 1.In other embodiments
In, the memory 11 can also be to be equipped on the external memory unit of the electronic device 1, such as the electronic device 1
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodge
Deposit card (Flash Card) etc..
In the present embodiment, the memory 11 can be not only used for storage be installed on the electronic device 1 application it is soft
Part and Various types of data, such as asynchronous task unified processing system 10, task list and asynchronous task implementing result inventory, can be with
For temporarily storing the data that has exported or will export.
Processor 12 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), microprocessor or other data processing chips, the program code for being stored in run memory 11 or processing data, example
Such as execute the computer program code of asynchronous task unified processing system 10.
Display 13 is properly termed as display screen or display unit.Display 13 can be that LED is shown in some embodiments
Device, liquid crystal display, touch-control liquid crystal display and OLED (OrganicLight-Emitting Diode, organic light emission two
Pole pipe) touch device etc..Display 13 is for showing the information handled in the electronic apparatus 1 and for showing visual work
Interface, such as:Show result (execute failure or run succeeded), the number of mission failure and the mission failure reason of task execution.
Preferably, which can also include user interface, and user interface may include input unit such as keyboard
(Keyboard), instantaneous speech power such as sound equipment, earphone etc., optionally user interface can also be connect including the wired of standard
Mouth, wireless interface.
In device embodiment shown in Fig. 1, as storing asynchronous in a kind of memory 11 of computer storage media
The program code of business unified processing system 10, processor 12 execute the program code of asynchronous task unified processing system 10, realize
Following function:
The script that the basic information of addition asynchronous task defines in the database;
The configuration information and asynchronous task class of asynchronous task are set in exploitation code, and adds and determines in asynchronous task class
When all types of service for being related to of task, and all processing types being related to for the setting of each type of service and corresponding business are patrolled
Volume;
Asynchronous task is received from client, and the asynchronous task received is stored according to the sequence of time order and function to task
List;
The asynchronous task received earliest is read from task list;
Whether the type of service and processing type for judging the asynchronous task are defined business in the asynchronous task class
Type and processing type, if the type of service of the asynchronous task is not defined type of service or processing class in asynchronous task class
Type then judges the type of service of the asynchronous task or handles type for unknown type of service or unknown processing type, conversely, then holding
The corresponding service logic of row.
It is specific to introduce the detailed description that join functional block diagram of the lower section about asynchronous task unified processing system 10.
As shown in Fig. 2, being the functional block diagram of 10 preferred embodiment of asynchronous task unified processing system in Fig. 1.The present invention
So-called module is the series of computation machine program instruction section for referring to complete specific function.
In the present embodiment, asynchronous task unified processing system 10 includes:Database initialization module 110, code are initial
Change module 120, receiving module 130, read module 140, judgment module 150, logging modle 160 and frequency of failure judgment module
170。
Database initialization module 110, the script for generating asynchronous task according to the basic information of asynchronous task, by this
Script is added in database.Basic information includes task execution frequency, preset value, Business Name and business processing people.Assuming that
When needing to develop an asynchronous task unified processing system 10, database initialization module 110 is by task execution frequency, default
The basic informations such as value, Business Name and business processing people generate the script of asynchronous task, are added in database 4.Wherein task
It includes service class to execute frequency (such as task is fixed every 30 seconds and executed once), preset value (such as preset value is 20) and Business Name
Type title and processing typonym;Business processing people refers to the corresponding business processing people of each processing type.
Code initialization module 120, configuration information and asynchronous task class for adding asynchronous task in exploitation code,
The type of service that asynchronous task is related to is added in asynchronous task class, and the processing type that each type of service is related to is set, and is
Corresponding service logic is arranged in each processing type.Asynchronous task class is set, it is corresponding that asynchronous task is added in asynchronous task class
All types of service, corresponding all processing types are set in different types of service, in different processing types
Corresponding business logic codes are set.Type of service is used for for substantially distinguishing different service logics, processing type same
Different service logics is segmented under a type of service.For example, asynchronous task class is arranged in the asynchronous task to exploitation, as shown in Figure 5.
All types of service of asynchronous task are added in asynchronous task class, type of service includes type of service A1, type of service A2And industry
Service type A3Deng.For type of service A1All processing types being related to, type of service A are set1Processing type include processing type
B11, processing type B12With processing type B13Deng;Corresponding business logic codes are set in different processing types, are such as handled
Type B11Corresponding service logic is service logic C11.Wherein the processing number of types of different service types can be different, such as business
Type A1Processing number of types and type of service A2Processing number of types it is different.Meanwhile asynchronous task is set in exploitation code
Configuration information, configuration information include task encoding and task group.Wherein task encoding is different for specification and quick search one
The corresponding type of service of step task, processing type and service logic, for example, the type of service of certain asynchronous task is type of service
A1, corresponding processing type is processing type B12, then the task encoding of the asynchronous task is A1-B12;Task group is used for industry
Business logic is grouped storage for type of service and processing type.
Receiving module 130, it is for receiving asynchronous task from client, the asynchronous task received is suitable according to time order and function
Sequence is stored to task list.Receiving module 130 receives the asynchronous task of client 3, and asynchronous will received by network 2
Business is stored according to the sequencing of receiving time in task list.For example, receiving module 130 is received from 3 priority of client
Asynchronous task a, asynchronous task b, asynchronous task c and asynchronous task d, and by asynchronous task a, asynchronous task b, asynchronous task c and
Asynchronous task d is stored according to the sequencing of receiving time in the task list of memory 11.
Read module 140, for reading the asynchronous task received earliest from task list.For example, read module 140
Read the asynchronous task a received earliest in task list.
Judgment module 150, whether type of service and processing type for judging the asynchronous task are the asynchronous task
Defined type of service and processing type in class, if the type of service of the asynchronous task is not defined in asynchronous task class
Type of service or processing type then judge the type of service of the asynchronous task or handle type as unknown type of service or unknown place
Type is managed, conversely, then executing corresponding service logic and judging whether to run succeeded.Judgment module 150 judges read module 140
Whether the type of service of the asynchronous task a of reading is defined type of service in asynchronous task class.Assuming that the industry of asynchronous task a
Service type is not defined type of service in asynchronous task class, then prompts:Execute failure.Assuming that the service class of asynchronous task a
Type is defined type of service in asynchronous task class, then continues to judge whether the processing type of the asynchronous task a read is institute
State defined processing type in task type.Assuming that the processing type of asynchronous task a is not defined in the type of service
Processing type, then prompt:Execute failure.Assuming that the processing type of asynchronous task a is defined place in the type of service
Type is managed, then executes corresponding service logic and judges whether the corresponding service logic of successful execution.Assuming that running succeeded, then carry
Show:It runs succeeded;Assuming that executing failure, then prompt:Execute failure.
The reason of logging modle 160, implementing result and execution for recording each asynchronous task fail, and count asynchronous
The number of task execution failure is recorded in same a asynchronous task implementing result inventory, in a unified format with predetermined manner
Feed back to related personnel.Logging modle 160 records the implementing result of asynchronous task a and asynchronous task a executes the reason of failing, and
The number that asynchronous task a executes failure is counted, is finally recorded in a unified format clear with a asynchronous task implementing result
Dan Zhong feeds back to Software Development Engineer in such a way that display 13 is shown.Software Development Engineer is executed according to asynchronous task
The failure cause of asynchronous task a is handled in results list, for example, judging that the type of service of asynchronous task a is not asynchronous
Be engaged in class in defined type of service, then Software Development Engineer only need to add corresponding type of service in asynchronous task class
Without repeating addition basic information and configuration information.
Frequency of failure judgment module 170, for judging whether the number of asynchronous task failure is more than preset value;If this is different
The number for walking mission failure is more than preset value, then it is more than preset value to prompt the asynchronous task frequency of failure, no longer executes the task;
If the number of asynchronous task failure is less than or equal to preset value, restarts and execute the asynchronous task.The frequency of failure judges
Module 170 judges that whether asynchronous task a executes the number of failure more than 20 times.Assuming that the number of asynchronous task a failures is big
In 20 times, then prompt:The asynchronous task a frequency of failures are more than 20 times, no longer execute the asynchronous task;Assuming that asynchronous task a
The number of failure is less than or equal to 20 times, then asynchronous task a is reentered into new task list, and it is different to re-execute this
Step task a.
As shown in figure 3, being the flow chart that method first embodiment is uniformly processed in asynchronous task of the present invention.
In the present embodiment, processor 12 executes the calculating of the asynchronous task unified processing system 10 stored in memory 11
Realize that the following steps of method are uniformly processed in asynchronous task when machine program:
Step S10, database initialization module 110 generate the script of asynchronous task according to the basic information of asynchronous task,
The script is added in database.Basic information includes task execution frequency, preset value, Business Name and business processing people.
Assuming that when needing to develop an asynchronous task unified processing system 10, database initialization module 110 is by task execution frequency, pre-
If the basic informations such as value, Business Name and business processing people are defined generation script, it is added in database 4.Wherein task
It includes service class to execute frequency (such as task is fixed every 30 seconds and executed once), preset value (such as preset value is 20) and Business Name
Type title and processing typonym;Business processing people refers to the corresponding business processing people of each processing type.
Step S20, code initialization module 120 add the configuration information and asynchronous task of asynchronous task in exploitation code
Class adds the type of service that asynchronous task is related in asynchronous task class, the processing type that each type of service is related to is arranged, and
For each processing type, corresponding service logic is set.Asynchronous task class is set, asynchronous task phase is added in asynchronous task class
Corresponding all processing types are arranged, in different processing types in all types of service answered in different types of service
Corresponding business logic codes are set.Type of service is used for for substantially distinguishing different service logics, processing type same
Different service logics is segmented under a type of service.For example, the asynchronous task class of certain insurance company Claims Resolution system is for example set,
It includes casualty insurance class A that the type of service of asynchronous task is added in asynchronous task class1, tourist insurance class A2, health insurance class A3、
Business insurance class A4, property insurance class A5Etc. types of service.Wherein casualty insurance class A1Corresponding processing type is handed over including a term
Logical accident insurance B11, short-term traffic accident danger B12, aviation accident insurance B13, a term personal accident danger B14With short-term personal accident danger
B15Deng processing type.In a term traffic accident danger B11A term traffic accident danger service logic C is set in processing type11.Together
When, the configuration information of asynchronous task is set in exploitation code, and configuration information includes task encoding and task group.Wherein task
Coding is for the specification and corresponding type of service of one asynchronous task of quick search, processing type and service logic, for example, certain is different
The type of service of step task is casualty insurance class A1, corresponding processing type is short-term traffic accident danger B12, then the asynchronous task
Task encoding be A1-B12;Task group is used to service logic being grouped storage for type of service and processing type.
Step S30, receiving module 130 receive asynchronous task from client, by the asynchronous task received according to time elder generation
Sequence is stored to task list afterwards.Receiving module 130 receives the asynchronous task of client 3 by network 2, and different by what is received
Step task is stored according to the sequencing of receiving time in task list.For example, 130 priority of receiving module receives traffic silver
Capable asynchronous task:Bank of Communications flight delay case, Bank of Communications's aircraft surprisingly die/disabled case, Bank of Communications overseas
Swim case ,/disabled case, Bank of Communications's travel abroad of and Bank of Communications flight delay case, Bank of Communications's aircraft surprisingly being die
These asynchronous tasks of case are stored according to the sequencing of receiving time in task list.
Step S40, read module 140 read the asynchronous task received earliest from task list.For example, read module
The asynchronous task received earliest in 140 reading task lists is that Bank of Communications's flight is delayed case.
Step S50, judgment module 150 judge whether the type of service of the asynchronous task is to have determined in the asynchronous task class
The type of service of justice, if the type of service of the asynchronous task is not defined type of service in asynchronous task class, judging should
The type of service of asynchronous task is unknown type of service, executes step S100;If the type of service of the asynchronous task is asynchronous
Defined type of service in class of being engaged in, thens follow the steps S60.Judgment module 150 judges the type of service of the asynchronous task read
Whether it is defined type of service in asynchronous task class.Assuming that the type of service of asynchronous task has been determined in asynchronous task class
The type of service of justice, thens follow the steps S100;Assuming that the type of service of asynchronous task is defined business in asynchronous task class
Type thens follow the steps S60.Such as judgment module 150 judges that the type of service of the Bank of Communications's flight delay case read is
Casualty insurance class A defined in asynchronous task class1, then follow the steps S60.
Step S60, judgment module 150 judge whether the processing type of the asynchronous task is defined in the type of service
Processing type, if the processing type of the asynchronous task is not defined processing type in the type of service, judge should
The processing type of asynchronous task is unknown processing type, executes step S100;If the processing type of the asynchronous task read is institute
Defined processing type in type of service is stated, S70 is thened follow the steps.Judgment module 150 judges the place of the asynchronous task read
Manage whether type is defined processing type in the task type.Assuming that the processing type of asynchronous task is not the business
Defined processing type, thens follow the steps S100 in type;Assuming that the processing type of asynchronous task is in the type of service
Defined processing type, thens follow the steps S70.Such as judgment module 150 judges that the Bank of Communications's flight read is delayed case
Processing type be casualty insurance class A1Defined in a term traffic accident danger B11, then follow the steps S70.
Step S70 is held when the processing type of the type of service of reading is defined processing type in the type of service
The corresponding service logic of row.Such as judgment module 150 judges the processing type of the Bank of Communications's flight delay case read to appoint
A term traffic accident danger B defined in service type11, then a term traffic accident danger service logic is executed.
Step S100 is judged as NO if executing, prompts to execute failure accordingly.If judgment module 150 executes accordingly
It is judged as NO, then prompts:Execute failure.
Method is uniformly processed in the asynchronous task that the present embodiment proposes, the basic information for adding asynchronous task in the database is fixed
The script of justice;Then all types of service, processing type and the corresponding business of processing type are arranged in asynchronous task class to patrol
It collects, while the configuration information of asynchronous task is set in exploitation code;Made by the first judgment step and the second judgment step
Different asynchronous tasks is handled in corresponding service logic, shortens the development time, improves working efficiency.
As shown in figure 4, being the flow chart that method second embodiment is uniformly processed in asynchronous task of the present invention.
In the present embodiment, asynchronous task is uniformly processed method and includes:Step S10- steps S140.Wherein, step S10-
Step S70 and step S100 are roughly the same with content in first embodiment, and which is not described herein again.
Step S80, judgment module 150 judge whether corresponding service logic runs succeeded, if running succeeded, prompt to hold
It goes successfully;Conversely, then prompting to execute failure.For example, judgment module 150 judges that executing a term traffic accident danger service logic is
It is no to run succeeded.Assuming that running succeeded, S90 is thened follow the steps;Assuming that executing failure, S100 is thened follow the steps.
Step S90 prompts to run succeeded if executing corresponding service logic success.If judgment module 150 executes 1 year
The service logic of phase traffic accident danger runs succeeded, then prompts:It runs succeeded.
The reason of step S110, logging modle 160 records the implementing result of each asynchronous task and executes failure, and count
Asynchronous task executes the number of failure, is recorded in a unified format in same a asynchronous task implementing result inventory, with default
Mode feeds back to related personnel.Logging modle 160 records the implementing result of asynchronous task and asynchronous task executes the reason of failing,
And the number that the asynchronous task executes failure is counted, it is finally recorded in a unified format clear with a asynchronous task implementing result
Dan Zhong feeds back to Software Development Engineer in such a way that display 13 is shown.Such as Bank of Communications's flight delay case executes mistake
It loses, then logging modle 160 records the title of the asynchronous task:Bank of Communications's flight delay case, failure cause (such as Bank of Communications
The type of service of flight delay case is not defined type of service in asynchronous task class) and execute the number of failure and add 1 (such as
Before this untreated subtask, the frequency of failure 2, then after handling this subtask, the frequency of failure 3).All asynchronous are handled
After business, its result is recorded in a unified format in a asynchronous task implementing result inventory, is shown with display 13
Mode feeds back to Software Development Engineer.The wherein described predetermined manner further includes the modes such as mail or short message.
Step S120, frequency of failure judgment module 170 judge whether the number of asynchronous task failure is more than preset value;If
The number of asynchronous task failure is more than preset value, thens follow the steps S130;If the number of asynchronous task failure is less than or waits
In preset value, S140 is thened follow the steps.It is pre- that frequency of failure judgment module 170 judges whether the number of asynchronous task failure is more than
If value;Assuming that the number of asynchronous task failure is more than preset value, S130 is thened follow the steps;Assuming that time of asynchronous task failure
Number is less than or equal to preset value, thens follow the steps S140.Such as frequency of failure judgment module 170 judges Bank of Communications's flight delay
The number of case processing failure is more than 20 times, thens follow the steps S130.
Step S130 is prompted if the number of asynchronous task failure is more than preset value:The asynchronous task frequency of failure is super
Preset value is crossed, the asynchronous task is no longer executed.Such as the number of Bank of Communications flight delay case processing failure is more than 20 times, then
Prompt:Bank of Communications's flight delay case frequency of failure is more than 20 times, no longer executes the task.
Step S140, if the number of asynchronous task failure is less than or equal to preset value, judgment module 150 is former to failure
Because being handled, and restarts and execute the asynchronous task.For example, the number of Bank of Communications's flight delay case processing failure is small
In or be equal to 20 times, then Software Development Engineer according in asynchronous task implementing result inventory asynchronous task failure cause add
Bank of Communications's flight delay case is simultaneously put into restarting in new task list and held by corresponding type of service or processing type
The row asynchronous task.
Compared to the first embodiment, method is uniformly processed in the asynchronous task that the present embodiment proposes, will add in the database
The script that the basic information of asynchronous task defines;Then be arranged in asynchronous task class all types of service, processing type and
The corresponding service logic of type is handled, while the configuration information of asynchronous task is set in exploitation code;Judge to walk by first
Suddenly, the second judgment step, third judgment step and the 4th judgment step make different asynchronous tasks in corresponding service logic
Middle processing, and count the frequency of failure and feed back the reason of asynchronous task fails, facilitate Software Development Engineer to be directed to failure cause
It solves the problems, such as, shortens the development time, improve working efficiency.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium
Include asynchronous task unified processing system 10, is realized when the asynchronous task unified processing system 10 is executed by processor as follows
Operation:
Database initialization step:The script that asynchronous task is generated according to the basic information of asynchronous task, which is added
It is added in database;
Code initialization step:The configuration information and asynchronous task class that asynchronous task is added in exploitation code, asynchronous
The type of service that asynchronous task is related to is added in task class, the processing type that each type of service is related to is set, and is each place
It manages type and corresponding service logic is set;
Receiving step:Asynchronous task is received from client, the asynchronous task received is stored according to chronological order
To task list;
Read step:The asynchronous task received earliest is read from task list;
First judgment step:Judge whether the type of service of the asynchronous task is defined industry in the asynchronous task class
Service type judges this asynchronous if the type of service of the asynchronous task is not defined type of service in asynchronous task class
The type of service of business is unknown type of service, prompts to execute failure, if the type of service of the asynchronous task is in asynchronous task class
Defined type of service then executes the second judgment step;And
Second judgment step:Judge whether the processing type of the asynchronous task is defined processing in the type of service
Type judges this asynchronous if the processing type of the asynchronous task is not defined processing type in the type of service
The processing type of business is unknown processing type, prompts to execute failure, if the processing type of the asynchronous task is the type of service
In defined processing type, then execute corresponding service logic.
Preferably, this method further includes:
Third judgment step:Judge whether corresponding service logic runs succeeded, if running succeeded, prompt execute at
Work(;Conversely, then prompting to execute failure.
Preferably, first judgment step further includes:
If the type of service of the asynchronous task read is not defined type of service in asynchronous task class, prompt this different
The type of service of step task is unknown type of service, and corresponding type of service is added in asynchronous task class.
Preferably, second judgment step further includes:
If the processing type of the asynchronous task read is not defined processing type in the type of service, prompting should
The processing type of asynchronous task is unknown processing type, and corresponding processing type is added in the type of service.
Preferably, this method further includes:
Recording step:The reason of recording the implementing result of each asynchronous task and executing failure, and count asynchronous task and hold
The number of row failure is recorded in a unified format in a asynchronous task implementing result inventory, is fed back to predetermined manner
Related personnel.
Preferably, this method further includes:
4th judgment step:Judge whether the number of asynchronous task failure is more than preset value;
If the number of asynchronous task failure is more than preset value, it is more than preset value to prompt the asynchronous task frequency of failure,
No longer execute the task;
If the number of asynchronous task failure is less than or equal to preset value, restarts and execute the asynchronous task.
Method is uniformly processed with above-mentioned asynchronous task in the specific implementation mode of the computer readable storage medium of the present invention
Specific implementation mode is roughly the same, and details are not described herein.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical scheme of the present invention substantially in other words does the prior art
Going out the part of contribution can be expressed in the form of software products, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions use so that a station terminal equipment (can be mobile phone,
Computer, server or network equipment etc.) execute method described in each embodiment of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (10)
1. method is uniformly processed in a kind of asynchronous task, which is characterized in that the method includes:
Database initialization step:The script that asynchronous task is generated according to the basic information of asynchronous task, which is added to
In database;
Code initialization step:The configuration information and asynchronous task class that asynchronous task is added in exploitation code, in asynchronous task
The type of service that asynchronous task is related to is added in class, the processing type that each type of service is related to is set, and is each processing class
Corresponding service logic is arranged in type;
Receiving step:From client receive asynchronous task, by the asynchronous task received according to chronological order store to appoint
Business list;
Read step:The asynchronous task received earliest is read from task list;
First judgment step:Judge whether the type of service of the asynchronous task is defined service class in the asynchronous task class
Type judges the asynchronous task if the type of service of the asynchronous task is not defined type of service in asynchronous task class
Type of service is unknown type of service, if the type of service of the asynchronous task is defined type of service in asynchronous task class,
Then execute the second judgment step;And
Second judgment step:Judge whether the processing type of the asynchronous task is defined processing class in the type of service
Type judges the asynchronous task if the processing type of the asynchronous task is not defined processing type in the type of service
Processing type be unknown processing type, if the processing type of the asynchronous task is defined processing class in the type of service
Type then executes corresponding service logic.
2. method is uniformly processed in asynchronous task according to claim 1, which is characterized in that this method further includes:
Third judgment step:Judge whether corresponding service logic runs succeeded, if running succeeded, prompts to run succeeded;Instead
It, then prompt to execute failure.
3. method is uniformly processed in asynchronous task according to claim 1, which is characterized in that first judgment step is also wrapped
It includes:
If the type of service of the asynchronous task read is not defined type of service in asynchronous task class, this asynchronous is prompted
The type of service of business is unknown type of service, and corresponding type of service is added in asynchronous task class.
4. method is uniformly processed in asynchronous task according to claim 1, which is characterized in that second judgment step is also wrapped
It includes:
If the processing type of the asynchronous task read is not defined processing type in the type of service, prompt this asynchronous
The processing type of task is unknown processing type, and corresponding processing type is added in the type of service.
5. method is uniformly processed in asynchronous task according to any one of claims 1 to 4, which is characterized in that this method is also wrapped
It includes:
Recording step:The reason of recording the implementing result of each asynchronous task and executing failure, and count asynchronous task and execute mistake
The number lost is recorded in a unified format in a asynchronous task implementing result inventory, feeds back to correlation with predetermined manner
Personnel.
6. method is uniformly processed in asynchronous task according to claim 1, which is characterized in that this method further includes:
4th judgment step:Judge whether the number of asynchronous task failure is more than preset value;
If the number of asynchronous task failure is more than preset value, it is more than preset value to prompt the asynchronous task frequency of failure, no longer
Execute the task;
If the number of asynchronous task failure is less than or equal to preset value, restarts and execute the asynchronous task.
7. a kind of electronic device, which is characterized in that described device includes:It memory, processor and is stored on the memory
And the asynchronous task unified processing system that can be run on the processor, the asynchronous task unified processing system is by the place
Device is managed to execute, it can be achieved that following steps:
Database initialization step:The script that asynchronous task is generated according to the basic information of asynchronous task, which is added to
In database;
Code initialization step:The configuration information and asynchronous task class that asynchronous task is added in exploitation code, in asynchronous task
The type of service that asynchronous task is related to is added in class, the processing type that each type of service is related to is set, and is each processing class
Corresponding service logic is arranged in type;
Receiving step:From client receive asynchronous task, by the asynchronous task received according to chronological order store to appoint
Business list;
Read step:The asynchronous task received earliest is read from task list;
First judgment step:Judge whether the type of service of the asynchronous task is defined service class in the asynchronous task class
Type judges the asynchronous task if the type of service of the asynchronous task is not defined type of service in asynchronous task class
Type of service is unknown type of service, if the type of service of the asynchronous task is defined type of service in asynchronous task class,
Then execute the second judgment step;And
Second judgment step:Judge whether the processing type of the asynchronous task is defined processing class in the type of service
Type judges the asynchronous task if the processing type of the asynchronous task is not defined processing type in the type of service
Processing type be unknown processing type, if the processing type of the asynchronous task is defined processing class in the type of service
Type then executes corresponding service logic.
8. electronic device according to claim 7, which is characterized in that first judgment step further includes:
If the type of service of the asynchronous task read is not defined type of service in asynchronous task class, this asynchronous is prompted
The type of service of business is unknown type of service, and corresponding type of service is added in asynchronous task class.
9. electronic device according to claim 7, which is characterized in that second judgment step further includes:
If the processing type of the asynchronous task read is not defined processing type in the type of service, prompt this asynchronous
The processing type of task is unknown processing type, and corresponding processing type is added in the type of service.
10. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium includes asynchronous task
Unified processing system, when the system asynchronous task unified processing system is executed by processor, it can be achieved that as in claim 1 to 6
The step of method is uniformly processed in any one asynchronous task.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710916221.7A CN108427599A (en) | 2017-09-30 | 2017-09-30 | Method, apparatus and storage medium is uniformly processed in asynchronous task |
PCT/CN2018/077672 WO2019062020A1 (en) | 2017-09-30 | 2018-02-28 | Asynchronous task unified processing method and apparatus, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710916221.7A CN108427599A (en) | 2017-09-30 | 2017-09-30 | Method, apparatus and storage medium is uniformly processed in asynchronous task |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108427599A true CN108427599A (en) | 2018-08-21 |
Family
ID=63155653
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710916221.7A Pending CN108427599A (en) | 2017-09-30 | 2017-09-30 | Method, apparatus and storage medium is uniformly processed in asynchronous task |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108427599A (en) |
WO (1) | WO2019062020A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109309712A (en) * | 2018-09-07 | 2019-02-05 | 平安科技(深圳)有限公司 | Data transmission method, server and the storage medium called based on interface asynchronous |
CN113011907A (en) * | 2020-12-18 | 2021-06-22 | 腾讯科技(深圳)有限公司 | Data processing method, device, storage medium and equipment |
CN116775314A (en) * | 2023-08-18 | 2023-09-19 | 国能日新科技股份有限公司 | Asynchronous processing method, device and equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8713571B2 (en) * | 2010-02-17 | 2014-04-29 | Microsoft Corporation | Asynchronous task execution |
CN105389209A (en) * | 2015-12-25 | 2016-03-09 | 中国建设银行股份有限公司 | Asynchronous batch task processing method and system |
CN105700937A (en) * | 2016-01-04 | 2016-06-22 | 北京百度网讯科技有限公司 | Multi-thread task processing method and device |
US20160188323A1 (en) * | 2011-07-13 | 2016-06-30 | Vmware, Inc. | System and method for customizing a deployment plan for a multi-tier application in a cloud infrastructure |
CN107135188A (en) * | 2016-02-29 | 2017-09-05 | 阿里巴巴集团控股有限公司 | The service implementation method of financial information exchange FIX agreements, apparatus and system |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8762448B2 (en) * | 2009-01-30 | 2014-06-24 | Oracle International Corporation | Implementing asynchronous processes on a mobile client |
CN106980546B (en) * | 2016-01-18 | 2021-08-27 | 阿里巴巴集团控股有限公司 | Task asynchronous execution method, device and system |
CN106293922A (en) * | 2016-08-16 | 2017-01-04 | 天津西瑞尔信息工程有限公司 | Asynchronous task processing method and system |
CN106648847A (en) * | 2016-10-14 | 2017-05-10 | 郑州云海信息技术有限公司 | Asynchronous task management method and device in cloud computing operation system |
-
2017
- 2017-09-30 CN CN201710916221.7A patent/CN108427599A/en active Pending
-
2018
- 2018-02-28 WO PCT/CN2018/077672 patent/WO2019062020A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8713571B2 (en) * | 2010-02-17 | 2014-04-29 | Microsoft Corporation | Asynchronous task execution |
US20160188323A1 (en) * | 2011-07-13 | 2016-06-30 | Vmware, Inc. | System and method for customizing a deployment plan for a multi-tier application in a cloud infrastructure |
CN105389209A (en) * | 2015-12-25 | 2016-03-09 | 中国建设银行股份有限公司 | Asynchronous batch task processing method and system |
CN105700937A (en) * | 2016-01-04 | 2016-06-22 | 北京百度网讯科技有限公司 | Multi-thread task processing method and device |
CN107135188A (en) * | 2016-02-29 | 2017-09-05 | 阿里巴巴集团控股有限公司 | The service implementation method of financial information exchange FIX agreements, apparatus and system |
Non-Patent Citations (1)
Title |
---|
MRH: "Android中AsyncTask异步任务使用详细实例", 《HTTPS://WWW.JB51.NET/ARTICLE/80231.HTML》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109309712A (en) * | 2018-09-07 | 2019-02-05 | 平安科技(深圳)有限公司 | Data transmission method, server and the storage medium called based on interface asynchronous |
CN109309712B (en) * | 2018-09-07 | 2022-06-17 | 平安科技(深圳)有限公司 | Data transmission method based on interface asynchronous call, server and storage medium |
CN113011907A (en) * | 2020-12-18 | 2021-06-22 | 腾讯科技(深圳)有限公司 | Data processing method, device, storage medium and equipment |
CN116775314A (en) * | 2023-08-18 | 2023-09-19 | 国能日新科技股份有限公司 | Asynchronous processing method, device and equipment |
Also Published As
Publication number | Publication date |
---|---|
WO2019062020A1 (en) | 2019-04-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11797877B2 (en) | Automated self-healing of a computing process | |
CN108446225A (en) | Creating device, method and the computer readable storage medium of analog interface | |
CN107577607A (en) | User interface automated testing method, device, electronic equipment, storage medium | |
CN111552633A (en) | Interface abnormal call testing method and device, computer equipment and storage medium | |
CN113791765B (en) | Resource arrangement method, device and equipment of cloud service and storage medium | |
CN111538659B (en) | Interface testing method, system, electronic equipment and storage medium of business scene | |
CN106874028A (en) | Using dispositions method and device | |
CN102572896A (en) | Upgrading method and upgrading device for wireless communication system | |
CN108427599A (en) | Method, apparatus and storage medium is uniformly processed in asynchronous task | |
CN113760730B (en) | Automatic test method and device | |
CN111651140B (en) | Service method and device based on workflow | |
CN114091914A (en) | Work order processing method and device | |
CN104580109A (en) | Method and device for generating click verification code | |
CN113918437A (en) | User behavior data analysis method and device, computer equipment and storage medium | |
CN117724803A (en) | Cloud service deployment method, device and platform | |
CN103942056B (en) | A kind of man-machine interaction method and device based on scene | |
CN107315576A (en) | A kind of method and system of dynamic expansion software flow | |
CN116661936A (en) | Page data processing method and device, computer equipment and storage medium | |
US20230132531A1 (en) | Software Development Project Infrastructure Builder Tool | |
CN114329128A (en) | Method and device for acquiring marking data, computer equipment and storage medium | |
CN113296913A (en) | Data processing method, device and equipment based on single cluster and storage medium | |
CN117135151B (en) | Fault detection method of GPU cluster, electronic equipment and storage medium | |
CN109284097A (en) | Realize method, equipment, system and the storage medium of complex data analysis | |
CN112597058B (en) | Webpage testing method, device, equipment and storage medium based on volume creation | |
CN101655945B (en) | Method and device for processing business record in business information management system |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180821 |
|
RJ01 | Rejection of invention patent application after publication |