A data processing method and device

By defining the MainTask of the Parcelable interface, the task transfer between the sub-process and the main process is realized, which solves the problem of communication complexity between the sub-process and the main process in the Android system, and simplifies the data transfer and task processing between processes.

CN113760561BActive Publication Date: 2024-10-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010553420.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-17
Publication Date
2024-10-18
Estimated Expiration
2040-06-17

AI Technical Summary

Technical Problem

In the Android system, when a child process communicates with the main process without an interface, it needs to negotiate the business processing process in advance, which makes the operation complex and difficult to flexibly expand.

Method used

By defining the MainTask of the Parcelable interface, tasks are transferred between the child process and the main process. All businesses only need to inherit and implement the three methods of MainTask, take out the data passed by the other process from the Bundle, and store the data that needs to be passed to the other process. To achieve data transfer and main process task processing.

Benefits of technology

It greatly simplifies the complexity of inter-process communication, realizes flexible data transmission and main process task processing, and avoids the complexity of needing to separately customize the aidl interface in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760561B_ABST
    Figure CN113760561B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method and device, and relates to the field of computer technology. A specific implementation of the method includes: a subprocess responds to a business processing request, creates a task, a task identifier, and a processing flow, and stores the data to be transmitted and the processing flow in the container of the task; calls the interface definition language corresponding to the subprocess, and based on the communication link with the main process service, pushes the task identifier and the container to the service together, so as to process the data according to the processing flow through the service; receives the task identifier and processing result returned by the service, and based on the task identifier, stores the processing result in the container of the task. In this implementation, the subprocess only needs to inherit MainTask in the task code of the business, and implement the onInit and onResult methods, without adding the aidl interface and negotiating the business processing flow with the main process offline, and can easily realize communication with the main process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data processing method and device. Background Art

[0002] In the Android system, if a child process needs to use data in the main process, if there is an interface, it can use the startActivityForResult method to access data through the interaction of the Bundle (container); but if there is no interface, data communication is required through the aidl (android interface definition language) interface.

[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:

[0004] In the absence of an interface, the sub-process needs to negotiate the business processing flow with the main process offline in advance, and each time a business is processed, an AIDL interface needs to be customized separately to communicate with the main process. The operation is complicated and it is difficult to flexibly expand the business. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a data processing method and device, which can at least solve the problem that the business in the sub-process is difficult to expand in the prior art.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a data processing method is provided, comprising:

[0007] The subprocess responds to the business processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow in the container of the task;

[0008] Invoke an interface definition language corresponding to the subprocess, and push the task identifier and the container to the service based on the communication link with the main process service, so as to process the data according to the processing flow through the service;

[0009] The task identifier and processing result returned by the service are received, and based on the task identifier, the processing result is stored in a container of the task.

[0010] Optionally, the creation of the task, task identification and processing flow includes: obtaining basic information of the task, processing the basic information using a hash algorithm, and using the processed hash value as the task identification; wherein the basic information includes at least a name and attributes.

[0011] Optionally, before calling the interface definition language corresponding to the sub-process, it also includes: establishing a communication link with the service through a binding service method; wherein the service is established when the main process is started.

[0012] Optionally, calling the interface definition language corresponding to the subprocess and pushing the task identifier and the container to the service based on the communication link with the main process service includes:

[0013] Processing the task identifier, the container and the information in a serialized manner to obtain a first task identifier sequence, a first container sequence and a first information sequence;

[0014] Based on the communication link with the service, push the first task identification sequence, the first container sequence and the first information sequence to the service;

[0015] In the service, the first task identification sequence, the first container sequence and the first information sequence are processed in a deserialization manner to obtain the task identification, the container and the information.

[0016] Optionally, the task also includes a message, which is a transmission method and is transmitted to the service together with the task identifier, the container and the information through the communication link, and is used to transmit the processing result and the task identifier when the service processes the data for more than a predetermined time.

[0017] Optionally, the interface definition language corresponds to the sub-process one-to-one, and the tasks in the sub-process share the same interface definition language.

[0018] To achieve the above object, according to another aspect of an embodiment of the present invention, another data processing method is provided, comprising:

[0019] The service in the main process establishes a communication link with the child process, and receives the task identifier, container and information in the container pushed by the child process through the communication link; wherein the information includes data and processing flow;

[0020] Calling the main process data processing method, processing the data according to the processing flow, and obtaining the processing result;

[0021] The processing result and the task identifier are returned to the child process via the communication link.

[0022] Optionally, the service in the main process establishes a communication link with the sub-process, including:

[0023] The main process creates the service when it is started;

[0024] A binding request of the subprocess to the service is received, and a communication link with the subprocess is established.

[0025] Optionally, after receiving the task identifier, container, and information in the container pushed by the child process, the method further includes: creating a task copy and a container copy, storing the information in the container copy, and storing the task identifier and the container copy in the task copy;

[0026] The processing of the data according to the processing flow further includes: extracting the data and the processing flow from the container copy, and processing the data according to the processing flow;

[0027] The returning the processing result and the task identifier to the child process further includes: returning the task identifier, the container copy and the processing result in the container copy to the child process.

[0028] Optionally, the service also receives a message pushed by the child process, where the message is a transmission mode;

[0029] The step of returning the processing result and the task identifier to the subprocess via the communication link further comprises:

[0030] When the time taken by the service to process the data is greater than or equal to a predetermined time, the processing result and the task identifier are returned to the child process through the message.

[0031] To achieve the above object, according to another aspect of an embodiment of the present invention, a data processing device is provided, comprising:

[0032] A task creation module is used for the subprocess to respond to the business processing request, create a task, a task identifier and a processing flow, and store the data to be transmitted and the processing flow in the container of the task;

[0033] An information push module, used for calling an interface definition language corresponding to the sub-process, and based on a communication link with a main process service, pushing the task identifier and the container to the service, so that the service processes the data according to the processing flow;

[0034] The result storage module is used to receive the task identifier and processing result returned by the service, and store the processing result in the task container based on the task identifier.

[0035] Optionally, the task creation module is used to: obtain basic information of the task, process the basic information using a hash algorithm, and use the processed hash value as the task identifier; wherein the basic information includes at least a name and attributes.

[0036] Optionally, it also includes a link establishment module, which is used to: establish a communication link with the service through a binding service device; wherein the service is established when the main process is started.

[0037] Optionally, the information push module is used to:

[0038] Processing the task identifier, the container and the information in a serialized manner to obtain a first task identifier sequence, a first container sequence and a first information sequence;

[0039] Based on the communication link with the service, push the first task identification sequence, the first container sequence and the first information sequence to the service;

[0040] In the service, the first task identification sequence, the first container sequence and the first information sequence are processed in a deserialization manner to obtain the task identification, the container and the information.

[0041] Optionally, the task also includes a message, which is a transmission method and is transmitted to the service together with the task identifier, the container and the information through the communication link, and is used to transmit the processing result and the task identifier when the service processes the data for more than a predetermined time.

[0042] Optionally, the interface definition language corresponds to the sub-process one-to-one, and the tasks in the sub-process share the same interface definition language.

[0043] To achieve the above object, according to another aspect of an embodiment of the present invention, another data processing device is provided, comprising:

[0044] An information receiving module, used for the service in the main process to establish a communication link with the sub-process, and to receive the task identifier, container and information in the container pushed by the sub-process through the communication link; wherein the information includes data and processing flow;

[0045] An information processing module is used to call the main process data processing device, process the data according to the processing flow, and obtain a processing result;

[0046] An information feedback module is used to return the processing result and the task identifier to the sub-process through the communication link.

[0047] Optionally, the information receiving module is used to:

[0048] The main process creates the service when it is started;

[0049] A binding request of the subprocess to the service is received, and a communication link with the subprocess is established.

[0050] Optionally, the information receiving module is further used to: create a task copy and a container copy, store the information in the container copy, and store the task identifier and the container copy in the task copy;

[0051] The information processing module is further used to: extract the data and the processing flow from the container copy, and process the data according to the processing flow;

[0052] The information feedback module is further used to return the task identifier, the container copy and the processing result in the container copy to the subprocess.

[0053] Optionally, the service also receives a message pushed by the child process, where the message is a transmission mode;

[0054] The information feedback module is further used to: when the time for the service to process the data is greater than or equal to a predetermined time, return the processing result and the task identifier to the sub-process through the message.

[0055] To achieve the above objective, according to another aspect of an embodiment of the present invention, a data processing electronic device is provided.

[0056] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned data processing methods.

[0057] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above data processing methods is implemented.

[0058] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: by defining a MainTask that implements the Parcelable interface, the task transfer between the child process and the main process is realized. All businesses only need to inherit and implement the three methods of this MainTask, take out the data transferred by the other process from the Bundle, and store the data to be transferred to the other process, so as to realize the data transfer and main process task processing, which greatly simplifies the complexity of inter-process communication.

[0059] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0061] Figure 1 is a main flow chart of a data processing method according to an embodiment of the present invention;

[0062] Figure 2 is a main flow chart of another data processing method according to an embodiment of the present invention;

[0063] Figure 3 is a schematic diagram of a data processing framework according to an embodiment of the present invention;

[0064] Figure 4 is a flowchart of a specific data processing method according to an embodiment of the present invention;

[0065] Figure 5 is a schematic diagram of main modules of a data processing device according to an embodiment of the present invention;

[0066] Figure 6 is a schematic diagram of main modules of another data processing device according to an embodiment of the present invention;

[0067] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0068] Figure 8 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0069] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0070] It should be noted that the present invention is currently only applicable to the Android system. The interface mentioned refers to a page in the application, which is a convenient design of the Android system, and data can be sent and returned data can be received when jumping from one page to another.

[0071] The terms involved in the present invention are explained as follows:

[0072] Service: One of the four basic components of Android, which can run for a long time in the background and provide cross-process access.

[0073] AIDL: A description language used to define the communication interface between the server and the client. It allows users to bind the services of other apps in their own apps so that the two apps can interact with each other.

[0074] Parcelable: Serializes data to achieve data transfer between processes. Serialization is the process of converting an object into a binary sequence that can be transmitted, and deserialization is the reverse process.

[0075] See also Figure 1 , which shows a main flow chart of a data processing method provided by an embodiment of the present invention, comprising the following steps:

[0076] S101: The subprocess responds to the business processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow in a container of the task;

[0077] S102: calling an interface definition language corresponding to the subprocess, and based on a communication link with a main process service, pushing the task identifier and the container to the service, so that the service processes the data according to the processing flow;

[0078] S103: Receive the task identifier and processing result returned by the service, and store the processing result in the task container based on the task identifier.

[0079] In the above implementation, for step S101, a service is established when the main process is started, and the subprocess establishes a persistent link with the Service through the bindService method (used to bind a service), and the link is maintained during the life of the subprocess.

[0080] Each subprocess may contain multiple services that need to interact with the main process. Each service corresponds to a task. Each task contains a data container Bundle to store the necessary data of the service. For example, for the service of connecting to WiFi, the service data is the WiFi name and password. And for different subprocesses, the Bundles of different services are isolated from each other.

[0081] It should be noted that when developing on Android, you cannot pass references to objects (such as data) to Activities or Fragments, so you need to put these objects into an Intent or Bundle and then pass them.

[0082]

[0083] Use the onInit method in the child process to initialize the data that needs to be passed to the main process, store the data in a Bundle and pass it to the main process. The main process can only perform specific business operations after obtaining this data, such as connecting to Wi-Fi based on the name and password.

[0084] In addition to storing the necessary data of the business, the Bundle can also store the processing flow of the business, such as the steps for connecting to wifi, which can be manually input. In addition, each Task also stores a Task ID, which is independent of the Bundle and can be obtained through certain operations, such as using a hash algorithm to process the basic information of the Task, such as the name and attributes, and the resulting hash value is the Task ID.

[0085] For step S102, the child process calls the aidl interface, and pushes the Task ID, container, data in the container, and processing flow in the Task to the main process Service through the established communication link with the main process Service, so that the data is processed according to the processing flow using onMainProcess in the Service to obtain the processing result.

[0086] It should be noted that the present invention abandons the existing method of creating an aidl interface for processing a task in a sub-process, and only establishes a unique aidl interface for a sub-process to communicate with the main process. At this time, all businesses in the sub-process share an aidl interface, and there is no need to redefine the interface.

[0087] The present invention uses the following aidl interface to transfer Bundle data between the main process and the subprocess:

[0088]

[0089] Furthermore, the Task created by the child process to implement specific business inherits from the inter-process communication basic task MainTask, which is a concept in object-oriented programming language. If MainTask is an execution task, the specific Task can be adding a contact list, connecting to wifi, etc. Considering that MainTask is serializable, the information transmitted between processes can be serialized and deserialized. Specifically:

[0090] ① Process the Task ID, Bundle, and the information in the Bundle (including data and processing flow) in a serialized manner to obtain a first Task ID sequence, a first Bundle sequence, and a first information sequence represented in binary form;

[0091] ② Based on the communication link with the Service, the first Task ID sequence, the first Bundle sequence and the first information sequence are pushed to the Service;

[0092] ③ In the Service, the first Task ID sequence, the first Bundle sequence and the first information sequence are processed by deserialization to obtain the Task ID, the Bundle and the information in the Bundle.

[0093] For step S103, after the Service completes processing the data, the child process receives the processing result and task ID returned by the Service, and stores the processing result in the Bundle of the Task through the Task ID.

[0094] In actual operation, when the main process Service processes data, it needs to first build a copy of the Task and a copy of the Bundle. The Task copy is used to store the Task ID and the Bundle copy, and the Bundle copy is used to store data and processing procedures. After receiving the Bundle copy, the processing results in the Bundle copy, and the Task ID returned by the Service, the child process needs to deserialize the copy that created the copy of the Task, extract the Task ID and processing results from it, and then find the original Task through the Task ID, and finally store the processing results in the original Task.

[0095] The original Task stores the processing result in the Bundle through onResult to notify the business. Subsequent businesses can retrieve the processing result from the Bundle to complete the business processing.

[0096] The overall operation process is:

[0097]

[0098]

[0099] The data in the above operations are all completed through the inter-process communication link aidl interface. In actual operation, another transmission method message is also provided. The message is also stored in the Task and transmitted to the main process Service through the communication link along with the Bundle, Task ID, etc. Since the communication link is mainly initiated by the child process and the main process does not have the initiation function, this method can be used for data feedback when the main process takes a long time to process data.

[0100] The method provided in the above embodiment analyzes the data interaction between the sub-process and the main process from the perspective of the sub-process. The sub-process only needs to inherit MainTask in the business task code and implement the onInit and onResult methods. It is unnecessary to add the aidl interface and negotiate the business processing flow with the main process offline, and can easily realize communication with the main process.

[0101] See also Figure 2 , shows a main flow chart of another data processing method according to an embodiment of the present invention, comprising the following steps:

[0102] S201: The service in the main process establishes a communication link with the child process, and receives the task identifier, container and information in the container pushed by the child process through the communication link; wherein the information includes data and processing flow;

[0103] S202: calling the main process data processing method, processing the data according to the processing flow, and obtaining a processing result;

[0104] S203: Return the processing result and the task identifier to the subprocess via the communication link.

[0105] In the above implementation, for step S201, the main process creates a service (Service) when it starts. After receiving the Task ID, Bundle and Bundle data (or task serialization data) pushed by the child process, the Service uses the deserialized CREATOR to create a task copy of the Task.

[0106] It should be noted that only data can be transferred between processes, and the same object cannot be used. Therefore, the data in the Task needs to be restored to the Task copy through a link, and then the actual operation is performed through the Task copy. The Task copy also stores the Task ID and Bundle copy, and the Bundle copy stores the data to be processed and the processing flow.

[0107] For steps S202 to S203, the service Service in the main process calls onMainProcess, takes out data from the Bundle copy of the Task copy, processes it according to the processing flow based on business needs, obtains the processing result, and writes the processing result to the Bundle copy after the processing is completed.

[0108] For example, if there is a service that connects to WiFi in the child process, it must be connected to WiFi in the main process. The overall data interaction process is:

[0109] 1. When the child process Oninit is called, the name and password of the wifi are stored in the Bundle, which is stored in the Task.

[0110] 2. The main process creates a Task copy and a Bundle copy. When OnMainProcess is called, it takes out the WiFi name and password from the Bundle copy, tries to connect to the WiFi and succeeds, and stores the connection result in the Bundle copy.

[0111] 3. The child process creates a copy of the Task copy, uses deserialization to obtain the result of the successful connection executed in the main process from the Bundle copy, and uses onResult to store the result in the Task's Bundle.

[0112] The data in the above operations are all completed through the inter-process communication link aidl interface. In actual operation, the sub-process transmits to the main process Service also includes a transmission method message. When the main process takes too long to process data (exceeds the preset time), the message can be used to return the processing result and task identifier to the sub-process to complete the business processing.

[0113] The method provided in the above embodiment analyzes the data interaction between the main process and the child process from the perspective of the main process. The main process implements the OnMainProcess method to complete data processing. There is no need to negotiate the business processing flow with the child process offline, and there is no need to establish a separate communication link for a task. Communication with the child process can be easily achieved.

[0114] See also Figure 3 , shows a schematic diagram of a framework of data processing according to an embodiment of the present invention, including:

[0115] 1. The child process, such as the client, completes data initialization and processing result storage through the onInit and onResult methods. A child process may contain multiple businesses that need to interact with the main process. Each business corresponds to a Task, and each Task contains a Bundle to store the necessary data for the business.

[0116] 2. The main process provides services to the client, processes data through OnMainProcess, and obtains the processing results. The main process will create a Bundle copy and a Task copy based on the Bundle transmitted by the child process.

[0117] The overall implementation of the three-stage task methods onInit, onMainProcess and onResult:

[0118] onInit initializes, stores the data to be processed in the subprocess task Bundle and pushes it to the main process;

[0119] OnMainProcess Main process data processing. The main process obtains the data in the Bundle and processes it. After the processing is completed, the processing results are written to the Bundle copy.

[0120] onResult returns the result. The child process obtains the result processed by the main process.

[0121] Among them, onInit and onResult are executed in the child process, and onMainProcess is executed in the main process.

[0122] See also Figure 4 , shows a schematic flow chart of a specific data processing method according to an embodiment of the present invention, comprising the following steps:

[0123] 1. The child process establishes a communication link with the main process Service through bindService, which is a long connection;

[0124] 2. The child process responds to the business processing request, creates a Task and Task ID, initializes data into the Task's Bundle, and writes the processing flow into the Bundle;

[0125] 3. The child process calls the aidl interface and pushes the Task ID, Bundle, data in the Bundle, and processing flow to the main process Service through the communication link with the Service;

[0126] 4. Service creates Task copies and Bundle copies, processes data according to the processing flow in the Bundle copy through OnMainProcess, and obtains the processing results;

[0127] 5. After the service completes data processing, it returns the processing result, the Bundle copy, and the Task ID to the child process through the communication link;

[0128] 6. The child process determines the original Task based on the Task ID and uses onResult to store the processing result in the Bundle of the Task.

[0129] The method provided in the embodiment of the present invention realizes the task transfer between the child process and the main process by defining a MainTask that implements the Parcelable interface. All businesses only need to inherit and implement the three methods of this MainTask, extract the data transferred by the other process from the Bundle, and store the data to be transferred to the other process, thereby realizing data transfer and main process task processing, which greatly simplifies the complexity of inter-process communication.

[0130] See also Figure 5 , which shows a schematic diagram of main modules of a data processing device 500 provided in an embodiment of the present invention, including:

[0131] The task creation module 501 is used for the subprocess to respond to the business processing request, create a task, a task identifier and a processing flow, and store the data to be transmitted and the processing flow in the container of the task;

[0132] An information push module 502, configured to call an interface definition language corresponding to the subprocess, and push the task identifier and the container to the service based on a communication link with the main process service, so that the service processes the data according to the processing flow;

[0133] The result storage module 503 is used to receive the task identifier and processing result returned by the service, and store the processing result in the task container based on the task identifier.

[0134] In the implementation device of the present invention, the task creation module 501 is used to: obtain basic information of the task, process the basic information using a hash algorithm, and use the processed hash value as the task identifier; wherein the basic information at least includes a name and attributes.

[0135] The implementation device of the present invention further includes a link establishment module 504 (not shown in the figure), which is used to establish a communication link with the service by binding the service device; wherein the service is established by the main process when it is started.

[0136] The information push module 502 in the implementation device of the present invention is used to:

[0137] Processing the task identifier, the container and the information in a serialized manner to obtain a first task identifier sequence, a first container sequence and a first information sequence;

[0138] Based on the communication link with the service, push the first task identification sequence, the first container sequence and the first information sequence to the service;

[0139] In the service, the first task identification sequence, the first container sequence and the first information sequence are processed in a deserialization manner to obtain the task identification, the container and the information.

[0140] In the implementation device of the present invention, the task also includes a message, which is a transmission method and is transmitted to the service together with the task identifier, the container and the information through the communication link, and is used to transmit the processing result and the task identifier when the service processes the data for more than a predetermined time.

[0141] In the implementation device of the present invention, the interface definition language corresponds to the sub-process one by one, and the tasks in the sub-process share the same interface definition language.

[0142] See also Figure 6 , shows a schematic diagram of main modules of another data processing device 600 provided in an embodiment of the present invention, including:

[0143] The information receiving module 601 is used for the service in the main process to establish a communication link with the sub-process, and receive the task identifier, container and information in the container pushed by the sub-process through the communication link; wherein the information includes data and processing flow;

[0144] The information processing module 602 is used to call the main process data processing device to process the data according to the processing flow to obtain a processing result;

[0145] The information feedback module 603 is used to return the processing result and the task identifier to the sub-process through the communication link.

[0146] In the implementation device of the present invention, the information receiving module 601 is used to:

[0147] The main process creates the service when it is started;

[0148] A binding request of the subprocess to the service is received, and a communication link with the subprocess is established.

[0149] In the implementation device of the present invention, the information receiving module 601 is further used to: create a task copy and a container copy, store the information in the container copy, and store the task identifier and the container copy in the task copy;

[0150] The information processing module 602 is further used to: extract the data and the processing flow from the container copy, and process the data according to the processing flow;

[0151] The information feedback module 603 is further used to return the task identifier, the container copy and the processing result in the container copy to the child process.

[0152] In the implementation device of the present invention, the service also receives a message pushed by the child process, the message being a transmission mode;

[0153] The information feedback module 603 is further used to: when the time for the service to process the data is greater than or equal to a predetermined time, return the processing result and the task identifier to the sub-process through the message.

[0154] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.

[0155] Figure 7 An exemplary system architecture 700 is shown in which embodiments of the present invention may be applied.

[0156] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705 (just an example). Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0157] The user can use the terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 701, 702, 703.

[0158] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0159] The server 705 may be a server that provides various services, such as a background management server that provides support for shopping websites browsed by users using the terminal devices 701 , 702 , and 703 (only as an example).

[0160] It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the device is generally set in the server 705 .

[0161] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0162] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0163] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0164] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0165] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0166] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0167] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0168] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be arranged in a processor, for example, it may be described as: a processor includes a task creation module, an information push module, and a result storage module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the result storage module may also be described as a "result storage module".

[0169] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0170] The subprocess responds to the business processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow in the container of the task;

[0171] Invoke an interface definition language corresponding to the subprocess, and push the task identifier and the container to the service based on the communication link with the main process service, so as to process the data according to the processing flow through the service;

[0172] The task identifier and processing result returned by the service are received, and based on the task identifier, the processing result is stored in a container of the task.

[0173] According to the technical solution of the embodiment of the present invention, by defining a MainTask that implements the Parcelable interface, the task transfer between the child process and the main process is realized. All businesses only need to inherit and implement the three methods of this MainTask, take out the data transferred by the other process from the Bundle, and store the data to be transferred to the other process, so as to realize the data transfer and main process task processing, which greatly simplifies the complexity of inter-process communication.

[0174] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data processing method, characterized in that: include: The subprocess responds to the business processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow in the container of the task; Invoke an interface definition language corresponding to the subprocess, and push the task identifier and the container to the service based on the communication link with the main process service, so as to process the data according to the processing flow through the service; The task identifier and processing result returned by the service are received, and based on the task identifier, the processing result is stored in a container of the task.

2. The method according to claim 1, characterized in that: The creation of tasks, task identification and processing flow include: The basic information of the task is obtained, the basic information is processed by a hash algorithm, and the hash value obtained by the processing is used as the task identifier; wherein the basic information at least includes a name and attributes.

3. The method according to claim 1, characterized in that Before calling the interface definition language corresponding to the sub-process, the method further includes: By binding the service method, a communication link with the service is established; wherein the service is established when the main process is started.

4. The method according to claim 1, characterized in that: The calling of the interface definition language corresponding to the sub-process, based on the communication link with the main process service, pushing the task identifier and the container to the service together, includes: Processing the task identifier, the container and the information in the container in a serialized manner to obtain a first task identifier sequence, a first container sequence and a first information sequence; wherein the information includes the data and the processing flow; Based on the communication link with the service, push the first task identification sequence, the first container sequence and the first information sequence to the service; In the service, the first task identification sequence, the first container sequence and the first information sequence are processed in a deserialization manner to obtain the task identification, the container and the information.

5. The method according to claim 1, characterized in that The task also includes a message, which is a transmission method and is transmitted to the service together with the task identifier, the container and the information in the container through the communication link, and is used to transmit the processing result and the task identifier when the service processes the data for more than a predetermined time.

6. The method according to claim 1, characterized in that The interface definition language corresponds to the sub-process one by one, and the tasks in the sub-process share one interface definition language.

7. A data processing method, characterized in that: include: The service in the main process establishes a communication link with the child process, and receives the task identifier, container and information in the container pushed by the child process through the communication link; wherein the information includes data and processing flow; Calling the main process data processing method, processing the data according to the processing flow, and obtaining the processing result; The processing result and the task identifier are returned to the child process via the communication link.

8. The method according to claim 7, characterized in that The service in the main process establishes a communication link with the subprocess, including: The main process creates the service when it is started; A binding request of the subprocess to the service is received, and a communication link with the subprocess is established.

9. The method according to claim 7, characterized in that: After receiving the task identifier, container, and information in the container pushed by the child process, the process further includes: creating a task copy and a container copy, storing the information in the container copy, and storing the task identifier and the container copy in the task copy; The processing of the data according to the processing flow further includes: extracting the data and the processing flow from the container copy, and processing the data according to the processing flow; The returning the processing result and the task identifier to the child process further includes: returning the task identifier, the container copy and the processing result in the container copy to the child process.

10. The method according to claim 7, characterized in that The service also receives a message pushed by the child process, the message being a transmission mode; The step of returning the processing result and the task identifier to the subprocess via the communication link further comprises: When the time taken by the service to process the data is greater than or equal to a predetermined time, the processing result and the task identifier are returned to the child process through the message.

11. A data processing device, characterized in that: include: A task creation module is used for the subprocess to respond to the business processing request, create a task, a task identifier and a processing flow, and store the data to be transmitted and the processing flow in the container of the task; An information push module, used for calling an interface definition language corresponding to the sub-process, and based on a communication link with a main process service, pushing the task identifier and the container to the service, so that the service processes the data according to the processing flow; The result storage module is used to receive the task identifier and processing result returned by the service, and store the processing result in the task container based on the task identifier.

12. A data processing device, characterized in that: include: An information receiving module, used for the service in the main process to establish a communication link with the sub-process, and to receive the task identifier, container and information in the container pushed by the sub-process through the communication link; wherein the information includes data and processing flow; An information processing module is used to call the main process data processing device, process the data according to the processing flow, and obtain a processing result; An information feedback module is used to return the processing result and the task identifier to the sub-process through the communication link.

13. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 10.

14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Multi-process processing method and device, terminal equipment and computer readable storage medium

    CN110413386A

  • Data transmission method and device

    WO2017041398A1