CN113110898A - Transaction task execution method and device - Google Patents

Transaction task execution method and device Download PDF

Info

Publication number
CN113110898A
CN113110898A CN202110512396.8A CN202110512396A CN113110898A CN 113110898 A CN113110898 A CN 113110898A CN 202110512396 A CN202110512396 A CN 202110512396A CN 113110898 A CN113110898 A CN 113110898A
Authority
CN
China
Prior art keywords
task
transaction
thread
identifier
task identifier
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
CN202110512396.8A
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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202110512396.8A priority Critical patent/CN113110898A/en
Publication of CN113110898A publication Critical patent/CN113110898A/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
    • 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a transaction task execution method and device, and relates to the technical field of automatic programming. One embodiment of the method comprises: in response to an execution request of a transaction task, determining a thread for executing the transaction task; determining whether a task identifier of a transaction task is included in the thread; when the fact that the thread does not comprise the task identification is determined, generating a task identification corresponding to the transaction task in the thread; and executing the transaction task through the thread according to the task identification. The implementation mode enables the thread to have expandability and supports the identification of the user-defined task, thereby improving the flexibility of the thread when the task is executed and being more beneficial to the execution of the task.

Description

Transaction task execution method and device
Technical Field
The invention relates to the technical field of automatic programming, in particular to a transaction task execution method and device.
Background
The thread is the smallest unit of operation scheduling that the operating system can perform, is included in the process, and is the actual operation unit in the process. One thread is a single sequential control flow in a process, a plurality of threads can be operated in one process, and each thread executes different tasks in parallel.
However, due to poor expandability of the threads in the prior art, when a task with complex logic and long transaction lines is executed, the threads cannot freely set the identifiers corresponding to the task, so that the threads cannot flexibly deal with the task, and the task is not favorably executed.
Disclosure of Invention
In view of this, embodiments of the present invention provide a transaction task execution method and apparatus, which can determine a thread for executing a transaction task according to an execution request of the transaction task, generate a task identifier corresponding to the transaction task in the thread when the thread does not include the task identifier of the transaction task, and execute the transaction task through the thread according to the task identifier, so that the thread has extensibility, and supports the identifier of a user-defined task, thereby improving flexibility of the thread when executing the task, and facilitating execution of the task.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a transaction task execution method.
The transaction task execution method of the embodiment of the invention comprises the following steps:
in response to an execution request of a transaction task, determining a thread for executing the transaction task;
determining whether a task identifier of a transaction task is included in the thread;
when the fact that the thread does not comprise the task identification is determined, generating a task identification corresponding to the transaction task in the thread;
and executing the transaction task through the thread according to the task identification.
Alternatively,
determining whether a task identifier of a transaction task is included in a thread, including:
calling a thread extension packet, wherein the thread extension packet comprises a determination mode of a task identifier;
and determining whether the thread comprises a task identifier corresponding to the transaction task or not through a determination mode of the task identifier.
Alternatively,
determining whether the thread includes a task identifier corresponding to the transaction task by a task identifier determining mode, including:
running a determination method of the task identifier to obtain a return value;
when the format of the return value is wrong or the return value is empty, determining that the thread does not include a task identifier corresponding to the transaction task;
and when the format of the return value is correct and the return value is not null, determining that the thread comprises a task identifier corresponding to the transaction task.
Alternatively,
when the task identifier is determined not to be included in the thread, generating a task identifier corresponding to the transaction task in the thread, wherein the task identifier comprises the following steps:
and generating a task identifier corresponding to the transaction task in the thread by a task identifier determining mode.
Alternatively,
the thread extension packet also comprises any one or more of the following modes: a determination mode of a sub-transaction serial number corresponding to the task identifier, a first kind determination mode of the transaction task, and a replacement mode of the task identifier.
Alternatively,
when the transaction task comprises a plurality of sub-transaction tasks, generating a task identifier corresponding to the transaction task in the thread, wherein the task identifier comprises:
determining a second category of the plurality of sub-transaction tasks, respectively;
respectively generating subtask identifications corresponding to the plurality of subtask according to the second types of the plurality of subtask; the sub-transaction tasks of the same second kind correspond to the same sub-task identifiers, and the sub-transaction tasks of different second kinds correspond to different sub-task identifiers.
Alternatively,
when the transaction task includes a plurality of sub-transaction tasks of the same second type, the plurality of sub-transaction tasks of the same second type correspond to a plurality of different sub-transaction serial numbers respectively.
Alternatively,
the execution request comprises a first request message;
executing, by the thread, a transaction task, comprising:
establishing a switching area in the thread, and caching the first request message to the switching area;
determining a first category of transaction tasks;
when the first type of the transaction task is online transaction, generating a first interface calling request according to a first calling object indicated by a first request message cached in the switching area;
the first calling object is called through the first interface calling request so that the first calling object executes the transaction task.
Alternatively,
the switching area is also cached with preset second message information;
and when the first type of the transaction task is online transaction, generating a first interface calling request according to the first request message and the second message information cached in the switching area.
Alternatively,
when the first type of the transaction task is active transaction, generating a second interface calling request according to preset second message information cached in the switching area;
and calling the second calling object through the second interface calling request so that the second calling object executes the transaction task.
Alternatively,
the second message information includes any one or more of the following: organization number, task identification, sub-transaction serial number, service type, operator number, channel number, and channel code.
Alternatively,
the execution request also comprises public domain information;
executing, by the thread, a transaction task, comprising:
determining whether the content of the first request message and/or the public domain information is correct;
if not, the execution request is intercepted, and prompt information that the content of the first request message and/or the public domain information is wrong is returned.
Alternatively,
the execution request is intercepted by an interceptor.
Alternatively,
the interceptor is any one of the following: an AOP Interceptor, an Interceptor, or a Filter Interceptor.
Alternatively,
and managing the task identifier in the thread by using a thread local mode.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a transaction task performing apparatus.
The transaction task execution device comprises a response module, a task identifier determining module, a task identifier generating module and an execution module; wherein:
the response module is used for responding to the execution request of the transaction task and determining a thread for executing the transaction task;
the task identifier determining module is used for determining whether the thread comprises a task identifier of the transaction task;
the task identifier generation module is used for generating a task identifier corresponding to the transaction task in the thread when the task identifier is determined not to be included in the thread;
and the execution module is used for executing the transaction task through the thread according to the task identifier.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a transaction task execution electronic device.
The electronic device for executing the transaction task of the embodiment of the invention comprises: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the transaction task execution method of the embodiment of the invention.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable storage medium.
A computer-readable storage medium of an embodiment of the present invention stores thereon a computer program, and the program, when executed by a processor, implements a transaction task execution method of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: the thread for executing the transaction task can be determined according to the execution request of the transaction task, when the thread does not include the task identifier of the transaction task, the task identifier corresponding to the transaction task is generated in the thread, and then the transaction task is executed through the thread according to the task identifier, so that the thread has expandability, the identifier of the user-defined task is supported, the flexibility of the thread in the process of executing the task is improved, and the execution of the task is facilitated.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a transaction task execution method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of the main steps of a method for executing a transaction task by a thread according to an embodiment of the invention;
FIG. 3 is a schematic diagram of the major modules of a transaction task execution device according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments of the present invention and the technical features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram of main steps of a transaction task execution method according to an embodiment of the present invention.
As shown in fig. 1, a method for executing a transaction task according to an embodiment of the present invention mainly includes the following steps:
step S101: in response to a request for execution of a transaction task, a thread for executing the transaction task is determined.
In embodiments of the present invention, the first category of transaction tasks may be online transactions or active transactions. The execution request of the transaction task may include a first request message and/or public domain information, and the thread may include a switching area for caching the first request message and/or the public domain information.
Step S102: it is determined whether a task identification of the transaction task is included in the thread.
In the embodiment of the invention, whether the thread comprises the task identifier of the transaction task can be determined through the thread extension packet, wherein the thread extension packet comprises a determination mode of the task identifier. Specifically, the thread extension packet may be called, and whether the thread includes a task identifier corresponding to the transaction task is determined by a determination method of the task identifier in the thread extension packet.
In the embodiment of the invention, the task identifier is a global tracking number corresponding to the transaction task, and the global tracking number is the only identifier of a transaction in the whole execution process. In a preferred embodiment of the present invention, the task identifier in the thread can be managed by using a thread local manner.
In the embodiment of the present invention, in addition to the determination method of the task identifier, the thread extension packet further includes any one or more of the following methods: a determination mode of a sub-transaction serial number corresponding to the task identifier, a first kind determination mode of the transaction task, and a replacement mode of the task identifier.
In a preferred embodiment of the present invention, the task identifier encapsulated in the thread extension packet is determined in a getcurrentsysevtttraceid manner, the sub-transaction sequence numbers corresponding to the task identifiers are determined in getnextssyssndserialno, calcentsnsnsnsdserialno, getnextssndserialno, and calcenextsyssndserialno manners, the first type of the transaction task is determined in an isonnellall manner, and the alternative manner of the task identifier is a getnewsysevtttraceid manner.
Specifically, the parameters, the corresponding functions, and the cautions when using the above-mentioned method are shown in table 1:
Figure BDA0003060791500000081
TABLE 1
By means of the mode in the table 1, free setting and reading of the global tracking number and the sub-transaction serial number can be achieved, and a scene of switching between online transaction and active transaction for multiple times can be supported. Furthermore, a thread local mode can be used for managing the global tracking number and the sub-transaction serial number in the thread, and recording the switching condition of the global tracking number in each transaction.
In the embodiment of the present invention, the process of determining whether the thread includes the task identifier corresponding to the transaction task by using the determination manner of the task identifier may specifically include: running a determination method of the task identifier to obtain a return value; when the format of the return value is wrong or the return value is empty, determining that the thread does not include a task identifier corresponding to the transaction task; and when the format of the return value is correct and the return value is not null, determining that the thread comprises a task identifier corresponding to the transaction task.
In the embodiment of the invention, the thread extension packet can also comprise a self-defining mode of the global variables, and the global variables available in the thread can be set and acquired in the full life cycle of the thread through the self-defining mode so as to further increase the expandability and flexibility of the thread. The global variable may be stored in a global set of threads for use by developers at any time.
In a preferred embodiment of the present invention, the customization modes of the global variables encapsulated in the thread extension package may include a setglobalperpiperty mode, a getGlobalProperty mode, and an isglobalpropertyeist mode.
Specifically, the parameters and corresponding functions required for the above-described manner are shown in table 2:
(Mode) parameter(s) Function(s)
setGlobalPropetry String property;Object value Setting the value of a global variable
getGlobalProperty String property Obtaining the value of a global variable
isGlobalPropertyExist String property Determining whether a global variable exists
TABLE 2
Step S103: and when the task identifier is determined not to be included in the thread, generating a task identifier corresponding to the transaction task in the thread.
In the embodiment of the invention, when the task identifier is determined not to be included in the thread, the task identifier corresponding to the transaction task can be generated in the thread in a task identifier determining mode. As shown in table 1, as can be seen from the function of the getcurrentsysevtttraceid approach, the current global tracking number can be obtained by this method, and if the current global tracking number does not exist, a global tracking number can be newly generated.
In the embodiment of the present invention, when the transaction task includes a plurality of sub-transaction tasks, a process of generating a task identifier corresponding to the transaction task in a thread includes: determining a second category of the plurality of sub-transaction tasks, respectively; respectively generating subtask identifications corresponding to the plurality of subtask according to the second types of the plurality of subtask; the sub-transaction tasks of the same second kind correspond to the same sub-task identifiers, and the sub-transaction tasks of different second kinds correspond to different sub-task identifiers.
For example, when one transaction task includes both a sub-transaction task whose second kind is Transfer and a sub-transaction task whose second kind is query, a sub-task identifier Transfer may be generated for the Transfer sub-transaction task, and a sub-task identifier acquire may be generated for the query sub-transaction task. And the global tracking numbers corresponding to the transfer sub-transaction task and the inquiry sub-transaction task are the same to indicate that the transfer sub-transaction task and the inquiry sub-transaction task belong to the same transaction task.
In the embodiment of the present invention, when the transaction task includes a plurality of sub-transaction tasks of the same second type, the plurality of sub-transaction tasks of the same second type respectively correspond to a plurality of different sub-transaction serial numbers.
For example, when five Transfer sub-transaction tasks are included in one transaction task, the subtask identifications of the five Transfer sub-transaction tasks are Transfer, and the subtask serial numbers thereof are sequentially incremented and can be 00, 01, 02, 03 and 04. The scheme is not particularly limited as to the counting mode of the sub-transaction serial numbers.
Step S104: and executing the transaction task through the thread according to the task identification.
In the embodiment of the invention, when the thread executes other transaction tasks, after the transaction task to be executed is received, the thread can be switched to execute the received transaction task to be executed according to the global tracking number. And the thread can also switch for many times among different transaction tasks according to the global tracking number of each transaction task, so that the flexibility of the thread in executing the transaction tasks is improved.
In the embodiment of the present invention, the execution request may include a first request packet; a method for executing transaction tasks by threads is shown in fig. 2, and the method mainly includes the following steps:
step S201: establishing a switching area in the thread, and caching the first request message to the switching area;
step S202: determining a first category of transaction tasks;
step S203: when the first type of the transaction task is online transaction, generating a first interface calling request according to a first calling object indicated by a first request message cached in the switching area;
step S204: the first calling object is called through the first interface calling request so that the first calling object executes the transaction task.
In the embodiment of the present invention, the switching area may further cache preset second message information; when the first type of the transaction task is online transaction, a first interface calling request can be generated according to the first request message and the second message information cached in the exchange area, so that when the first message information is incomplete, the first interface calling request can be generated after the second message information is completed, and the efficiency of executing the transaction task by the thread is improved.
In the embodiment of the present invention, when the first type of the transaction task is an active transaction, it indicates that the transaction task is actively initiated by a system in which the thread is located, so that the execution request may not include the first message information. At this time, a second interface calling request can be generated according to the preset second message information cached in the switching area; and calling the second calling object through the second interface calling request so that the second calling object executes the transaction task.
In this embodiment of the present invention, the second packet information includes any one or more of the following contents: organization number, task identification, sub-transaction serial number, service type, operator number, channel number, and channel code.
The correspondence between the content and the attribute name in the second message information is shown in table 3:
Figure BDA0003060791500000111
Figure BDA0003060791500000121
TABLE 3
In the embodiment of the present invention, the developer may further manually set other contents included in the second packet information according to specific needs, so as to further increase the extensibility and flexibility of the thread.
In the embodiment of the present invention, the execution request may further include public domain information; a process for performing a transaction task by a thread, comprising: determining whether the content of the first request message and/or the public domain information is correct; if not, the execution request is intercepted, and prompt information that the content of the first request message and/or the public domain information is wrong is returned.
In the embodiment of the invention, the execution request can be intercepted through the interceptor.
In the embodiment of the present invention, the interceptor may also be configured to intercept an execution request that requires preprocessing of the first request packet and/or the public domain information. For example, when a transfer transaction task is performed, if the transfer transaction task is an online transaction and specified organization number and teller number are set in an execution request, the thread caches the specified organization number and teller number in the exchange area, and when a first interface call request is generated, the specified organization number and teller number are used instead of directly using a value pre-stored in public domain information of the exchange area; and after the first calling object is called, the thread restores the value pre-stored in the public domain information of the exchange area.
In the embodiment of the present invention, the interceptor is any one of: an AOP Interceptor, an Interceptor, or a Filter Interceptor.
According to the transaction task execution method, the thread for executing the transaction task can be determined according to the execution request of the transaction task, when the thread does not include the task identifier of the transaction task, the task identifier corresponding to the transaction task is generated in the thread, and then the transaction task is executed through the thread according to the task identifier, so that the thread has expandability, the identifier of the user-defined task is supported, the flexibility of the thread in executing the task is improved, and the execution of the task is facilitated.
Fig. 3 is a schematic diagram of main blocks of a transaction task performing device according to an embodiment of the present invention.
As shown in fig. 3, a transaction task execution device 300 according to an embodiment of the present invention includes a response module 301, a task identifier determination module 302, a task identifier generation module 303, and an execution module 304; wherein:
a response module 301, configured to determine, in response to a request for executing a transaction task, a thread for executing the transaction task;
a task identifier determining module 302, configured to determine whether a task identifier of a transaction task is included in a thread;
the task identifier generating module 303 is configured to generate a task identifier corresponding to the transaction task in the thread when it is determined that the thread does not include the task identifier;
and the execution module 304 is used for executing the transaction task through the thread according to the task identification.
In this embodiment of the present invention, the task identifier determining module 302 is further configured to: calling a thread extension packet, wherein the thread extension packet comprises a determination mode of a task identifier; and determining whether the thread comprises a task identifier corresponding to the transaction task or not through a determination mode of the task identifier.
In this embodiment of the present invention, the task identifier determining module 302 is further configured to: running a determination method of the task identifier to obtain a return value; when the format of the return value is wrong or the return value is empty, determining that the thread does not include a task identifier corresponding to the transaction task; and when the format of the return value is correct and the return value is not null, determining that the thread comprises a task identifier corresponding to the transaction task.
In this embodiment of the present invention, the task identifier generating module 303 is further configured to: and generating a task identifier corresponding to the transaction task in the thread by a task identifier determining mode.
In the embodiment of the present invention, the thread extension packet further includes any one or more of the following modes: a determination mode of a sub-transaction serial number corresponding to the task identifier, a first kind determination mode of the transaction task, and a replacement mode of the task identifier.
In this embodiment of the present invention, when the transaction task includes a plurality of sub-transaction tasks, the task identifier generating module 303 is further configured to: determining a second category of the plurality of sub-transaction tasks, respectively; respectively generating subtask identifications corresponding to the plurality of subtask according to the second types of the plurality of subtask; the sub-transaction tasks of the same second kind correspond to the same sub-task identifiers, and the sub-transaction tasks of different second kinds correspond to different sub-task identifiers.
In the embodiment of the present invention, when the transaction task includes a plurality of sub-transaction tasks of the same second type, the plurality of sub-transaction tasks of the same second type respectively correspond to a plurality of different sub-transaction serial numbers.
In the embodiment of the invention, the execution request comprises a first request message; the execution module 304 is further to: establishing a switching area in the thread, and caching the first request message to the switching area; determining a first category of transaction tasks; when the first type of the transaction task is online transaction, generating a first interface calling request according to a first calling object indicated by a first request message cached in the switching area; the first calling object is called through the first interface calling request so that the first calling object executes the transaction task.
In the embodiment of the invention, the switching area is also cached with preset second message information; the execution module 304 is further to: and when the first type of the transaction task is online transaction, generating a first interface calling request according to the first request message and the second message information cached in the switching area.
In an embodiment of the present invention, the execution module 304 is further configured to: when the first type of the transaction task is active transaction, generating a second interface calling request according to preset second message information cached in the switching area; and calling the second calling object through the second interface calling request so that the second calling object executes the transaction task.
In this embodiment of the present invention, the second packet information includes any one or more of the following contents: organization number, task identification, sub-transaction serial number, service type, operator number, channel number, and channel code.
In the embodiment of the invention, the execution request also comprises public domain information; the execution module 304 is further to: determining whether the content of the first request message and/or the public domain information is correct; if not, the execution request is intercepted, and prompt information that the content of the first request message and/or the public domain information is wrong is returned.
In an embodiment of the present invention, the execution module 304 is further configured to: the execution request is intercepted by an interceptor.
In the embodiment of the present invention, the interceptor is any one of: an AOP Interceptor, an Interceptor, or a Filter Interceptor.
In an embodiment of the present invention, the execution module 304 is further configured to: and managing the task identifier in the thread by using a thread local mode.
According to the transaction task execution device, the thread for executing the transaction task can be determined according to the execution request of the transaction task, when the thread does not include the task identifier of the transaction task, the task identifier corresponding to the transaction task is generated in the thread, and then the transaction task is executed through the thread according to the task identifier, so that the thread has expandability, the identifier of the user-defined task is supported, the flexibility of the thread in executing the task is improved, and the execution of the task is facilitated.
Fig. 4 illustrates an exemplary system architecture 400 of a transaction task execution method or a transaction task execution device to which embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and an electronic device 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the electronic device 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 401, 402, 403 to interact with an electronic device 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have various communication client applications installed thereon, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The electronic device 405 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 401, 402, and 403. The background management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (e.g., target push information and product information) to the terminal device.
It should be noted that, the electronic device 405 generally executes the transaction task execution method provided by the embodiment of the present invention, and accordingly, a transaction task execution device is generally disposed in the electronic device 405.
It should be understood that the number of terminal devices, networks, and electronic devices in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and electronic devices, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a response module, a task identity determination module, a task identity generation module, and an execution module. The names of these modules do not constitute a limitation to the module itself in some cases, and for example, a response module may also be described as a "module that determines a thread for executing a transaction task in response to an execution request of the transaction task".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: in response to an execution request of a transaction task, determining a thread for executing the transaction task; determining whether a task identifier of a transaction task is included in the thread; when the fact that the thread does not comprise the task identification is determined, generating a task identification corresponding to the transaction task in the thread; and executing the transaction task through the thread according to the task identification.
According to the technical scheme of the embodiment of the invention, the thread for executing the transaction task can be determined according to the execution request of the transaction task, when the thread does not comprise the task identifier of the transaction task, the task identifier corresponding to the transaction task is generated in the thread, and then the transaction task is executed through the thread according to the task identifier, so that the thread has expandability, the identifier of the user-defined task is supported, the flexibility of the thread in executing the task is improved, and the execution of the task is facilitated.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (18)

1. A transaction task execution method, comprising:
in response to an execution request of a transaction task, determining a thread for executing the transaction task;
determining whether a task identifier of the transaction task is included in the thread;
when the task identifier is determined not to be included in the thread, generating the task identifier corresponding to the transaction task in the thread;
and executing the transaction task through the thread according to the task identifier.
2. The method of claim 1, wherein determining whether a task identifier for the transaction task is included in the thread comprises:
calling a thread extension packet, wherein the thread extension packet comprises a determination mode of the task identifier;
and determining whether the thread comprises a task identifier corresponding to the transaction task or not through a determination mode of the task identifier.
3. The method according to claim 2, wherein the determining whether the thread includes the task identifier corresponding to the transaction task by the determination manner of the task identifier includes:
running the determination method of the task identifier to obtain a return value;
when the format of the return value is wrong or the return value is empty, determining that the thread does not include a task identifier corresponding to the transaction task;
and when the format of the return value is correct and the return value is not null, determining that the thread comprises a task identifier corresponding to the transaction task.
4. The method of claim 2, wherein when it is determined that the task identifier is not included in the thread, the generating a task identifier corresponding to the transaction task in the thread comprises:
and generating a task identifier corresponding to the transaction task in the thread by the determination mode of the task identifier.
5. The method of claim 2,
the thread extension packet further comprises any one or more of the following modes: the task identification comprises a determination mode of a sub-transaction serial number corresponding to the task identification, a first type determination mode of the transaction task and a replacement mode of the task identification.
6. The method of claim 1, wherein when a plurality of sub-transaction tasks are included in the transaction task, the generating the task identifier corresponding to the transaction task in the thread comprises:
determining a second category of the plurality of sub-transaction tasks, respectively;
respectively generating subtask identifications corresponding to the plurality of subtask according to the second types of the plurality of subtask; the sub-transaction tasks of the same second kind correspond to the same sub-task identifiers, and the sub-transaction tasks of different second kinds correspond to different sub-task identifiers.
7. The method of claim 6,
and when the transaction task comprises a plurality of sub transaction tasks of the same second type, the plurality of sub transaction tasks of the same second type respectively correspond to a plurality of different sub transaction serial numbers.
8. The method of claim 1, wherein the execution request includes a first request message;
the executing, by the thread, the transaction task includes:
establishing a switching area in the thread, and caching the first request message to the switching area;
determining a first category of the transaction task;
when the first type of the transaction task is online transaction, generating a first interface calling request according to a first calling object indicated by the first request message cached in the exchange area;
and calling the first calling object through the first interface calling request so as to enable the first calling object to execute the transaction task.
9. The method according to claim 8, wherein the switching area further caches preset second message information;
and when the first type of the transaction task is online transaction, generating the first interface calling request according to the first request message and the second message information cached in the exchange area.
10. The method of claim 9,
when the first type of the transaction task is active transaction, generating a second interface calling request according to the preset second message information cached in the exchange area;
and calling a second calling object through the second interface calling request so as to enable the second calling object to execute the transaction task.
11. The method of claim 9,
the second message information includes any one or more of the following contents: organization number, task identification, sub-transaction serial number, service type, operator number, channel number, and channel code.
12. The method of claim 8, wherein the execution request further includes public domain information;
the executing, by the thread, the transaction task includes:
determining whether the content of the first request message and/or the public domain information is correct;
if not, intercepting the execution request and returning prompt information that the content of the first request message and/or the public domain information is wrong.
13. The method of claim 12,
intercepting, by an interceptor, the execution request.
14. The method of claim 13,
the interceptor is any one of the following: an AOP Interceptor, an Interceptor, or a Filter Interceptor.
15. The method of any of claims 1-14, further comprising:
and managing the task identifier in the thread by using a thread local mode.
16. A transaction task execution device is characterized by comprising a response module, a task identifier determining module, a task identifier generating module and an execution module; wherein:
the response module is used for responding to an execution request of a transaction task and determining a thread for executing the transaction task;
the task identifier determining module is used for determining whether the thread comprises a task identifier of the transaction task;
the task identifier generating module is configured to generate the task identifier corresponding to the transaction task in the thread when it is determined that the thread does not include the task identifier;
and the execution module is used for executing the transaction task through the thread according to the task identifier.
17. A transaction task execution electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-15.
18. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-15.
CN202110512396.8A 2021-05-11 2021-05-11 Transaction task execution method and device Pending CN113110898A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110512396.8A CN113110898A (en) 2021-05-11 2021-05-11 Transaction task execution method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110512396.8A CN113110898A (en) 2021-05-11 2021-05-11 Transaction task execution method and device

Publications (1)

Publication Number Publication Date
CN113110898A true CN113110898A (en) 2021-07-13

Family

ID=76721699

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110512396.8A Pending CN113110898A (en) 2021-05-11 2021-05-11 Transaction task execution method and device

Country Status (1)

Country Link
CN (1) CN113110898A (en)

Similar Documents

Publication Publication Date Title
CN108920222B (en) Business processing method and device based on rule engine
CN110706093A (en) Accounting processing method and device
CN109901987B (en) Method and device for generating test data
CN111427701A (en) Workflow engine system and business processing method
CN111881392A (en) Page display method and device
CN111881329A (en) Account balance management method and system
CN111857888A (en) Transaction processing method and device
CN111478781B (en) Message broadcasting method and device
CN111460129A (en) Method and device for generating identification, electronic equipment and storage medium
CN111831461A (en) Method and device for processing business process
CN118312076A (en) Map icon processing method and device, electronic equipment and computer readable medium
CN112948138A (en) Method and device for processing message
CN111382953A (en) Dynamic process generation method and device
CN112685481A (en) Data processing method and device
CN112817799B (en) Method and device for accessing multiple data sources based on Spring framework
CN114756173A (en) Method, system, device and computer readable medium for file merging
CN113110898A (en) Transaction task execution method and device
CN113726885A (en) Method and device for adjusting flow quota
CN113656295A (en) Automatic generation method and device of test data, electronic equipment and storage medium
CN113779122A (en) Method and apparatus for exporting data
CN113760487A (en) Service processing method and device
CN113741888A (en) Service processing method and device
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN113762835A (en) Method and device for processing order data
CN113448652A (en) Request processing method and device

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