Gateway-form Java and Python mutual calling method

Through batch division of data and multi-dimensional data acquisition, combined with in-depth data analysis and comprehensive evaluation, the data integrity and analysis accuracy problems of Java and Python call each other are solved, and the quality of cross-language data processing and analysis is significantly improved.

CN119718479AActive Publication Date: 2025-03-28SHANGHAI HUANLING INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411759575.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-28
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

The existing gateway forms Java and Python call methods that are called by each other have data integrity problems and insufficient accuracy of analysis results in the data collection and data analysis stages, resulting in low quality of cross-language data processing and analysis.

Method used

Through data batch division, multi-dimensional data collection and in-depth data analysis, indicators such as connection agile adaptation coefficient values ​​and transmission efficient coordination coefficient values ​​are calculated, comprehensive evaluation is conducted to improve the effect of mutual calling, and early warning is issued in a timely manner through dynamic monitoring to adjust the calling strategy.

Benefits of technology

It significantly improves the accuracy and integrity of data collection and analysis of Java and Python calls, improves the quality of cross-language data processing and analysis, and ensures data support for intelligent decision-making and efficient operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718479A_ABST
    Figure CN119718479A_ABST
Patent Text Reader

Abstract

The invention discloses a gateway-form Java and Python mutual calling method, and particularly relates to the field of Java and Python mutual calling, which comprises a data batch division step, a data acquisition step, a data processing step, a data comprehensive evaluation step, a real-time early warning feedback step and a final execution step. The data acquisition step comprises a communication performance data acquisition unit and a function execution data acquisition unit and is used for acquiring target data in real time and transmitting the acquired data to the data processing step; comprising a communication performance data analysis unit and a function execution data analysis unit and is used for analyzing the data transmitted in the data acquisition step and transmitting an analysis result to the data comprehensive evaluation step; according to the method, effective batch division is carried out on data called by Java and Python and an operation process through the data batch division step, and pertinence and effectiveness of cross-language data calling are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mutual calling between Java and Python, and more specifically, to a method for mutual calling between Java and Python in a gateway form. Background Art

[0002] With the booming development of the big data era and the continuous deepening of enterprise digital transformation, in many complex business scenarios, the mutual calling method between Java and Python in the form of a gateway has become the core link for integrating multi-source data and mining deep value, and the reliance on its calling accuracy and data integrity is increasing day by day. Relying on this calling method to achieve cross-language data collaborative processing can not only give full play to the advantages of Java's robust architecture and Python's flexible data mining expertise, but also unlock new business insights, bringing unprecedented opportunities for enterprise intelligent decision-making and efficient operations, but also inevitably facing a series of harsh tests. Accurate and complete data interaction and analysis, like a cornerstone, supports the solid building of cross-language collaborative operations, and is the key to meeting the urgent needs of the business for refined and scientific operations.

[0003] The existing gateway-based method for mutual calling between Java and Python mainly includes data collection steps, data transmission steps, data analysis steps, and result integration steps. In the data collection step, collection components that adapt to multiple data sources are deployed on the Java side and the Python side respectively. For diversified data sources such as database records, log files, and real-time sensor data streams, customized collection scripts and adapter interfaces are used to collect various types of data information, and to lay a solid data foundation for subsequent in-depth analysis. In the data transmission step, with the help of efficient and reliable network transmission protocols, such as the internal communication protocol optimized and customized based on TCP / IP, and with advanced data serialization and deserialization mechanisms, the data collected from both ends are standardized and packaged and quickly transmitted to ensure the lossless and timely flow of data in a cross-language environment, and to enhance the stability and integrity of data during transmission. In the data analysis step, according to business goals, Java's high-performance computing library and Python's rich data science toolkit are called, and machine learning models, statistical analysis algorithms, etc. are used to conduct in-depth analysis of the transmitted and aggregated data, so as to use their strengths to explore the potential value of data and provide quantitative support for decision-making. Using the result integration step, the results analyzed by different language terminals are summarized and sorted according to a unified data format and business logic framework, which is convenient for business personnel to clearly interpret and intuitively apply, and achieve synergy and efficiency of cross-language analysis results.

[0004] However, this method is still plagued by many thorny problems in its actual application. In the data collection stage, due to the complexity and diversity of different data source interface standards and the lack of adaptability of the collection components at both ends to some niche data sources, data omissions and missing of some key data fields often occur, just like a puzzle missing key pieces, which greatly reduces the integrity of the collected data and seriously weakens the comprehensiveness and reliability of subsequent data analysis; in the data analysis stage, given the complexity of coordination and cooperation of Java and Python built-in analysis tools in processing complex data structures and coping with heterogeneous data features, it is easy to fall into the local optimal trap, and the subtle differences in cross-language data type conversion are not accurately controlled, resulting in biased analysis results and insufficient insights, making it impossible to accurately locate business pain points and capture potential opportunities, greatly reducing the practical value and decision-making guidance effectiveness of cross-language data analysis.

[0005] Therefore, there is an urgent need for a method for Java and Python to call each other in the form of a gateway, so as to resolve the existing problems of loopholes in data collection and poor accuracy of analysis results, further improve the quality of cross-language data processing and analysis, and build a solid "data foundation" for intelligent decision-making and efficient operation in the process of enterprise digital transformation, so as to help the business ride the wind and waves and move forward steadily in the fierce market competition. Summary of the invention

[0006] In order to overcome the above defects of the prior art, an embodiment of the present invention provides a method for mutual calling between Java and Python in the form of a gateway, and solves the problems raised in the above background technology through the following scheme.

[0007] To achieve the above object, the present invention provides the following technical solution: a method for mutual invocation between Java and Python in the form of a gateway, comprising:

[0008] S1, data batch division step: used to determine the data to be collected as target data, divide the target data into different batches in an equal time division manner, and mark them as 1, 2, ..., n in sequence;

[0009] S2, data collection step: including a communication performance data collection unit and a function execution data collection unit, which are used to collect target data in real time and transmit the collected data to the data processing step; the communication performance data collection unit is used to collect connection establishment data, data transmission data and connection closing data; the function execution data collection unit is used to collect function call data, data processing data and task completion data;

[0010] S3, data processing step: including a communication performance data analysis unit and a function execution data analysis unit, which are used to analyze the data transmitted in the data collection step and transmit the analysis results to the data comprehensive evaluation step; the communication performance data analysis unit includes a connection establishment data analysis node, a data transmission data analysis node and a connection closing data analysis node; the function execution data analysis unit includes a function call data analysis node, a data processing data analysis node and a task completion data analysis node;

[0011] S4, data comprehensive evaluation step: including Java and Python calling each other data analysis units, for comprehensive evaluation of the analysis results transmitted in the data processing step, and transmitting the evaluation results to the real-time warning feedback step;

[0012] S5, real-time warning feedback step: used for the preset value of the comprehensive evaluation index of mutual calls between Java and Python, judging the comprehensive evaluation index value of mutual calls between Java and Python according to the preset value of the comprehensive evaluation index of mutual calls between Java and Python, and sending a corresponding signal according to the judgment result.

[0013] Preferably, the connection establishment data includes the cold start handshake success rate Ft, the network switching reconnection time Ra and the concurrent connection competition winning rate Cr; the data transmission data includes the large file block transmission rate Br, the data packet loss retransmission delay Pr and the multi-protocol mixed transmission efficiency ratio Td; the connection closing data includes the normal closing resource rollback time Gt, the abnormal closing data retention integrity Ce and the idle connection automatic cleanup time Ec.

[0014] Preferably, the function call data includes the cross-language function warm-up time Fw, the concurrent function call conflict rate Fc and the function call depth backtracing success rate Fs; the data processing data includes the heterogeneous data format adaptation accuracy Da, the data cache aging precision Ca and the data processing pipeline balance Pb; the task completion data includes the task interruption recovery success rate Rt and the resource peak redundancy Rp.

[0015] Preferably, the connection establishment data analysis node is used to establish a connection establishment data calculation model, import the connection establishment data transmitted in the data collection step into the connection establishment data calculation model, and obtain a connection agility adaptation coefficient value. The connection establishment data calculation model is specifically expressed as:

[0016]

[0017] Among them, α i Indicates the connection agility adaptation coefficient value calculated for the i-th time, Ft i Indicates the cold start handshake success rate of the ith acquisition, Ra iIndicates the network switching and reconnection time of the i-th acquisition, Cr i Indicates the concurrent connection competition winning rate of the i-th collection.

[0018] Preferably, the data transmission data analysis node is used to establish a data transmission data calculation model, import the data transmission data transmitted in the data collection step into the data transmission data calculation model, and obtain the transmission high efficiency coordination coefficient value. The data transmission data calculation model is specifically expressed as:

[0019]

[0020] Among them, β i represents the transmission efficiency coordination coefficient value calculated for the i-th time, Br i represents the transmission rate of the large file slices collected for the i-th time, Pr i Indicates the delay in retransmitting lost data packets collected for the i-th time, Td i It represents the multi-protocol mixed transmission efficiency ratio of the i-th acquisition.

[0021] Preferably, the connection closing data analysis node is used to establish a connection closing data calculation model, import the connection closing data transmitted in the data collection step into the connection closing data calculation model, and obtain the connection health closed loop coefficient value. The connection closing data calculation model is specifically expressed as:

[0022]

[0023] Among them, γ i Indicates the connection health closed-loop coefficient value calculated for the i-th time, Gt i Indicates the normal closing resource rollback duration of the i-th collection, Ce i Indicates the integrity of abnormal shutdown data collected for the i-th time, Ec i Indicates the automatic cleanup time of idle connections collected for the i-th time.

[0024] Preferably, the function call data analysis node is used to establish a function call data calculation model, import the function call data transmitted in the data collection step into the function call data calculation model, and obtain the function call robustness coefficient value. The function call data calculation model is specifically expressed as:

[0025]

[0026] in, Indicates the robustness coefficient value of the function call calculated for the i-th time, Fw i Fc represents the time taken to warm up the cross-language function collected for the i-th time. i Fs represents the concurrent function call conflict rate of the ith collection. i Indicates the success rate of the function call depth backtracing collected for the i-th time.

[0027] Preferably, the data processing data analysis node is used to establish a data processing data calculation model, import the data processing data transmitted in the data collection step into the data processing data calculation model, and obtain the data processing excellence coefficient value. The data processing data calculation model is specifically expressed as:

[0028]

[0029] Among them, e i represents the data processing excellence coefficient value calculated for the i-th time, Da i represents the adaptation accuracy of heterogeneous data formats collected for the i-th time, Ca i represents the aging accuracy of the data cache collected for the i-th time, Pb i Indicates the balance degree of the data processing pipeline for the i-th acquisition.

[0030] Preferably, the task completion data analysis node is used to establish a task completion data calculation model, import the task completion data transmitted in the data collection step into the task completion data calculation model, and obtain the task completion satisfaction coefficient value. The task completion data calculation model is specifically expressed as:

[0031]

[0032] Among them, η i Indicates the task completion coefficient value calculated for the i-th time, Rt i Rp represents the success rate of task interruption recovery for the i-th acquisition. i Indicates the resource peak redundancy of the i-th acquisition.

[0033] Preferably, the Java and Python mutual call data analysis unit is used to establish a Java and Python mutual call data calculation model, and the connection agility adaptation coefficient value, transmission efficient coordination coefficient value, connection health closed-loop coefficient value, function call robustness coefficient value, data processing excellence coefficient value and task completion satisfaction coefficient value transmitted in the data processing step are imported into the Java and Python mutual call data calculation model to obtain the Java and Python mutual call comprehensive evaluation index value, and the Java and Python mutual call data calculation model is specifically expressed as:

[0034]

[0035] Among them, IA represents the calculated comprehensive evaluation index value of Java and Python mutual calls, α i represents the connection agility adaptation coefficient value calculated for the i-th time, β i represents the transmission efficiency coordination coefficient value calculated for the i-th time, γi Indicates the connection health closed-loop coefficient value calculated for the i-th time, Indicates the robustness coefficient value of the function call calculated for the i-th time, l i represents the data processing excellence coefficient value calculated for the i-th time, η i Indicates the task completion coefficient value calculated for the i-th time.

[0036] Technical effects and advantages of the present invention:

[0037] 1. The present invention effectively divides the data and operation processes of Java and Python into batches through the data batch division step, which greatly improves the pertinence and effectiveness of cross-language call data. Through multi-dimensional collection of connection establishment data, data transmission data, connection closing data, function call data, data processing data, and task completion data, this multi-faceted data collection mode effectively breaks through the limitation of incomplete data docking when traditional Java and Python call each other, and provides a rich and reliable information foundation for subsequent accurate and smooth mutual calls;

[0038] 2. The present invention deeply analyzes the data collected from both Java and Python through data analysis, and then calculates the connection agility adaptation coefficient value, transmission efficiency coordination coefficient value, connection health closed-loop coefficient value, function call robustness coefficient value, data processing excellence coefficient value and task completion satisfaction coefficient value, and clearly points out the factors that may affect the effect of mutual calling between Java and Python; by comprehensively considering and organically integrating the data analysis results, the comprehensive evaluation index value of the entire Java and Python mutual calling process is obtained, which significantly improves the scientificity and feasibility of the mutual calling solution;

[0039] 3. The present invention continuously follows up through dynamic monitoring. Once a call deviation or data interaction anomaly is detected, an early warning message is immediately issued. Relevant staff can timely understand the status and potential risk points of the cross-language call system, and quickly take measures to adjust and improve the call strategy and error handling solution, so as to provide a solid guarantee for the efficient and stable mutual call between Java and Python in the form of a gateway and sustainable cross-language collaboration. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of the overall structure of the present invention. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] As attached Figure 1 A gateway-style Java and Python calling method shown includes:

[0043] S1. Data batch division step: used to determine the data to be collected as target data, divide the target data into different batches in an equal time division manner, and mark them as 1, 2, ..., n in sequence.

[0044] What needs to be specifically explained in this embodiment is that the method of dividing by equal time is based on the characteristics of each target data. According to the real-time requirements of each target data, it is collected once at equal intervals through the database and divided into different collection batches.

[0045] S2. Data collection step: including a communication performance data collection unit and a function execution data collection unit, which are used to collect target data in real time and transmit the collected data to the data processing step; the communication performance data collection unit is used to collect connection establishment data, data transmission data and connection closing data; the function execution data collection unit is used to collect function call data, data processing data and task completion data.

[0046] In this embodiment, it is specifically necessary to explain that: the connection establishment data includes the cold start handshake success rate Ft, the network switching reconnection time Ra and the concurrent connection competition winning rate Cr; the data transmission data includes the large file block transmission rate Br, the data packet loss retransmission delay Pr and the multi-protocol mixed transmission efficiency ratio Td; the connection closing data includes the normal closing resource rollback time Gt, the abnormal closing data retention integrity Ce and the idle connection automatic cleanup time Ec; the function call data includes the cross-language function warm-up time Fw, the concurrent function call conflict rate Fc and the function call deep backtracking success rate Fs; the data processing data includes the heterogeneous data format adaptation accuracy Da, the data cache aging precision Ca and the data processing pipeline balance Pb; the task completion data includes the task interruption recovery success rate Rt and the resource peak redundancy Rp.

[0047] The high success rate of the cold start handshake proves that the system can quickly adapt to the initial network environment, allocate its own resources, accurately build a communication bridge according to the established protocol (similar to the TCP three-way handshake logic, Java sends a SYN request, Python responds to SYN+ACK, and Java returns ACK), avoid business startup delays, and is of great significance to real-time monitoring, scheduled task push, and other scenarios that need to start interaction on time. It is a key indicator for measuring the reliability of the initial communication of the system. Its collection method is: embed the handshake status recording module in the underlying code of the Java-side and Python-side communication framework. Each time the system is cold started (it can be judged based on the time interval between the system startup timestamp and the last communication end, and the interval is set to be a cold start if it exceeds 1 hour), when initiating a connection, mark "handshake attempt start" and record time t1. When the other party confirms that the three-way handshake is complete, mark "handshake success" and record t2. At the same time, the total number of cold starts totalColdStarts and the number of successes successColdStarts are counted, and the cold start handshake success rate is calculated according to the formula = (successColdStarts / totalColdStarts) * 100%.

[0048] The network switching and reconnection time directly reflects the system's adaptability. A short reconnection time can reduce business freezes and data interruptions, ensure uninterrupted switching of video conference venues and remote data synchronization, maintain the system "always online", and improve user experience and business continuity. The collection method is: using the system network status monitoring interface (Java can use the NetworkInterface class and related libraries to monitor network changes, and Python uses the psutil library to monitor the network card status). When a network switch is detected (such as an IP address change, a network interface device switch), the reconnection logic is triggered to instantly record startTime. When the reconnection is successful (the Java-side Socket can send and receive test data normally after reconnection, Python is similar to confirming based on socket module feedback), endTime is recorded. The difference endTime-startTime is the network switching and reconnection time. The average of multiple rounds of switching records is calculated and the maximum value is statistically analyzed to assist in analysis.

[0049] The concurrent connection competition winning rate determines whether the system can quickly accept many clients. A high winning rate means that the system efficiently allocates resources such as ports, memory, and threads to avoid connection blocking and queuing, and ensures stable operation when the business is instantly flooded with high traffic. It is a "pioneer indicator" for the stress resistance of large distributed systems. The collection method is: write a concurrent connection test tool (Java uses ExecutorService thread pool to batch create connection tasks, Python uses concurrent.futures.ThreadPoolExecutor) to simulate multiple client concurrent requests, each task carries an independent identifier and status mark (initially "in competition"), successfully establishes a connection and updates it to "win", and fails to record "failure", and counts the total concurrent times totalConcurrent and the winning times successConcurrent, and calculates it according to the formula concurrent connection competition winning rate = (successConcurrent / totalConcurrent)*100%.

[0050] The large file block transmission rate is the "touchstone" of the system transmission capacity. The fast block transmission rate ensures efficient file transfer, reduces transmission time, relieves long-term high load on the gateway and network, and is conducive to timely synchronization of data and release of local storage. The collection method is as follows: before the Java end transmits a large file (read with FileInputStream), it is divided according to the set block size (such as 1MB) and records the start block transmission time startTime. When the Python end receives the corresponding block, it records endTime, counts the number of transmission blocks blockCount and the total time, and calculates the number of transmission bytes according to the file block size (each block is 1MB). The formula large file block transmission rate = (number of transmission bytes / (endTime-startTime)) / 1024 / 1024 (converted to MB / s) is used to calculate it.

[0051] The data packet loss retransmission delay is short, and the data sequence can be quickly restored, ensuring that the receiving end processes in sequence, responds to data changes in a timely manner, avoids wrong decisions due to packet loss, and maintains accurate business operation. The collection method is: the sending end (Java or Python) assigns a unique serial number (a self-increasing integer) to each real-time data packet, and the receiving end maintains a list of expected receiving sequence numbers. When packet loss is found (the receiving sequence number is discontinuous), the packet loss time lostTime is recorded, and the recoverTime is recorded when the retransmission packet arrives. recoverTime-lostTime is the packet loss retransmission delay.

[0052] The multi-protocol mixed transmission efficiency ratio can measure the system's ability to coordinate multiple protocols, reasonably allocate bandwidth, and avoid protocol "conflicts". A high ratio indicates good protocol coordination, such as a smart office platform that takes into account both document transmission and smooth instant messaging. The collection method is: at the gateway traffic monitoring point (which can be a hardware packet capture device or a software agent), the total throughput totalThroughput (bytes / second) during multi-protocol mixed transmission is counted separately, and then the optimal transmission scenario throughput of each protocol is tested separately (optimalThroughput_i corresponds to the i-th protocol), and the formula multi-protocol mixed transmission efficiency ratio = (totalThroughput / sum(optimalThroughput_i))*100% is used to calculate the result.

[0053] The normal closing resource rollback duration affects the subsequent connection creation and the overall system performance. The short resource rollback duration ensures that the system is lightly equipped and can continuously and efficiently respond to new business requests. This is particularly important in high-concurrency short-connection scenarios (such as frequent interactions between microservices). The collection method is: at the beginning of the connection closing code logic (before the combined operation of Javasocket.close(), Pythonsocket.shutdown() and socket.close()), use System.currentTimeMillis() (Java) or time.time()*1000 (Python, converted to milliseconds) to record startTime, and use the operating system resource monitoring tool (Linuxlsof to check file handles, netstat to check ports, Windows Task Manager and corresponding network commands) to monitor the endTime when the resource is released. EndTime-startTime is the normal closing resource rollback duration.

[0054] The abnormal closure data is retained in integrity for subsequent business recovery and troubleshooting. It is a "safety net" to protect data assets and reduce losses. It is indispensable for data-sensitive businesses to prevent key data loss and maintain business continuity. The collection method is: in the connection abnormal closure capture logic (Java try-catch captures IOException and other exceptions, Python try-except captures socket.error, etc.), record the location, size and other information of the transmitted unprocessed data, compare the total amount of data before the exception, and count the number of abnormal closures totalAbnormal and the number of data complete retention successRetain. According to the formula, the abnormal closure data retention integrity = (successRetain / totalAbnormal)*100%.

[0055] The idle connection automatic cleanup time limit means that timely cleanup of long-term idle connections that consume system resources can optimize resource allocation, improve the system's response speed to new connections, and enhance overall operating efficiency. For example, cleaning idle connections during the low-load period at night on the server can save energy and improve efficiency. The collection method is: the system runs an idle connection monitoring thread (Java timer task, Pythonthreading.Timer implementation) in the background, scans the connection pool according to the set idle threshold (such as 5 minutes of no data interaction), and starts the cleanup timing when an idle connection is found. The start of the cleanup startClean and the end of the cleanup endClean are recorded (based on the completion of resource release or deletion of the connection mark). endClean-startClean is the idle connection automatic cleanup time limit.

[0056] The cross-language function preheating time determines the "initial speed" of the function response. Short time can quickly activate the function and put it into business operation, reducing user waiting. For example, in scenarios such as new function launch and low-frequency business function call, the system agility is improved and the "frustration" of cold start is avoided. The collection method is: before Java calls the Python function (or vice versa) entry code, use System.currentTimeMillis() (Java) or time.time()*1000 (Python) to record startTime. Function calls involve loading dependent libraries (Pythonimport modules, JavaClassLoader loading classes), initializing the environment (such as Python interpreter configuration, Java static variable initialization), and recording endTime until the function can execute the first instruction. EndTime-startTime is the cross-language function preheating time.

[0057] The low conflict rate of concurrent function calls can ensure that each call is executed independently and correctly, avoid data confusion and result errors, and is the key to ensuring the stability and accuracy of large-scale parallel processing of the system. The collection method is: build a concurrent test framework (JavaExecutorService multi-threaded concurrency, Pythonconcurrent.futures.ThreadPoolExecutor) to initiate batch function calls, each call is associated with a unique identifier and status (initially "running"), and errors due to contention for shared resources (global variables, database connection pool limited connections) are updated to "conflict", and the total concurrent number of totalConcurrentCall and the number of conflicts conflictCount are counted, and the concurrent function call conflict rate = (conflictCount / totalConcurrentCall)*100% is calculated.

[0058] The function call depth backtracking success rate measures the frequency of whether the recursive call can successfully backtrack to the upper call after reaching a certain depth and continue to execute normally. A high success rate means that the program can resume execution safely and effectively after the recursive call ends, which is crucial to the stability and efficiency of the program. It is a "compass" for system operation and maintenance, improving the efficiency of troubleshooting, shortening the repair cycle, ensuring the continuous and healthy operation of the business, and reducing the cost of operation and maintenance. It is particularly effective when complex business logic functions fail. The collection method is: embedding the log record and stack frame capture mechanism at the bottom of the function call framework (Java uses the StackTraceElement array to record the call stack, and the Python traceback module captures the stack information). Each time the function is executed or exits abnormally, the log and stack frame are parsed to locate the root cause of the error, and the total number of function calls totalCall and the number of successful backtracking repairs successBacktrace are counted. The formula function call depth backtracking success rate = (successBacktrace / totalCall)*100% is used to calculate it.

[0059] The heterogeneous data format adaptation accuracy rate is to ensure that the data is "translated" correctly across languages, maintain the integrity of data semantics and structure, avoid "misinterpretation" of business due to data mismatch, and lay a solid foundation for data fusion and frequent interactive business (cross-language collaboration of data analysis pipeline). The collection method is: in the data conversion module (Java custom conversion class, Python conversion function group), for each format conversion operation, clone the data copy before conversion (Javaclone() or serialization and deserialization, Pythoncopy.deepcopy()), and compare the copy with the target data element by element and field by field after conversion (according to data type rules, numerical value to size, string to content, etc.), count the total conversion times totalConversion and the accurate conversion times successConversion, and calculate it according to the formula heterogeneous data format adaptation accuracy rate = (successConversion / totalConversion)*100%.

[0060] The data cache aging accuracy refers to the data aging (elimination) strategy in the cache system that can accurately reflect the access frequency and timeliness of the data, thereby ensuring that the most valuable data is retained in the cache. High accuracy ensures the retention of hot data and the elimination of cold data, maintains the cache "metabolism" health, improves the cache hit rate, releases space, and accelerates data acquisition. The collection method is: in the cache management component (Java can be based on GuavaCache extension, Python uses functools.lru_cache and custom cleaning logic), each cleaning operation (timing or cache full trigger), traverse the cleanup data list, compare the actual data to be cleaned (expired, low frequency) with the actual cleanup data, and count the total number of cleanups totalClean and the precise number of cleanups successClean, and calculate it according to the formula data cache aging accuracy = (successClean / totalClean)*100%.

[0061] It refers to whether the processing capacity and load of each stage in the data processing pipeline are balanced to ensure the efficient operation of the entire pipeline. A high degree of balance can avoid bottlenecks, achieve efficient resource utilization, smooth processes, improve overall throughput, shorten the data cycle from raw to finished products, and enhance efficiency in big data batch processing and real-time stream processing. The collection method is: embed timestamp records (JavaSystem.currentTimeMillis(), Pythontime.time()*1000) at the beginning and end of each link in the pipeline, count the processing time processTime_i (i identifies the link) of each link, calculate the longest link time maxTime, and calculate it according to the formula data processing pipeline balance = (sum(processTime_i) / (len(processTime_i)*maxTime))*100%.

[0062] The task interruption recovery success rate is the "touchstone" of system resilience. A high success rate reduces duplication of work and data loss, ensures business continuity, and resists risks and maintains operation in key businesses (such as financial transactions and scientific research operations). The collection method is: simulate the interruption scenario (actively shut down the process, cut off the network to simulate a failure), and after the task recovery mechanism (based on logs and checkpoint recovery progress) is started, the total number of task interruptions totalInterrupt and the number of successful recoveries successRecover are counted, and the formula task interruption recovery success rate = (successRecover / totalInterrupt)*100% is used to calculate the result.

[0063] A high peak redundancy of task resources indicates resource waste and poor configuration. Optimizing this indicator can rationally allocate resources, improve the system's concurrent multi-task carrying capacity, avoid resource contention, and ensure that each task is "well-fed" and runs smoothly. The collection method is: with the help of system resource monitoring tools (Linuxtop, htop to view CPU and memory, Windows Task Manager), record the resource usage (CPU usage, memory amount) of each stage of task execution, estimate the optimal resource amount optimalResource based on task complexity and historical average, and calculate the peak resource amount peakResource, which is calculated according to the formula task resource peak redundancy = ((peakResource-optimalResource) / optimalResource)*100%.

[0064] S3, data processing step: including a communication performance data analysis unit and a function execution data analysis unit, which are used to analyze the data transmitted in the data collection step and transmit the analysis results to the data comprehensive evaluation step; the communication performance data analysis unit includes a connection establishment data analysis node, a data transmission data analysis node and a connection closing data analysis node; the function execution data analysis unit includes a function call data analysis node, a data processing data analysis node and a task completion data analysis node.

[0065] In this embodiment, it is specifically required to be explained that: the connection establishment data analysis node is used to establish a connection establishment data calculation model, and the connection establishment data transmitted in the data collection step is imported into the connection establishment data calculation model to obtain a connection agility adaptation coefficient value. The connection establishment data calculation model is specifically expressed as:

[0066]

[0067] Among them, α i Indicates the connection agility adaptation coefficient value calculated for the i-th time, Ft i Indicates the cold start handshake success rate of the ith acquisition, Ra i Indicates the network switching and reconnection time of the i-th acquisition, Cr i Indicates the concurrent connection competition winning rate of the i-th collection.

[0068] In this embodiment, it is specifically required to be explained that: the data transmission data analysis node is used to establish a data transmission data calculation model, and the data transmission data transmitted in the data collection step is imported into the data transmission data calculation model to obtain a transmission high efficiency coordination coefficient value. The data transmission data calculation model is specifically expressed as:

[0069]

[0070] Among them, βi represents the transmission efficiency coordination coefficient value calculated for the i-th time, Br i Pr represents the transmission rate of the large file slices collected for the i-th time. i Indicates the delay in retransmitting lost data packets collected for the i-th time, Td i It represents the multi-protocol mixed transmission efficiency ratio collected for the i-th time.

[0071] In this embodiment, it should be specifically explained that: the connection closing data analysis node is used to establish a connection closing data calculation model, and the connection closing data transmitted in the data collection step is imported into the connection closing data calculation model to obtain the connection health closed loop coefficient value. The connection closing data calculation model is specifically expressed as:

[0072]

[0073] Among them, γ i Indicates the connection health closed-loop coefficient value calculated for the i-th time, Gt i Indicates the normal closing resource rollback duration of the i-th collection, Ce i Indicates the integrity of abnormal shutdown data collected for the i-th time, Ec i Indicates the automatic cleanup time of idle connections collected for the i-th time.

[0074] In this embodiment, it is specifically required to be explained that: the function call data analysis node is used to establish a function call data calculation model, import the function call data transmitted in the data collection step into the function call data calculation model, and obtain the function call robustness coefficient value. The function call data calculation model is specifically expressed as:

[0075]

[0076] in, Indicates the robustness coefficient value of the function call calculated for the i-th time, Fw i Fc represents the time taken to warm up the cross-language function collected for the i-th time. i Fs represents the concurrent function call conflict rate of the ith collection. i Indicates the success rate of the function call depth backtracing collected for the i-th time.

[0077] In this embodiment, it is specifically required to be explained that: the data processing data analysis node is used to establish a data processing data calculation model, and the data processing data transmitted in the data collection step is imported into the data processing data calculation model to obtain the data processing excellence coefficient value. The data processing data calculation model is specifically expressed as:

[0078]

[0079] Among them, l irepresents the data processing excellence coefficient value calculated for the i-th time, Da i represents the adaptation accuracy of heterogeneous data formats collected for the i-th time, Ca i represents the aging accuracy of the data cache collected for the i-th time, Pb i Indicates the balance degree of the data processing pipeline for the i-th acquisition.

[0080] In this embodiment, it is specifically required to be explained that: the task completion data analysis node is used to establish a task completion data calculation model, and the task completion data transmitted in the data collection step is imported into the task completion data calculation model to obtain the task completion degree coefficient value. The task completion data calculation model is specifically expressed as:

[0081]

[0082] Among them, η i Indicates the task completion coefficient value calculated for the i-th time, Rt i Rp represents the success rate of task interruption recovery for the i-th acquisition. i Indicates the resource peak redundancy of the i-th acquisition.

[0083] S4, data comprehensive evaluation step: including Java and Python calling each other's data analysis unit, which is used to comprehensively evaluate the analysis results transmitted by the data processing step, and transmit the evaluation results to the real-time warning feedback step.

[0084] In this embodiment, it is specifically required to be explained that: the Java and Python mutual call data analysis unit is used to establish a Java and Python mutual call data calculation model, and the connection agility adaptation coefficient value, transmission efficient coordination coefficient value, connection health closed-loop coefficient value, function call robustness coefficient value, data processing excellence coefficient value and task completion satisfaction coefficient value transmitted in the data processing step are imported into the Java and Python mutual call data calculation model to obtain the Java and Python mutual call comprehensive evaluation index value, and the Java and Python mutual call data calculation model is specifically expressed as:

[0085]

[0086] Among them, IA represents the calculated comprehensive evaluation index value of Java and Python mutual calls, α i represents the connection agility adaptation coefficient value calculated for the i-th time, β i represents the transmission efficiency coordination coefficient value calculated for the i-th time, γ i Indicates the connection health closed-loop coefficient value calculated for the i-th time, Indicates the robustness coefficient value of the function call calculated for the i-th time, l irepresents the data processing excellence coefficient value calculated for the i-th time, η i Indicates the task completion coefficient value calculated for the i-th time.

[0087] S5, real-time warning feedback step: used for the preset value of the comprehensive evaluation index of mutual calls between Java and Python, judging the comprehensive evaluation index value of mutual calls between Java and Python according to the preset value of the comprehensive evaluation index of mutual calls between Java and Python, and sending a corresponding signal according to the judgment result.

[0088] In this embodiment, it should be specifically explained that: the preset value of the comprehensive evaluation index of mutual invocation between Java and Python is marked as IA def , when IA def <=IA, a normal signal is issued, which indicates that the preset value of the comprehensive evaluation index of mutual calls between Java and Python is less than or equal to the value of the comprehensive evaluation index of mutual calls between Java and Python, indicating that the mutual calls between Java and Python are in good condition; and the following operations are performed:

[0089] SS1. Network connection: Communication is achieved by establishing a network connection between Python and JVM. This connection is based on TCP / IP protocol, allowing Python programs to directly call Java object methods without complex serialization and deserialization operations;

[0090] SS2, GatewayServer: On the Java side, use the GatewayServer class to start a server that allows Python programs to communicate with the JVM through a local network socket. GatewayServer instantiates an entrypoint, which can be any object, such as Singleton, list, etc., allow Python programs to access pre-configured Java objects;

[0091] SS3.JavaGateway: On the Python side, use the JavaGateway class to connect to the JVM. This gateway is responsible for establishing and maintaining the connection with the Java side and provides an interface to access Java objects and methods;

[0092] SS4, Object reference management: Every time a Java object is sent to the Python side, the Gateway class on the Java side will keep a reference to the object. Once the object on the Python side is garbage collected (reference count is 0), the reference on the Java side will also be removed. If the gateway is closed, the remaining references will also be removed from the Java side;

[0093] SS5, two-way communication: not only allows Python to call Java objects, but also supports Java programs to call back Python objects, achieving two-way communication;

[0094] SS6, Memory Model: When dealing with references to Java objects on the Python side, circular references are involved. JavaObject and JavaMember reference each other, and these objects will not be garbage collected immediately after the last reference on the Python side is removed, but they will eventually be recycled, provided that Python's garbage collector runs before the program exits.

[0095] When IA def >IA, a warning signal is issued to the relevant technical management personnel. This signal indicates that the preset value of the comprehensive evaluation index of mutual calls between Java and Python is greater than the comprehensive evaluation index value of mutual calls between Java and Python, indicating that the mutual calls between Java and Python are in poor condition and require adjustment by relevant technical personnel.

[0096] The present invention effectively divides the data and operation flow of Java and Python into batches through the data batch division step, which greatly improves the pertinence and effectiveness of cross-language call data. Through multi-dimensional collection of connection establishment data, data transmission data, connection closing data, function call data, data processing data and task completion data, this multi-faceted data collection mode effectively breaks through the limitation of incomplete data docking when traditional Java and Python call each other, and provides a rich and reliable information basis for subsequent accurate and smooth mutual calls; through data analysis, the collected data from both ends of Java and Python are deeply analyzed, and then the connection agility adaptation coefficient value, transmission efficient coordination coefficient value, connection health closed loop coefficient value, function call robustness coefficient value, data processing excellence coefficient value and task completion satisfaction coefficient value are calculated, and the factors that may affect the effect of Java and Python calling each other are clearly pointed out; through comprehensive consideration and organic integration of the data analysis results, the comprehensive evaluation index value of the entire Java and Python mutual call process is obtained, which significantly improves the scientificity and feasibility of the mutual call scheme. Through dynamic monitoring and continuous follow-up, once a call deviation or data interaction anomaly is detected, an early warning message will be issued immediately, so that relevant staff can timely understand the status and potential risk points of the cross-language call system, and quickly take measures to adjust and improve the call strategy and error handling plan, providing a solid guarantee for efficient and stable gateway-based Java and Python mutual calls and sustainable cross-language collaboration; Dynamic access to Java objects: Allow Python programs to dynamically access Java objects in the Java virtual machine (JVM), so that Python programs can call Java methods just like accessing local objects. This dynamic access capability greatly improves development efficiency and flexibility.

[0097] In addition the present invention also has the following advantages:

[0098] Two-way communication: It not only supports Python calling Java, but also supports Java calling back Python objects, realizing true two-way communication. This two-way communication mechanism enables the present invention to perform well in handling much more complex language integration scenarios;

[0099] High performance: The efficient communication mechanism realized through network connection avoids complex serialization and deserialization operations, thereby improving performance. According to actual tests, the data transmission speed of the present invention is nearly 50% faster than that of the traditional JNI interface;

[0100] Easy to integrate: The API design of this invention is concise and easy to integrate into existing Python and Java projects. This allows developers to quickly implement Python and Java interoperability in their projects.

[0101] Asynchronous call: The present invention supports asynchronous call mode. In asynchronous mode, the Python program can continue to execute other tasks immediately after initiating a call request without waiting for the response from the Java side. This non-blocking method improves the overall performance of the program.

[0102] Concurrent processing capability: supports multi-threaded concurrent processing, which means it can process multiple requests at the same time. In a high-concurrency environment, the performance advantage of the present invention is particularly obvious;

[0103] Through these technical effects, the present invention is not only powerful in function, but also has excellent performance and stability, so that developers can better utilize the advantages of Python and Java and achieve seamless integration between Python and Java. In summary, the present invention enables Python to seamlessly access and operate Java objects in JVM by establishing a network connection, and also supports Java's callback to Python to achieve two-way communication. This design not only improves performance, but also simplifies the development process.

[0104] Secondly: In the drawings of the embodiments disclosed in the present invention, only the structures related to the embodiments disclosed in the present invention are involved, and other structures can refer to the general design. In the absence of conflict, the same embodiment and different embodiments of the present invention can be combined with each other;

[0105] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for mutual invocation between Java and Python in the form of a gateway, characterized in that: include: S1, data batch division step: used to determine the data to be collected as target data, divide the target data into different batches in an equal time division manner, and mark them as 1, 2, ..., n in sequence; S2, data collection step: including a communication performance data collection unit and a function execution data collection unit, which are used to collect target data in real time and transmit the collected data to the data processing step; The communication performance data collection unit is used to collect connection establishment data, data transmission data and connection closing data; the function execution data collection unit is used to collect function call data, data processing data and task completion data; S3, data processing step: including a communication performance data analysis unit and a function execution data analysis unit, which are used to analyze the data transmitted in the data collection step and transmit the analysis results to the data comprehensive evaluation step; the communication performance data analysis unit includes a connection establishment data analysis node, a data transmission data analysis node and a connection closing data analysis node; The function execution data analysis unit includes a function call data analysis node, a data processing data analysis node and a task completion data analysis node; S4, data comprehensive evaluation step: including Java and Python calling each other data analysis units, for comprehensive evaluation of the analysis results transmitted in the data processing step, and transmitting the evaluation results to the real-time warning feedback step; S5, real-time warning feedback step: used for the preset value of the comprehensive evaluation index of mutual calls between Java and Python, judging the comprehensive evaluation index value of mutual calls between Java and Python according to the preset value of the comprehensive evaluation index of mutual calls between Java and Python, and sending a corresponding signal according to the judgment result.

2. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The connection establishment data includes the cold start handshake success rate Ft, the network switching reconnection time Ra and the concurrent connection competition winning rate Cr; the data transmission data includes the large file block transmission rate Br, the data packet loss retransmission delay Pr and the multi-protocol mixed transmission efficiency ratio Td; the connection closing data includes the normal closing resource rollback time Gt, the abnormal closing data retention integrity Ce and the idle connection automatic cleanup time Ec.

3. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The function call data includes the cross-language function warm-up time Fw, the concurrent function call conflict rate Fc and the function call deep backtracing success rate Fs; the data processing data includes the heterogeneous data format adaptation accuracy Da, the data cache aging accuracy Ca and the data processing pipeline balance Pb; the task completion data includes the task interruption recovery success rate Rt and the resource peak redundancy Rp.

4. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The connection establishment data analysis node is used to establish a connection establishment data calculation model, import the connection establishment data transmitted in the data collection step into the connection establishment data calculation model, and obtain the connection agility adaptation coefficient value. The connection establishment data calculation model is specifically expressed as: Among them, α i Indicates the connection agility adaptation coefficient value calculated for the i-th time, Ft i Indicates the cold start handshake success rate of the ith acquisition, Ra i Indicates the network switching and reconnection time of the i-th acquisition, Cr i Indicates the concurrent connection competition winning rate of the i-th collection.

5. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The data transmission data analysis node is used to establish a data transmission data calculation model, import the data transmission data transmitted in the data collection step into the data transmission data calculation model, and obtain the transmission high efficiency coordination coefficient value. The data transmission data calculation model is specifically expressed as: Among them, β i represents the transmission efficiency coordination coefficient value calculated for the i-th time, Br i represents the transmission rate of the large file slices collected for the i-th time, Pr i Indicates the delay in retransmitting lost data packets collected for the i-th time, Td i It represents the multi-protocol mixed transmission efficiency ratio of the i-th acquisition.

6. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The connection closing data analysis node is used to establish a connection closing data calculation model, import the connection closing data transmitted in the data collection step into the connection closing data calculation model, and obtain the connection health closed loop coefficient value. The connection closing data calculation model is specifically expressed as: Among them, γ i Indicates the connection health closed-loop coefficient value calculated for the i-th time, Gt i Indicates the normal closing resource rollback duration of the i-th collection, Ce i Indicates the integrity of abnormal shutdown data collected for the i-th time, Ec i Indicates the automatic cleanup time of idle connections collected for the i-th time.

7. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The function call data analysis node is used to establish a function call data calculation model, import the function call data transmitted in the data collection step into the function call data calculation model, and obtain the function call robustness coefficient value. The function call data calculation model is specifically expressed as: in, Indicates the robustness coefficient value of the function call calculated for the i-th time, Fw i Fc represents the time taken to warm up the cross-language function collected for the i-th time. i Fs represents the concurrent function call conflict rate of the ith collection. i Indicates the success rate of the function call depth backtracing collected for the i-th time.

8. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The data processing data analysis node is used to establish a data processing data calculation model, import the data processing data transmitted in the data collection step into the data processing data calculation model, and obtain the data processing excellence coefficient value. The data processing data calculation model is specifically expressed as: Among them, e i represents the data processing excellence coefficient value calculated for the i-th time, Da i represents the adaptation accuracy of heterogeneous data formats collected for the i-th time, Ca i represents the aging accuracy of the data cache collected for the i-th time, Pb i Indicates the balance degree of the data processing pipeline for the i-th acquisition.

9. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The task completion data analysis node is used to establish a task completion data calculation model, import the task completion data transmitted in the data collection step into the task completion data calculation model, and obtain the task completion degree coefficient value. The task completion data calculation model is specifically expressed as: Among them, η i Indicates the task completion coefficient value calculated for the i-th time, Rt i Rp represents the success rate of task interruption recovery for the i-th acquisition. i Indicates the resource peak redundancy of the i-th acquisition.

10. The method for mutual invocation between Java and Python in the form of a gateway according to claim 1, characterized in that: The Java and Python mutual call data analysis unit is used to establish a Java and Python mutual call data calculation model, and import the connection agility adaptation coefficient value, transmission efficient coordination coefficient value, connection health closed-loop coefficient value, function call robustness coefficient value, data processing excellence coefficient value and task completion satisfaction coefficient value of the data processing step transmission into the Java and Python mutual call data calculation model to obtain the Java and Python mutual call comprehensive evaluation index value. The Java and Python mutual call data calculation model is specifically expressed as: Among them, IA represents the calculated comprehensive evaluation index value of Java and Python mutual calls, α i represents the connection agility adaptation coefficient value calculated for the i-th time, β i represents the transmission efficiency coordination coefficient value calculated for the i-th time, γ i Indicates the connection health closed-loop coefficient value calculated for the i-th time, represents the robustness coefficient value of the function call calculated for the i-th time, e i represents the data processing excellence coefficient value calculated for the i-th time, η i Indicates the task completion coefficient value calculated for the i-th time.

Citation Information

Patent Citations

  • Big data time sequence analysis method based on PySpark and Panda fusion

    CN112612823A

  • Data processing method and device, data acquisition method and device, equipment and storage medium

    CN116701018A

  • Method and system for safely accessing database

    CN118555104A

  • Financial institution risk assessment system based on big data analysis

    CN118761838A

  • Systems and methods for managing tokens and filtering data to control data access

    US11379617B1