A JAVA application pre-embedded needle system and method
By introducing the pre-embedded needle system in JAVA applications, real-time observation and dynamic modification of application variables, as well as the acquisition and statistics of business data are realized, which solves the problem of difficulty in real-time observation and adjustment of running applications in the existing technology. Provides a highly scalable and adaptable solution.
Patent Information
- Application Number
- CN202211397611.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-09
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-11-09
AI Technical Summary
The existing technology makes it difficult to observe and dynamically adjust variables and business data in the application in real time while the application is running, and it is impossible to obtain or manipulate data in the running application from the outside.
A JAVA application pre-embedded needle system is designed, including an interface communication module, a data observation module, a business volume statistics module and a data manipulation module. Through these modules, real-time observation and dynamic modification of application variables, as well as the acquisition and acquisition of business data are realized. statistics.
It realizes external real-time observation and dynamic modification of variables in the application, as well as the acquisition and statistics of business data. It has strong scalability and is suitable for Java applications in different industries and development frameworks.
Smart Images

Figure CN115599379B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer technology, and in particular relates to a JAVA application pre-embedded needle system and method. Background Art
[0002] After the application is developed, its operation logic is basically solidified through the processes of compilation, packaging, and release. Therefore, it is usually difficult to observe and dynamically adjust the running application in real time during the operation of the application. Specifically:
[0003] 1. Observe the current value of a variable (usually a static variable in Java) or obtain business volume data from the outside of the running application. The current solution to this requirement is to output log information in the source code in advance during the development phase. If you forget to output logs during the development phase or need to observe certain data temporarily during operation, the existing method cannot meet the needs.
[0004] 2. Manipulate the original data value of the running application from the outside. For example, when the application is running, it is found that a certain variable (usually a static variable in Java) needs to be temporarily adjusted to manipulate a certain flag bit so that the application can perform processing such as cleaning up garbage data, changing the judgment condition, switching the program execution branch, triggering specific logic processing, etc. However, this requirement cannot be met for the normally running application at present. Summary of the invention
[0005] The present invention provides a JAVA application pre-embedded needle system and method, which can realize the functions that variables in the application can be observed in real time from the outside, dynamically modified, and business data can be obtained from the outside.
[0006] In a first aspect, a JAVA application pre-embedded needle system is provided, wherein the JAVA application pre-embedded needle system is embedded in an application, and comprises:
[0007] Interface communication module: used to set up access interfaces for external interaction;
[0008] Data observation module: used to receive data acquisition requests, obtain the corresponding variables to be obtained according to the data acquisition requests, read the current value of the variables to be obtained, and return the current value;
[0009] Business volume statistics module: used to record the business processing volume data of the application; receive business volume acquisition requests, read the corresponding business data according to the business volume acquisition requests, perform statistics on the read business data to obtain business volume data, and return the business volume data;
[0010] Data manipulation module: used to receive data manipulation requests, obtain the corresponding variables to be manipulated and new values according to the data manipulation requests, and set the values of the variables to be manipulated to new values.
[0011] Furthermore, the data observation module is specifically used for:
[0012] Parse the data acquisition request to obtain the access user information, the name of the variable to be acquired, and the Java class name to which the variable to be acquired belongs;
[0013] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be obtained belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be obtained, and the current value of the variable is read;
[0014] Construct a data return message according to the name of the variable to be obtained, the name of the Java class to which the variable to be obtained belongs, and the current value;
[0015] Return data return message.
[0016] Furthermore, the business data includes the receiving time, transaction code, processing result and time consumption of each business request;
[0017] The business volume statistics module is specifically used for:
[0018] When receiving a business request, record the receiving time, transaction code and processing result of the business request;
[0019] When the business request is processed, the processing result and time consumed of the business request are updated.
[0020] Furthermore, the business volume data includes ongoing business volume, processed business volume, average time consumption and success rate;
[0021] The business volume statistics module is specifically used for:
[0022] Parse the business volume acquisition request to obtain the access user information, statistical time range, and statistical transaction code;
[0023] When the access user information verification is passed, the business data whose receiving time meets the statistical time range and whose transaction code is consistent with the statistical transaction code is read from the business data;
[0024] Among the business data read, the statistical processing result is the number of ongoing business data, which is defined as the ongoing business volume; the statistical processing result is the number of non-ongoing business data, which is defined as the processed business volume; the reading processing result is the time consumption of all non-ongoing business data, and the average calculation is performed on all the time consumption to obtain the average time consumption; the statistical processing result is the number of successful business data, which is defined as the successful business volume, and the statistical processing result is the number of failed business data, which is defined as the failed business volume, and the success rate is calculated based on the successful business volume and the failed business volume;
[0025] Construct business return messages based on the ongoing business volume, processed business volume, average time consumption, and success rate;
[0026] Return service return message.
[0027] Furthermore, the data manipulation module is specifically used for:
[0028] Parse the data manipulation request to obtain the access user information, the name of the variable to be manipulated, the Java class name to which the variable to be manipulated belongs, and the new value;
[0029] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be manipulated belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be manipulated, and the value of the variable to be manipulated is set to a new value;
[0030] Construct an operation return message according to the name of the variable to be manipulated, the name of the Java class to which the variable to be manipulated belongs, and the new value;
[0031] The return operation returns a message.
[0032] In a second aspect, a JAVA application pre-embedded needle method is performed in an application, comprising:
[0033] Receive a data acquisition request, obtain the corresponding variable to be obtained according to the data acquisition request, read the current value of the variable to be obtained, and return the current value;
[0034] Record the business data of the application;
[0035] Receive a business volume acquisition request, read corresponding business data according to the business volume acquisition request, perform statistics on the read business data to obtain business volume data, and return the business volume data;
[0036] Receive a data manipulation request, obtain the corresponding variable to be manipulated and the new value according to the data manipulation request, and set the value of the variable to be manipulated to the new value.
[0037] Further, obtaining the corresponding variable to be obtained according to the data acquisition request, reading the current value of the variable to be obtained, and returning the current value specifically include:
[0038] Parse the data acquisition request to obtain the access user information, the name of the variable to be acquired, and the Java class name to which the variable to be acquired belongs;
[0039] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be obtained belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be obtained, and the current value of the variable is read;
[0040] Construct a data return message according to the name of the variable to be obtained, the name of the Java class to which the variable to be obtained belongs, and the current value;
[0041] Return data return message.
[0042] Furthermore, the business data includes the receiving time, transaction code, processing result and time consumption of each business request;
[0043] The business data of the recorded application includes:
[0044] When receiving a business request, record the receiving time, transaction code and processing result of the business request;
[0045] When the business request is processed, the processing result and time consumed of the business request are updated.
[0046] Furthermore, the business volume data includes the ongoing business volume, the processed business volume, the average time consumption and the success rate;
[0047] Read the corresponding business data according to the business volume acquisition request, and the returned business data specifically includes:
[0048] Parse the business volume acquisition request to obtain the access user information, statistical time range, and statistical transaction code;
[0049] When the access user information verification is passed, the business data whose receiving time meets the statistical time range and whose transaction code is consistent with the statistical transaction code is read from the business data;
[0050] Among the business data read, the statistical processing result is the number of ongoing business data, which is defined as the ongoing business volume; the statistical processing result is the number of non-ongoing business data, which is defined as the processed business volume; the reading processing result is the time consumption of all non-ongoing business data, and the average calculation is performed on all the time consumption to obtain the average time consumption; the statistical processing result is the number of successful business data, which is defined as the successful business volume, and the statistical processing result is the number of failed business data, which is defined as the failed business volume, and the success rate is calculated based on the successful business volume and the failed business volume;
[0051] Construct business return messages based on the ongoing business volume, processed business volume, average time consumption, and success rate;
[0052] Return service return message.
[0053] Further, obtaining the corresponding variable to be manipulated and the new value according to the data manipulation request, and setting the value of the variable to be manipulated as the new value specifically includes:
[0054] Parse the data manipulation request to obtain the access user information, the name of the variable to be manipulated, the Java class name to which the variable to be manipulated belongs, and the new value;
[0055] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be manipulated belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be manipulated, and the value of the variable to be manipulated is set to a new value;
[0056] Construct an operation return message according to the name of the variable to be manipulated, the name of the Java class to which the variable to be manipulated belongs, and the new value;
[0057] The return operation returns a message.
[0058] It can be seen from the above technical solutions that the JAVA application pre-embedded needle method and system provided by the present invention realizes the function that variables in the application can be observed from the outside, dynamically modified, and the business volume data can be obtained from the outside through a universal public mechanism. The JAVA application pre-embedded needle system has strong scalability and can expand and customize more functions as needed, enriching the prefabrication capability. The JAVA application pre-embedded needle system has wide adaptability and can be used in Java applications of different industries and different development frameworks. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.
[0060] Figure 1 A module block diagram of a JAVA application pre-embedded needle system provided in an embodiment.
[0061] Figure 2 A flowchart of a JAVA application pre-embedded needle method provided in an embodiment. DETAILED DESCRIPTION
[0062] The embodiments of the technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and are therefore only used as examples, and the protection scope of the present invention cannot be limited thereto. It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should be the common meanings understood by those skilled in the art to which the present invention belongs.
[0063] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0064] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0065] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0066] Example:
[0067] A JAVA application pre-embedded needle system, see Figure 1 , the JAVA application pre-embedded needle system is embedded in the application, including:
[0068] Interface communication module 1: used to set up access interfaces for interaction with the outside world;
[0069] Data observation module 2: used to receive a data acquisition request, obtain the corresponding variable to be obtained according to the data acquisition request, read the current value of the variable to be obtained, and return the current value;
[0070] Business volume statistics module 3: used to record the business data of the application; receive a business volume acquisition request, read the corresponding business data according to the business volume acquisition request, perform statistics on the read business data to obtain business volume data, and return the business volume data;
[0071] Data manipulation module 4: used for receiving a data manipulation request, obtaining the corresponding variable to be manipulated and the new value according to the data manipulation request, and setting the value of the variable to be manipulated as the new value.
[0072] In this embodiment, the JAVA application pre-embedded needle system draws on the concept of indwelling needles in medical diagnosis and clinical practice, and builds a JAVA application pre-embedded needle system in the application. The JAVA application pre-embedded needle system can be an EmbeddedNeedle component, which serves as a basic component for all services in the system.
[0073] In the present embodiment, in order to be able to observe or manipulate the running application from the outside, the application needs to expose the access interface to the outside, so the interface communication module 1 is mainly used to provide the access interface to the outside. The interface communication module 1 also stipulates the interface specification, which includes two aspects: the communication protocol and the message format. Among them, the communication protocol can adopt the Socket protocol, the HTTP protocol, the HTTPS protocol, etc. Since the HTTP protocol is more mainstream and there are more HTTP client tools, the communication protocol usually selects the HTTP protocol. When using the HTTP protocol, the client can use the curl tool. In order to facilitate manual observation or manipulation of data from the outside, the content of the message format can be a plain text readable text (including numbers, letters, readable symbols), and the message format can select a fixed-length format, a delimiter format, an XML format, a JSON format, etc. Considering that JSON is more mainstream and simple, the message format can be preferably a JSON format.
[0074] In this embodiment, the data observation module 2 mainly realizes the data observation function, which is used to obtain the values of various variables in the application. The traffic statistics module 3 includes two functions: real-time recording of business data and business statistics. For example, the traffic statistics module 3 can timely understand the processing volume of the application, the current in-transit traffic volume, the processing time and other indicators from the outside, so as to judge the busyness of the application. The traffic data can be used as a source of monitoring data, and can also be used as a basis for upper-level traffic distribution or traffic switching. The data manipulation module 4 can realize the modification of various static variable values in the JAVA application, such as manipulating a certain flag bit, so that the application performs operations such as cleaning up garbage data, changing the judgment condition, switching the program execution branch, and triggering specific logic processing.
[0075] The JAVA application pre-embedded needle system uses a common public mechanism to realize the functions that variables in the application can be observed from the outside, dynamically modified, and the business volume data can be obtained from the outside. The JAVA application pre-embedded needle system has strong scalability and can be expanded and customized with more functions as needed, enriching the prefabrication capabilities. The JAVA application pre-embedded needle system has wide adaptability and can be used in Java applications in different industries and different development frameworks.
[0076] Furthermore, in some embodiments, the data observation module 2 is specifically used for:
[0077] Parse the data acquisition request to obtain the access user information, the name of the variable to be acquired, and the Java class name to which the variable to be acquired belongs;
[0078] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be obtained belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be obtained, and the current value of the variable is read;
[0079] Construct a data return message according to the name of the variable to be obtained, the name of the Java class to which the variable to be obtained belongs, and the current value;
[0080] Return data return message.
[0081] In this embodiment, the data acquisition request is mainly used to request the current value of a variable in the application. When the user wants to observe data from the outside, a client tool (such as curl or developed management tool software) is used to issue a data acquisition request for the specified variable. The data acquisition request can be defined in the following JSON message format:
[0082]
[0083]
[0084] The data observation module 2 receives the above-mentioned JSON message through the interface communication module 1, parses the JSON message, reads the value of the operateType item as "GetJavaVarValue (representing the current value of the variable obtained)", then performs data observation, and verifies the authorizedUserName (i.e. the user name in the access user information) and the authorizedInfo (i.e. the authorization verification information in the access user information). If the verification is passed, the subsequent operation is performed to prevent the JAVA application pre-embedded needle system from being illegally accessed and used. From the JSON message, read the ClassFullName (i.e. the Java class name to which the variable to be obtained belongs) value, the class name can use a fully qualified name, so that a Java class can be uniquely determined, for example, the fully qualified name of a Java class is "com.yykj.config.SomeClassName", and "SomeClassName" is a concise class name. Then, through Java's Reflect reflection mechanism, find the class object corresponding to ClassFullName from the currently running Java application. In this class object, the variable specified by VarName (namely, the name of the variable to be obtained) is found through Java's Reflect reflection mechanism, the current value of the variable is obtained, and the current value of the variable is returned in toString mode. For example, the data return message can be defined in the following JSON message format:
[0085]
[0086]
[0087] Further, in some embodiments, the business data includes the reception time, transaction code, processing result and time consumption of each business request;
[0088] The traffic statistics module 3 is specifically used for:
[0089] When receiving a business request, record the receiving time, transaction code and processing result of the business request;
[0090] When the business request is processed, the processing result and time consumed of the business request are updated.
[0091] In this embodiment, each time the Java application receives a business request, it records the receiving time, transaction code, and processing result of the business request. When the business request is processed, the processing result and time of the business request are updated. For example, the following two-dimensional table is recorded:
[0092]
[0093] In the processing result, S indicates success, F indicates failure, and 0 indicates in progress. Java applications can store the above two-dimensional table through arrays or other collection objects. Java applications can directly store business data in memory to speed up reading and writing. In order to avoid business data occupying too much memory, only the records of the last N minutes (for example, 5 minutes) can be saved, and business data older than N minutes can be discarded.
[0094] Further, in some embodiments, the business volume data includes ongoing business volume, processed business volume, average time consumption and success rate;
[0095] The traffic statistics module 3 is specifically used for:
[0096] Parse the business volume acquisition request to obtain the access user information, statistical time range, and statistical transaction code;
[0097] When the access user information verification is passed, the business data whose receiving time meets the statistical time range and whose transaction code is consistent with the statistical transaction code is read from the business data;
[0098] Among the business data read, the statistical processing result is the number of ongoing business data, which is defined as the ongoing business volume; the statistical processing result is the number of non-ongoing business data, which is defined as the processed business volume; the reading processing result is the time consumption of all non-ongoing business data, and the average calculation is performed on all the time consumption to obtain the average time consumption; the statistical processing result is the number of successful business data, which is defined as the successful business volume, and the statistical processing result is the number of failed business data, which is defined as the failed business volume, and the success rate is calculated based on the successful business volume and the failed business volume;
[0099] Construct business return messages based on the ongoing business volume, processed business volume, average time consumption, and success rate;
[0100] Return service return message.
[0101] In this embodiment, the traffic acquisition request is mainly used to request the traffic data in the application. When the user wants to learn about the traffic statistics from the outside, the client tool (such as curl or developed management tool software) is used to issue a traffic acquisition request. The traffic acquisition request can be defined in the following JSON message format:
[0102]
[0103] The data observation module 2 receives the above JSON message through the interface communication module 1, parses the JSON message, reads the value of the operateType item as "GetBusinessStatistic (indicating the acquisition of business volume)", then performs data observation and verifies the authorizedUserName and authorizedInfo. Only if the verification is passed will the subsequent operation be performed. Read the values of the lastSeconds (i.e., statistical time range) and businessCode (i.e., statistical transaction code) fields from the JSON message, and find the business data within the lastSeconds seconds range and consistent with the statistical transaction code from the recorded business data.
[0104] Then count the business data found. The number of business data whose processing results are O (ongoing business data) is defined as the ongoing business volume, and is filled in the onGoing field of the business return message. The number of business data whose processing results are non-0 (successful and failed business data) is defined as the processed business volume, and is filled in the volume field of the business return message. Read the time consumed for all business data whose processing results are not in progress, perform the mean calculation on all the time consumption to obtain the average time consumption, and fill it in the avgElapsedTime field of the business return message. The number of business data whose processing results are successful is defined as the successful business volume, as the numerator; the number of business data whose processing results are failed is defined as the failed business volume, and the sum of the successful business volume and the failed business volume is used as the denominator. The numerator is divided by the denominator, and the ratio obtained is the success rate, which is filled in the successRate field of the business return message. The business return message can be defined in the following JSON message format:
[0105]
[0106] Furthermore, in some embodiments, the data manipulation module 4 is specifically used for:
[0107] Parse the data manipulation request to obtain the access user information, the name of the variable to be manipulated, the Java class name to which the variable to be manipulated belongs, and the new value;
[0108] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be manipulated belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be manipulated, and the value of the variable to be manipulated is set to a new value;
[0109] Construct an operation return message according to the name of the variable to be manipulated, the name of the Java class to which the variable to be manipulated belongs, and the new value;
[0110] The return operation returns a message.
[0111] In some embodiments, the data manipulation request is mainly used to request to manipulate or modify the value of a variable in the application. When the user wants to manipulate data from the outside, the data manipulation request is issued using a client tool (such as curl or developed management tool software). The data manipulation request can be defined in the following JSON message format:
[0112]
[0113] The data observation module 2 receives the above-mentioned JSON message through the interface communication module 1, parses the JSON message, reads the value of the operateType item as "SetJavaVarValue (representing the manipulated variable)", then performs data observation and verifies authorizedUserName and authorizedInfo. Subsequent operations are performed only if the verification is passed. From the JSON message, read the value of ClassFullName (that is, the Java class name to which the variable to be manipulated belongs). Through the Reflect reflection mechanism in Java, find the class object corresponding to ClassFullName from the currently running Java application. In the class object, find the variable specified by VarName (that is, the name of the variable to be manipulated) through the Reflect reflection mechanism in Java, and set the variable to the value of the newValue (that is, the new value) field in the JSON message. The operation return message can be defined in the following JSON message format:
[0114]
[0115] A JAVA application pre-embedded needle method, the JAVA application pre-embedded needle method is executed in the application, see Figure 2 ,include:
[0116] S1: Receive a data acquisition request, obtain the corresponding variable to be obtained according to the data acquisition request, read the current value of the variable to be obtained, and return the current value;
[0117] S2: records the business data of the application;
[0118] S3: receiving a business volume acquisition request, reading corresponding business data according to the business volume acquisition request, performing statistics on the read business data to obtain business volume data, and returning the business volume data;
[0119] S4: receiving a data manipulation request, obtaining the corresponding variable to be manipulated and the new value according to the data manipulation request, and setting the value of the variable to be manipulated as the new value.
[0120] Further, obtaining the corresponding variable to be obtained according to the data acquisition request, reading the current value of the variable to be obtained, and returning the current value specifically include:
[0121] Parse the data acquisition request to obtain the access user information, the name of the variable to be acquired, and the Java class name to which the variable to be acquired belongs;
[0122] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be obtained belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be obtained, and the current value of the variable is read;
[0123] Construct a data return message according to the name of the variable to be obtained, the name of the Java class to which the variable to be obtained belongs, and the current value;
[0124] Return data return message.
[0125] Furthermore, the business data includes the receiving time, transaction code, processing result and time consumption of each business request;
[0126] The business data of the recorded application includes:
[0127] When receiving a business request, record the receiving time, transaction code and processing result of the business request;
[0128] When the business request is processed, the processing result and time consumed of the business request are updated.
[0129] Furthermore, the business volume data includes the ongoing business volume, the processed business volume, the average time consumption and the success rate;
[0130] Read the corresponding business data according to the business volume acquisition request, and the returned business data specifically includes:
[0131] Parse the business volume acquisition request to obtain the access user information, statistical time range, and statistical transaction code;
[0132] When the access user information verification is passed, the business data whose receiving time meets the statistical time range and whose transaction code is consistent with the statistical transaction code is read from the business data;
[0133] Among the business data read, the statistical processing result is the number of ongoing business data, which is defined as the ongoing business volume; the statistical processing result is the number of non-ongoing business data, which is defined as the processed business volume; the reading processing result is the time consumption of all non-ongoing business data, and the average calculation is performed on all the time consumption to obtain the average time consumption; the statistical processing result is the number of successful business data, which is defined as the successful business volume, and the statistical processing result is the number of failed business data, which is defined as the failed business volume, and the success rate is calculated based on the successful business volume and the failed business volume;
[0134] Construct business return messages based on the ongoing business volume, processed business volume, average time consumption, and success rate;
[0135] Return service return message.
[0136] Further, obtaining the corresponding variable to be manipulated and the new value according to the data manipulation request, and setting the value of the variable to be manipulated as the new value specifically includes:
[0137] Parse the data manipulation request to obtain the access user information, the name of the variable to be manipulated, the Java class name to which the variable to be manipulated belongs, and the new value;
[0138] When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be manipulated belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be manipulated, and the value of the variable to be manipulated is set to a new value;
[0139] Construct an operation return message according to the name of the variable to be manipulated, the name of the Java class to which the variable to be manipulated belongs, and the new value;
[0140] The return operation returns a message.
[0141] The method provided in the embodiment of the present invention is briefly described. For matters not mentioned in the embodiment part, reference can be made to the corresponding contents in the aforementioned embodiment.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.
Claims
1. A JAVA application pre-embedded needle system, It is characterized in that The JAVA application pre-embedded needle system is embedded in the application, and the JAVA application pre-embedded needle system is an EmbeddedNeedle component; it includes: Interface communication module: used to set up access interfaces for external interaction; Data observation module: used for receiving a data acquisition request, acquiring the corresponding variable to be acquired according to the data acquisition request, reading the current value of the variable to be acquired, and returning the current value; Business volume statistics module: used to record the business data of the application; receive a business volume acquisition request, read the corresponding business data according to the business volume acquisition request, perform statistics on the read business data to obtain business volume data, and return the business volume data; Data manipulation module: used for receiving a data manipulation request, obtaining a corresponding variable to be manipulated and a new value according to the data manipulation request, and setting the value of the variable to be manipulated to the new value; The business data includes the receiving time, transaction code, processing result and time consumption of each business request; The business volume statistics module is specifically used for: When receiving the service request, recording the receiving time, transaction code and processing result of the service request; When the service request is processed, the processing result and time consumption of the service request are updated; The business volume data includes ongoing business volume, processed business volume, average time consumption and success rate; The business volume statistics module is specifically used for: Parsing the business volume acquisition request to obtain access user information, statistical time range, and statistical transaction code; When the access user information verification is passed, the business data whose receiving time meets the statistical time range and whose transaction code is consistent with the statistical transaction code is read from the business data; Among the business data read, the statistical processing result is the number of ongoing business data, which is defined as the ongoing business volume; the statistical processing result is the number of non-ongoing business data, which is defined as the processed business volume; the reading processing result is the time consumption of all non-ongoing business data, and the mean operation is performed on all the time consumptions to obtain the average time consumption; the statistical processing result is the number of successful business data, which is defined as the successful business volume, and the statistical processing result is the number of failed business data, which is defined as the failed business volume, and the success rate is calculated according to the successful business volume and the failed business volume; Constructing a service return message according to the ongoing service volume, the processed service volume, the average time consumption, and the success rate; Return the service return message.
2. According to the JAVA application pre-embedded needle system of claim 1, It is characterized in that The data observation module is specifically used for: Parsing the data acquisition request to obtain access user information, the name of the variable to be acquired, and the Java class name to which the variable to be acquired belongs; When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be obtained belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be obtained, and the current value of the variable is read; Constructing a data return message according to the name of the variable to be obtained, the name of the Java class to which the variable to be obtained belongs, and the current value; Return the data return message.
3. According to the JAVA application pre-embedded needle system of claim 1, It is characterized in that The data manipulation module is specifically used for: Parsing the data manipulation request to obtain access user information, the name of the variable to be manipulated, the Java class name to which the variable to be manipulated belongs, and the new value; When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be manipulated belongs; In this class object, the corresponding variable is obtained according to the name of the variable to be manipulated, and the value of the variable to be manipulated is set to the new value; Constructing an operation return message according to the name of the variable to be manipulated, the name of the Java class to which the variable to be manipulated belongs, and the new value; Return the operation return message.
4. A JAVA application pre-embedded needle method, It is characterized in that The JAVA application pre-embedded needle method is executed in the application, and the JAVA application pre-embedded needle system is an EmbeddedNeedle component; including: Receive a data acquisition request, acquire a corresponding variable to be acquired according to the data acquisition request, read a current value of the variable to be acquired, and return the current value; Recording business data of the application; Receiving a business volume acquisition request, reading corresponding business data according to the business volume acquisition request, performing statistics on the read business data to obtain business volume data, and returning the business volume data; receiving a data manipulation request, obtaining a corresponding variable to be manipulated and a new value according to the data manipulation request, and setting the value of the variable to be manipulated to the new value; The business data includes the receiving time, transaction code, processing result and time consumption of each business request; The business data of the application program recorded specifically includes: When receiving the service request, recording the receiving time, transaction code and processing result of the service request; When the service request is processed, the processing result and time consumption of the service request are updated; The business volume data includes ongoing business volume, processed business volume, average time consumption and success rate; The reading corresponding business data according to the business volume acquisition request and returning the business data specifically includes: Parsing the business volume acquisition request to obtain access user information, statistical time range, and statistical transaction code; When the access user information verification is passed, the business data whose receiving time meets the statistical time range and whose transaction code is consistent with the statistical transaction code is read from the business data; Among the business data read, the statistical processing result is the number of ongoing business data, which is defined as the ongoing business volume; the statistical processing result is the number of non-ongoing business data, which is defined as the processed business volume; the reading processing result is the time consumption of all non-ongoing business data, and the mean operation is performed on all the time consumptions to obtain the average time consumption; the statistical processing result is the number of successful business data, which is defined as the successful business volume, and the statistical processing result is the number of failed business data, which is defined as the failed business volume, and the success rate is calculated according to the successful business volume and the failed business volume; Constructing a service return message according to the ongoing service volume, the processed service volume, the average time consumption, and the success rate; Return the service return message.
5. According to the JAVA application pre-embedded needle method of claim 4, It is characterized in that The acquiring the corresponding variable to be acquired according to the data acquisition request, reading the current value of the variable to be acquired, and returning the current value specifically includes: Parsing the data acquisition request to obtain access user information, the name of the variable to be acquired, and the Java class name to which the variable to be acquired belongs; When the access user information verification is passed, the corresponding class object is obtained according to the Java class name to which the variable to be obtained belongs; in the class object, the corresponding variable is obtained according to the name of the variable to be obtained, and the current value of the variable is read; Constructing a data return message according to the name of the variable to be obtained, the name of the Java class to which the variable to be obtained belongs, and the current value; Return the data return message.
6. According to the JAVA application pre-embedded needle method of claim 4, It is characterized in that The acquiring the corresponding variable to be manipulated and the new value according to the data manipulation request, and setting the value of the variable to be manipulated as the new value specifically includes: Parsing the data manipulation request to obtain access user information, the name of the variable to be manipulated, the Java class name to which the variable to be manipulated belongs, and the new value; When the access user information verification is passed, a corresponding class object is obtained according to the Java class name to which the variable to be manipulated belongs; in the class object, a corresponding variable is obtained according to the name of the variable to be manipulated, and the value of the variable to be manipulated is set to the new value; Constructing an operation return message according to the name of the variable to be manipulated, the name of the Java class to which the variable to be manipulated belongs, and the new value; Return the operation return message.
