CN111026465A - Program processing method, program processing device, electronic device, and storage medium - Google Patents

Program processing method, program processing device, electronic device, and storage medium Download PDF

Info

Publication number
CN111026465A
CN111026465A CN201911122650.2A CN201911122650A CN111026465A CN 111026465 A CN111026465 A CN 111026465A CN 201911122650 A CN201911122650 A CN 201911122650A CN 111026465 A CN111026465 A CN 111026465A
Authority
CN
China
Prior art keywords
program
subprogram
target
locking
idempotent operation
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.)
Withdrawn
Application number
CN201911122650.2A
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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201911122650.2A priority Critical patent/CN111026465A/en
Publication of CN111026465A publication Critical patent/CN111026465A/en
Withdrawn 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the disclosure provides a program processing method and device, an electronic device and a storage medium. The method comprises the following steps: acquiring a target subprogram which needs to be subjected to idempotent operation in a program to be operated according to a note added in advance in the program to be operated; generating a locking request corresponding to a parameter used by the target subprogram when performing idempotent operation; sending the locking request to a server; and after a locking success result returned by the server is received, executing idempotent operation on the target subprogram according to the parameters. The embodiment of the disclosure can avoid repeated submission of requests caused by concurrent write operations, and usually requires performing idempotent verification, so as to ensure uniqueness of resources, further reduce asset loss, and improve user experience.

Description

Program processing method, program processing device, electronic device, and storage medium
Technical Field
Embodiments of the present disclosure relate to the field of communications technologies, and in particular, to a program processing method and apparatus, an electronic device, and a storage medium.
Background
Idempotent is a mathematical and computer concept, and is usually found in abstract algebra, and when a certain element is operated as idempotent, its action will be the same after any element is acted twice as its result.
An idempotent operation in programming is characterized by the same effect of any number of executions as one. An idempotent function, or idempotent method, refers to a function that can be repeatedly performed using the same parameters and achieve the same result. These functions do not affect the system state and there is no concern that repeated execution may cause multiple changes to the system.
When the interface of idempotent operation is called, the situation that repeated attempts exist when the calling interface is abnormal may exist, and the loss which cannot be borne by the system is caused, for example, an order creating interface is called overtime for the first time, then a caller retries once, when the order is created, inventory needs to be deducted, at the moment, the interface is overtime, the caller retries once, when the order starts to pay, after a payment request is sent, the operation of fee deduction occurs at a server, the interface response is overtime, the caller retries once, the interface is updated by an order state, and the caller continuously sends two messages, one is a created message and the other is a paid message. However, after receiving the paid message and then receiving the created message, a short message needs to be sent after the payment completion order is received, and the processing is slow after one machine receives the message sent by the short message. The message middleware delivers the message to another machine for processing, so that the property loss can be caused, and the user experience is very poor.
Disclosure of Invention
Embodiments of the present disclosure provide a program processing method and apparatus, an electronic device, and a storage medium, so as to reduce asset loss and improve user experience.
According to a first aspect of embodiments of the present disclosure, there is provided a program processing method including:
acquiring a target subprogram which needs to be subjected to idempotent operation in a program to be operated according to a note added in advance in the program to be operated;
generating a locking request corresponding to a parameter used by the target subprogram when performing idempotent operation;
sending the locking request to a server;
and after a locking success result returned by the server is received, executing idempotent operation on the target subprogram according to the parameters.
Optionally, before the obtaining, according to the annotation added in advance in the program to be run, a target subroutine that needs to perform an idempotent operation in the program to be run, the method further includes:
acquiring at least one subprogram which needs to be subjected to idempotent operation in the program to be operated; the target subprogram is one subprogram in the at least one subprogram;
and calling a preset annotation packet to add annotation to the at least one subprogram so as to mark parameters used by the at least one subprogram when performing idempotent operation.
Optionally, the obtaining, according to the annotation added in advance in the program to be run, a target subprogram that needs to perform idempotent operation in the program to be run includes:
and in the running process of the program to be run, acquiring one subprogram in the at least one subprogram intercepted by the annotation processor, and taking the intercepted one subprogram as the target subprogram.
Optionally, the annotation includes a specified locking mode, and the generating of the locking request corresponding to the parameter used by the target subroutine when performing the idempotent operation includes:
acquiring parameters and the specified locking mode used by the target subprogram when performing idempotent operation according to an analysis result of the annotation of the target subprogram by the annotation processor;
and generating the locking request according to the parameters and the specified locking mode.
Optionally, the sending the locking request to a server includes:
and sending the locking request to the server so that the server performs locking processing on the parameters in the specified locking mode and generates a locking result.
According to a second aspect of the embodiments of the present disclosure, there is provided a program processing apparatus including:
the target program acquisition module is used for acquiring a target subprogram which needs to be subjected to idempotent operation in the program to be operated according to the annotation which is added in advance in the program to be operated;
the locking request generating module is used for generating a locking request corresponding to a parameter used by the target subprogram when performing idempotent operation;
the locking request sending module is used for sending the locking request to a server;
and the idempotent operation execution module is used for executing idempotent operation on the target subprogram according to the parameters after receiving a locking success result returned by the server.
Optionally, the method further comprises:
the subprogram acquisition module is used for acquiring at least one subprogram which needs to be subjected to idempotent operation in the program to be operated; the target subprogram is one subprogram in the at least one subprogram;
and the program annotation adding module is used for calling a preset annotation packet to add annotation to the at least one subprogram so as to mark parameters used by the at least one subprogram when performing idempotent operation.
Optionally, the object program obtaining module includes:
and the target program acquisition sub-module is used for acquiring one sub program of the at least one sub program intercepted by the annotation processor in the running process of the program to be run, and taking the intercepted one sub program as the target sub program.
Optionally, the annotation includes a specified locking manner, and the locking request generating module includes:
the idempotent parameter acquisition sub-module is used for acquiring parameters used by the target subprogram when performing idempotent operation and the specified locking mode according to an analysis result of the annotation of the target subprogram by the annotation processor;
and the locking request generating submodule is used for generating the locking request according to the parameters and the specified locking mode.
Optionally, the locking request sending module includes:
and the locking request sending submodule is used for sending the locking request to the server so that the server performs locking processing on the parameters in the specified locking mode and generates a locking result.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the program processing method of any one of the above when executing the program.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having instructions that, when executed by a processor of an electronic device, enable the electronic device to perform any one of the program processing methods described above.
The embodiment of the disclosure provides a program processing scheme, which includes acquiring a target subprogram which needs to perform idempotent operation in a program to be run according to a note added in advance in the program to be run, generating a locking request corresponding to a parameter used by the target subprogram when the idempotent operation is performed, sending the locking request to a server, and after a successful locking result returned by the server is received, performing the idempotent operation on the target subprogram according to the parameter. The method and the device for locking the parameters of executing the idempotent operation can lock the parameters of executing the idempotent operation in advance, can avoid repeated submission of requests caused by concurrent write operations, and generally need to carry out idempotent verification, so that the uniqueness of resources is ensured, further, the asset loss can be reduced, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments of the present disclosure will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart illustrating steps of a program processing method according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating steps of a program processing method according to a second embodiment of the disclosure;
fig. 3 is a schematic structural diagram of a program processing apparatus according to a third embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a program processing apparatus according to a fourth embodiment of the disclosure;
fig. 5 is a schematic diagram of an object program obtaining module according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a locking request generation module according to an embodiment of the present disclosure;
fig. 7 is a schematic diagram of a locking request sending module according to an embodiment of the present disclosure.
Detailed Description
Technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present disclosure, belong to the protection scope of the embodiments of the present disclosure.
Referring to fig. 1, a flowchart illustrating steps of a program processing method according to a first embodiment of the present disclosure is shown, and as shown in fig. 1, the program processing method may specifically include the following steps:
step 101: and acquiring a target subprogram which needs to be subjected to idempotent operation in the program to be run according to the annotation added in advance in the program to be run.
In the embodiments of the present disclosure, the idempotent operation refers to an operation that is repeatedly performed using the same parameters and can obtain the same result.
The timing of performing idempotent operations can be divided into the following cases:
1. the interface may be repeatedly invoked;
2. the message is repeatedly sent;
3. the jobs are executed concurrently;
4. the data is processed concurrently;
5. and (4) performing targeted judgment according to the service scene, and benefiting the related services (payment, settlement and the like).
The program to be run refers to a program which is sent to a service line for use after the client encapsulates and packages the program to be run.
The target subprogram is a subprogram which needs to perform idempotent operation in the program to be run, such as a subprogram for payment and settlement, a program for resending data after the data is sent out again by a user after time-out, and the like, namely the target subprogram is a function in the program to be run, or a subprogram for realizing a certain detail, and the like.
It is to be understood that the above examples are only examples set forth for a better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitations on the embodiments of the present disclosure.
Annotations refer to interpretations indicating that a target subroutine requires performing idempotent operations.
In this disclosure, an annotation processor may be set on the service line in advance, and the sub-program added with the annotation in the program to be run may be identified and obtained through the annotation processor. .
Of course, the method is not limited to this, in a specific implementation, a target sub program that needs to be idempotent operated in a program to be run may also be obtained in other manners, and specifically, the method may be determined according to a business requirement, and the embodiment of the present disclosure does not limit this.
After the target subprogram which needs to be subjected to the idempotent operation in the program to be run is obtained according to the annotation added in advance in the program to be run, step 102 is executed.
Step 102: and generating a locking request corresponding to the parameters used by the target subprogram when performing idempotent operation.
The locking request is a request for locking a parameter used when the target subroutine performs an idempotent operation.
After acquiring the target subprogram which needs to be subjected to the idempotent operation, parameters used by the target subprogram for performing the idempotent operation can be acquired, and a locking request corresponding to the parameters can be generated, for example, the parameters used by the target subprogram for performing the idempotent operation are as follows: name, mobile, mail, address, score, etc. parameters, and a lock request for these parameters may then be generated.
It is to be understood that the above examples are only examples set forth for a better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitations on the embodiments of the present disclosure.
After generating a locking request corresponding to the parameter used by the target subroutine when performing idempotent operations, step 103 is performed.
Step 103: and sending the locking request to a server.
The method for locking the parameters used by the target subprogram in the idempotent operation is executed on the server side, and after the locking request corresponding to the parameters used by the target subprogram in the idempotent operation is generated, the locking request can be sent to the server.
After sending the locking request to the server, step 104 is performed.
Step 104: and after a locking success result returned by the server is received, executing idempotent operation on the target subprogram according to the parameters.
The result of successful locking refers to the result of successful locking of the parameters used by the server for performing idempotent operation on the target subprogram.
After the server receives the locking request, the server can perform locking processing on the parameters used by the target subprogram when performing idempotent operation according to the locking request, generate a corresponding locking result, and return the locking result to the client. For example, after the server fails to lock the parameter, a result of the locking failure may be returned to the terminal; and after the server successfully locks the parameters, the result of successful locking can be returned to the terminal.
After a result that the parameter locking success of the target subprogram, which is returned by the server and performs the idempotent operation on the target subprogram, is received, the idempotent operation on the target subprogram can be performed according to the parameter, and in the process of performing the idempotent operation on the parameter, the parameters can be guaranteed to be only performed once at the same time, the idempotent operation is not performed after the parameter is successfully performed once, the concurrent execution of the parameter can be avoided, the repeated submission of a request caused by the concurrent writing operation is avoided, the idempotent verification is usually required to be performed, the uniqueness of resources is guaranteed, further, the asset loss can be reduced, and the user experience is improved.
According to the program processing method provided by the embodiment of the disclosure, a target subprogram which needs to be subjected to idempotent operation in a program to be operated is obtained according to a note added in advance in the program to be operated, a locking request corresponding to a parameter used by the target subprogram when the idempotent operation is performed is generated, the locking request is sent to a server, and after a successful locking result returned by the server is received, the idempotent operation is executed on the target subprogram according to the parameter. The method and the device for locking the parameters of executing the idempotent operation can lock the parameters of executing the idempotent operation in advance, can avoid repeated submission of requests caused by concurrent write operations, and generally need to carry out idempotent verification, so that the uniqueness of resources is ensured, further, the asset loss can be reduced, and the user experience is improved.
Referring to fig. 2, a flowchart illustrating steps of a program processing method provided in the second embodiment of the present disclosure is shown, and as shown in fig. 2, the program processing method may specifically include the following steps:
step 201: and acquiring at least one sub program which needs to be subjected to idempotent operation in the program to be operated.
In the embodiment of the present disclosure, the to-be-run program refers to a program that is sent to a service line for use after a client encapsulates and packages a program that needs to be run.
The subprogram is a program which needs to be subjected to idempotent operation in the program to be run. For example, the program to be run is composed of a function a, a function B and a function C, and the function a needs to be subjected to the idempotent operation, the program corresponding to the function a is taken as a subroutine that needs to be subjected to the idempotent operation.
Idempotent operations refer to operations that are repeatedly performed using the same parameters and can achieve the same results.
The timing of performing idempotent operations can be divided into the following cases:
1. the interface may be repeatedly invoked;
2. the message is repeatedly sent;
3. the jobs are executed concurrently;
4. the data is processed concurrently;
5. and (4) performing targeted judgment according to the service scene, and benefiting the related services (payment, settlement and the like).
By the method, business personnel can determine which subprograms in the program to be run need to execute the idempotent operation in advance, and which subprograms do not need to execute the idempotent operation.
The target subroutine mentioned in the following step is one of at least one subroutine.
After acquiring at least one sub-program needing idempotent operation in the program to be run, step 202 is executed.
Step 202: and calling a preset annotation packet to add annotation to the at least one subprogram so as to mark parameters used by the at least one subprogram when performing idempotent operation.
After at least one sub-program which needs to be subjected to idempotent operation in the program to be run is obtained, a business person can add annotation to the at least one sub-program in advance, and the annotation can be used for indicating that the sub-program needs to be subjected to idempotent operation. Specifically, the annotation mode and the annotation processor defined in the jar packet may be interpreted according to a preset annotation packet, such as a jar packet in the client, and the annotation may be made to the subprogram according to the jar packet. After the sub-programs are annotated, the annotation may indicate information such as parameters used by at least one of the sub-programs in performing the idempotent operation.
After adding the annotation to the at least one subroutine, step 203 is performed.
Step 203: and in the running process of the program to be run, acquiring one subprogram in the at least one subprogram intercepted by the annotation processor, and taking the intercepted one subprogram as the target subprogram.
The target subprogram is a subprogram which needs to perform idempotent operation in the program to be run, such as a subprogram for payment and settlement, a program for resending data after the data is sent out again by a user after time-out, and the like, namely the target subprogram is a function in the program to be run, or a subprogram for realizing a certain detail, and the like.
It is to be understood that the above examples are only examples set forth for a better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitations on the embodiments of the present disclosure.
After adding an annotation to at least one subprogram in the program to be run, the subprogram with the annotation added can be intercepted by the annotation processor, and it can be understood that each subprogram is executed one by one, and one subprogram intercepted by the annotation processor first is the target subprogram defined in the present disclosure.
After the target subroutine is acquired, step 204 is performed.
Step 204: and acquiring parameters and the specified locking mode used by the target subprogram when performing idempotent operation according to the analysis result of the annotation of the target subprogram by the annotation processor.
The specified locking mode refers to a mode of locking parameters used when the target subprogram is subjected to idempotent operation, which is preset by a service staff, for example, a token can be preset at the terminal, the token is used to guarantee idempotent, the validity period and validity of the token are set by the server, so that the idempotent operation is performed on the target subprogram within the validity period of the terminal, and when the token exceeds the validity period or is illegal, the idempotent operation is not performed on the target subprogram. When the locking mode is a distributed lock, the lock can be acquired in a preHandle (interceptor), and if the lock is acquired successfully, the method is executed, and the lock is released in a postHandle (releaser) after the execution is finished.
It is to be understood that the above examples are only examples set forth for a better understanding of the technical solutions of the embodiments of the present disclosure, and are not to be taken as the only limitations on the embodiments of the present disclosure.
The annotation also contains the designated locking mode which is added in advance by the business personnel.
When a target subprogram which needs to perform an idempotent operation in a program to be run is obtained, an annotation processor may analyze an annotation added to the target subprogram, so as to obtain parameters and a specified locking mode used when the target subprogram performs the idempotent operation according to an analysis result, where for example, the parameters used when the target subprogram performs the idempotent operation are as follows: name, mobile, mail, address, score, etc.
After obtaining the parameters used by the target subroutine in performing the idempotent operation and specifying the locking mode, step 205 is performed.
Step 205: and generating the locking request according to the parameters and the specified locking mode.
After the parameters and the specified locking mode used by the target subprogram in the idempotent operation are acquired, the locking request can be generated by combining the parameters and the specified locking mode used by the target subprogram in the idempotent operation.
After the locking request is generated, step 206 is performed.
Step 206: and sending the locking request to the server so that the server performs locking processing on the parameters in the specified locking mode and generates a locking result.
The process of locking the parameters used by the target subprogram in the idempotent operation is executed on the server side, and after the parameters used by the target subprogram in the idempotent operation and the locking request corresponding to the specified locking mode are generated, the locking request can be sent to the server.
After receiving the locking request, the server may perform locking processing on the parameter used by the target subprogram when performing idempotent operation according to the specified locking manner included in the locking request.
After the server locks the parameters used by the idempotent operation of the target subprogram, the locking result can be returned to the terminal, for example, after the server fails to lock the parameters, the locking result can be returned to the terminal; and after the server successfully locks the parameters, the result of successful locking can be returned to the terminal.
After sending the locking request to the server, step 207 is performed.
Step 207: and after a locking success result returned by the server is received, executing idempotent operation on the target subprogram according to the parameters.
The result of successful locking refers to the result of successful locking of the parameters used by the server for performing idempotent operation on the to-be-processed program.
After a successful locking result returned by the server is received, the idempotent operation can be executed on the target subprogram according to the locking parameters, and in the process of executing the idempotent operation on the target subprogram, because the parameters of the idempotent operation executed by the target subprogram are locked, the parameters can be ensured to be executed only once, and the concurrent execution of the parameters can be avoided.
According to the program processing method provided by the embodiment of the disclosure, a target subprogram which needs to be subjected to idempotent operation in a program to be operated is obtained according to a note added in advance in the program to be operated, a locking request corresponding to a parameter used by the target subprogram when the idempotent operation is performed is generated, the locking request is sent to a server, and after a successful locking result returned by the server is received, the idempotent operation is executed on the target subprogram according to the parameter. The method and the device for locking the parameters of executing the idempotent operation can lock the parameters of executing the idempotent operation in advance, can avoid repeated submission of requests caused by concurrent write operations, and generally need to carry out idempotent verification, so that the uniqueness of resources is ensured, further, the asset loss can be reduced, and the user experience is improved.
Referring to fig. 3, a schematic structural diagram of a program processing apparatus provided in a third embodiment of the present disclosure is shown, and as shown in fig. 3, the program processing apparatus may specifically include the following modules:
the target program obtaining module 310 is configured to obtain a target subprogram, which needs to perform idempotent operations, in a program to be run, according to a comment added in advance in the program to be run;
a locking request generating module 320, configured to generate a locking request corresponding to a parameter used by the target subroutine when performing idempotent operation;
a locking request sending module 330, configured to send the locking request to a server;
and the idempotent operation executing module 340 is configured to, after receiving a result of successful locking returned by the server, execute idempotent operation on the target subprogram according to the parameter.
According to the program processing device provided by the embodiment of the disclosure, a target subprogram which needs to be subjected to idempotent operation in a program to be operated is obtained according to a note added in advance in the program to be operated, a locking request corresponding to a parameter used by the target subprogram when the idempotent operation is performed is generated, the locking request is sent to a server, and after a successful locking result returned by the server is received, the idempotent operation is executed on the target subprogram according to the parameter. The method and the device for locking the parameters of executing the idempotent operation can lock the parameters of executing the idempotent operation in advance, can avoid repeated submission of requests caused by concurrent write operations, and generally need to carry out idempotent verification, so that the uniqueness of resources is ensured, further, the asset loss can be reduced, and the user experience is improved.
Referring to fig. 4, a schematic structural diagram of a program processing apparatus according to a fourth embodiment of the present disclosure is shown, and as shown in fig. 4, the program processing apparatus may specifically include the following modules:
a subprogram obtaining module 410, configured to obtain at least one subprogram that needs to perform idempotent operations in the program to be run; the target subprogram is one subprogram in the at least one subprogram;
a program annotation adding module 420, configured to call a preset annotation packet to add an annotation to the at least one subprogram, so as to mark a parameter used when performing an idempotent operation on the at least one subprogram;
the target program obtaining module 430 is configured to obtain a target subprogram that needs to perform idempotent operations in the program to be run, according to a comment added in advance in the program to be run;
a locking request generating module 440, configured to generate a locking request corresponding to a parameter used by the target subprogram when performing idempotent operation;
a locking request sending module 450, configured to send the locking request to a server;
and an idempotent operation executing module 460, configured to, after receiving a result that locking is successful, which is returned by the server, execute an idempotent operation on the target subprogram according to the parameter.
Optionally, as shown in fig. 5, the object program obtaining module 430 includes:
the target program obtaining sub-module 431 is configured to obtain, during the running process of the program to be run, one of the at least one sub-program intercepted by the annotation processor, and use the intercepted one sub-program as the target sub-program.
Optionally, the annotation includes a specified locking manner, as shown in fig. 6, the locking request generating module 440 includes:
the idempotent parameter obtaining sub-module 441 is used for obtaining parameters used by the target subprogram when performing idempotent operation and the specified unlocking mode according to the analysis result of the annotation of the target subprogram by the annotation processor;
the locking request generating sub-module 442 is configured to generate the locking request according to the parameter and the specified locking manner.
Optionally, as shown in fig. 7, the locking request sending module 450 includes:
and the locking request sending submodule 451 is configured to send the locking request to the server, so that the server performs locking processing on the parameter in the specified locking manner, and generates a locking result.
According to the program processing device provided by the embodiment of the disclosure, a target subprogram which needs to be subjected to idempotent operation in a program to be operated is obtained according to a note added in advance in the program to be operated, a locking request corresponding to a parameter used by the target subprogram when the idempotent operation is performed is generated, the locking request is sent to a server, and after a successful locking result returned by the server is received, the idempotent operation is executed on the target subprogram according to the parameter. The method and the device for locking the parameters of executing the idempotent operation can lock the parameters of executing the idempotent operation in advance, can avoid repeated submission of requests caused by concurrent write operations, and generally need to carry out idempotent verification, so that the uniqueness of resources is ensured, further, the asset loss can be reduced, and the user experience is improved.
An embodiment of the present disclosure also provides an electronic device, including: a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the program processing method of the foregoing embodiments when executing the program.
Embodiments of the present disclosure also provide a computer-readable storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the program processing method of the foregoing embodiments.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present disclosure are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the embodiments of the present disclosure as described herein, and any descriptions of specific languages are provided above to disclose the best modes of the embodiments of the present disclosure.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the disclosure, various features of the embodiments of the disclosure are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that is, claimed embodiments of the disclosure require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of an embodiment of this disclosure.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
The various component embodiments of the disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be understood by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a motion picture generating device according to an embodiment of the present disclosure. Embodiments of the present disclosure may also be implemented as an apparatus or device program for performing a portion or all of the methods described herein. Such programs implementing embodiments of the present disclosure may be stored on a computer readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit embodiments of the disclosure, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the disclosure may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present disclosure and is not to be construed as limiting the embodiments of the present disclosure, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the embodiments of the present disclosure are intended to be included within the scope of the embodiments of the present disclosure.
The above description is only a specific implementation of the embodiments of the present disclosure, but the scope of the embodiments of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present disclosure, and all the changes or substitutions should be covered by the scope of the embodiments of the present disclosure. Therefore, the protection scope of the embodiments of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A program processing method characterized by comprising:
acquiring a target subprogram which needs to be subjected to idempotent operation in a program to be operated according to a note added in advance in the program to be operated;
generating a locking request corresponding to a parameter used by the target subprogram when performing idempotent operation;
sending the locking request to a server;
and after a locking success result returned by the server is received, executing idempotent operation on the target subprogram according to the parameters.
2. The method according to claim 1, before the obtaining, according to the annotation added in advance in the program to be run, a target sub-program that needs to be subjected to idempotent operation in the program to be run, further comprising:
acquiring at least one subprogram which needs to be subjected to idempotent operation in the program to be operated; the target subprogram is one subprogram in the at least one subprogram;
and calling a preset annotation packet to add annotation to the at least one subprogram so as to mark parameters used by the at least one subprogram when performing idempotent operation.
3. The method according to claim 1, wherein the obtaining of the target subprogram which needs to be subjected to idempotent operation in the program to be run according to the annotation added in advance in the program to be run comprises:
and in the running process of the program to be run, acquiring one subprogram in the at least one subprogram intercepted by the annotation processor, and taking the intercepted one subprogram as the target subprogram.
4. The method according to claim 3, wherein the annotation includes a specified locking mode, and the generating of the locking request corresponding to the parameter used by the target subroutine in performing the idempotent operation includes:
acquiring parameters and the specified locking mode used by the target subprogram when performing idempotent operation according to an analysis result of the annotation of the target subprogram by the annotation processor;
and generating the locking request according to the parameters and the specified locking mode.
5. The method of claim 4, wherein sending the locking request to a server comprises:
and sending the locking request to the server so that the server performs locking processing on the parameters in the specified locking mode and generates a locking result.
6. A program processing apparatus characterized by comprising:
the target program acquisition module is used for acquiring a target subprogram which needs to be subjected to idempotent operation in the program to be operated according to the annotation which is added in advance in the program to be operated;
the locking request generating module is used for generating a locking request corresponding to a parameter used by the target subprogram when performing idempotent operation;
the locking request sending module is used for sending the locking request to a server;
and the idempotent operation execution module is used for executing idempotent operation on the target subprogram according to the parameters after receiving a locking success result returned by the server.
7. The apparatus of claim 6, further comprising:
the subprogram acquisition module is used for acquiring at least one subprogram which needs to be subjected to idempotent operation in the program to be operated; the target subprogram is one subprogram in the at least one subprogram;
and the program annotation adding module is used for calling a preset annotation packet to add annotation to the at least one subprogram so as to mark parameters used by the at least one subprogram when performing idempotent operation.
8. The apparatus of claim 6, wherein the object program acquisition module comprises:
and the target program acquisition sub-module is used for acquiring one sub program of the at least one sub program intercepted by the annotation processor in the running process of the program to be run, and taking the intercepted one sub program as the target sub program.
9. An electronic device, comprising:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the program processing method of any one of claims 1 to 5 when executing the program.
10. A computer-readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the program processing method of any one of claims 1 to 5.
CN201911122650.2A 2019-11-15 2019-11-15 Program processing method, program processing device, electronic device, and storage medium Withdrawn CN111026465A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911122650.2A CN111026465A (en) 2019-11-15 2019-11-15 Program processing method, program processing device, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911122650.2A CN111026465A (en) 2019-11-15 2019-11-15 Program processing method, program processing device, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
CN111026465A true CN111026465A (en) 2020-04-17

Family

ID=70200257

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911122650.2A Withdrawn CN111026465A (en) 2019-11-15 2019-11-15 Program processing method, program processing device, electronic device, and storage medium

Country Status (1)

Country Link
CN (1) CN111026465A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113064584A (en) * 2021-04-22 2021-07-02 中国平安财产保险股份有限公司 Idempotent realizing method, device, equipment and medium
CN113778389A (en) * 2020-09-23 2021-12-10 北京沃东天骏信息技术有限公司 Interface idempotent judging method, device, equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040117453A1 (en) * 2002-12-17 2004-06-17 International Business Machines Corporation Client/server request handling
US20120117423A1 (en) * 2010-11-09 2012-05-10 International Business Machines Corporation Fault tolerance in distributed systems
CN105740258A (en) * 2014-12-09 2016-07-06 阿里巴巴集团控股有限公司 Business processing method and device based on power equal sign check
CN106033439A (en) * 2015-03-13 2016-10-19 阿里巴巴集团控股有限公司 Method and system for processing distributed transaction
US20180131678A1 (en) * 2016-11-10 2018-05-10 International Business Machines Corporation Managing Idempotent Operations while Interacting with a System of Record
US10031948B1 (en) * 2013-12-02 2018-07-24 Amazon Technologies, Inc. Idempotence service
CN108459913A (en) * 2017-12-26 2018-08-28 阿里巴巴集团控股有限公司 data parallel processing method, device and server
CN108563693A (en) * 2018-03-16 2018-09-21 阿里巴巴集团控股有限公司 A kind of processing method of affairs, device and equipment
CN108874654A (en) * 2017-05-15 2018-11-23 阿里巴巴集团控股有限公司 Idempotent validity test method, device and equipment, readable medium
CN110097330A (en) * 2019-03-27 2019-08-06 深圳市佰仟金融服务有限公司 A kind of service request processing method, device and computer readable storage medium
CN110162532A (en) * 2019-05-09 2019-08-23 中国银行股份有限公司 Transaction data processing method and equipment

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040117453A1 (en) * 2002-12-17 2004-06-17 International Business Machines Corporation Client/server request handling
US20120117423A1 (en) * 2010-11-09 2012-05-10 International Business Machines Corporation Fault tolerance in distributed systems
US10031948B1 (en) * 2013-12-02 2018-07-24 Amazon Technologies, Inc. Idempotence service
CN105740258A (en) * 2014-12-09 2016-07-06 阿里巴巴集团控股有限公司 Business processing method and device based on power equal sign check
CN106033439A (en) * 2015-03-13 2016-10-19 阿里巴巴集团控股有限公司 Method and system for processing distributed transaction
US20180131678A1 (en) * 2016-11-10 2018-05-10 International Business Machines Corporation Managing Idempotent Operations while Interacting with a System of Record
CN108874654A (en) * 2017-05-15 2018-11-23 阿里巴巴集团控股有限公司 Idempotent validity test method, device and equipment, readable medium
CN108459913A (en) * 2017-12-26 2018-08-28 阿里巴巴集团控股有限公司 data parallel processing method, device and server
CN108563693A (en) * 2018-03-16 2018-09-21 阿里巴巴集团控股有限公司 A kind of processing method of affairs, device and equipment
CN110097330A (en) * 2019-03-27 2019-08-06 深圳市佰仟金融服务有限公司 A kind of service request processing method, device and computer readable storage medium
CN110162532A (en) * 2019-05-09 2019-08-23 中国银行股份有限公司 Transaction data processing method and equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778389A (en) * 2020-09-23 2021-12-10 北京沃东天骏信息技术有限公司 Interface idempotent judging method, device, equipment and storage medium
CN113064584A (en) * 2021-04-22 2021-07-02 中国平安财产保险股份有限公司 Idempotent realizing method, device, equipment and medium
CN113064584B (en) * 2021-04-22 2024-05-07 中国平安财产保险股份有限公司 Idempotent implementation method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN107766101B (en) Method, device and equipment for processing App starting event
CN107426711B (en) Method, device and system for binding or unbinding mobile phone number
TWI679550B (en) Account login method and device
CN110400217B (en) Rule change processing method and device for intelligent contract
CN110276202B (en) Method and device for detecting reverse-serialization loopholes
CN111026465A (en) Program processing method, program processing device, electronic device, and storage medium
CN104219235A (en) Distributed transaction requesting method and device
TWI771616B (en) Payment anti-shake method and device
US8380788B2 (en) System and method for providing user context support in a native transaction platform
CN113225379A (en) Method and device for sending HTTP request message
CN109067746B (en) Communication method and device between client and server
CN108475220B (en) System and method for integrating a transactional middleware platform with a centralized audit framework
CN110704131B (en) Method and device for calling native application by HTML5 application
CN109408251B (en) Message sending method and device and message receiving processing method and device
CN106612263B (en) Method and equipment for processing application access request
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
CN111626606A (en) Business rule processing method, device, equipment, system and storage medium
CN116502283A (en) Privacy data processing method and device
CN110677465B (en) Control method and device of distributed lock
CN111695901B (en) Accounting document processing method, device, equipment and storage medium
CN109510816B (en) Service request validity verification method, client and server
CN112579960A (en) Webpage evidence obtaining method, webpage evidence obtaining device and server
CN111611507A (en) Modularization-based in-application page jump method and computing device
CN113138862A (en) Message processing method, server, device, system and storage medium
CN111273897A (en) Block chain resource consumption method and device, storage medium and electronic equipment

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20200417