CN113760561A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN113760561A
CN113760561A CN202010553420.8A CN202010553420A CN113760561A CN 113760561 A CN113760561 A CN 113760561A CN 202010553420 A CN202010553420 A CN 202010553420A CN 113760561 A CN113760561 A CN 113760561A
Authority
CN
China
Prior art keywords
task
service
processing
container
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010553420.8A
Other languages
Chinese (zh)
Inventor
李海峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010553420.8A priority Critical patent/CN113760561A/en
Publication of CN113760561A publication Critical patent/CN113760561A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Landscapes

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

Abstract

The invention discloses a data processing method and device, and relates to the technical field of computers. One embodiment of the method comprises: the sub-process responds to the service processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow into a task container; calling an interface definition language corresponding to the subprocess, and pushing the task identifier and the container to the service together based on a communication link between the interface definition language and the main process service so as to process data according to a processing flow through the service; and receiving the task identifier and the processing result returned by the service, and storing the processing result into a task container based on the task identifier. In the embodiment, the subprocess can easily realize the communication with the main process only by inheriting the MainTask in the task code of the service and realizing the onInit and onResult methods without increasing aidl interfaces and offline service negotiation processing flows with the main process.

Description

Data processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method and apparatus.
Background
In an Android system, if a sub-process needs to use data in a main process, under the condition of an interface, a startActivityForresult mode can be used for data access through interaction of a Bundle (container); however, if there is no interface, data communication needs to be performed through an aidl (Android interface definition language) interface.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
under the condition of no interface, the subprocess needs to negotiate a service processing flow with the main process in an off-line manner in advance, and each time one service is processed, an aidl interface needs to be independently customized to communicate with the main process, so that the operation is complex, and the service expansion is difficult to flexibly realize.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data processing method and apparatus, which can at least solve the problem that a service in a sub-process is difficult to expand in the prior art.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a data processing method including:
the sub-process responds to the service processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow into a container of the task;
calling an interface definition language corresponding to the subprocess, pushing the task identifier and the container to the service together based on a communication link between the interface definition language and a main process service, and processing the data according to the processing flow through the service;
and receiving the task identifier and the processing result returned by the service, and storing the processing result into a container of the task based on the task identifier.
Optionally, the creating of the task, the task identifier, and the processing flow include: acquiring basic information of the task, processing the basic information by utilizing a hash algorithm, and taking a hash value obtained by processing as the task identifier; wherein the basic information at least comprises a name and an attribute.
Optionally, before the invoking the interface definition language corresponding to the sub-process, the method further includes: establishing a communication link with the service through a binding service method; wherein the service is established for the host process at startup.
Optionally, the invoking an interface definition language corresponding to the sub-process, and pushing the task identifier and the container together to a main process service based on a communication link with the service, includes:
processing the task identifier, the container and the information in a serialization mode to obtain a first task identifier sequence, a first container sequence and a first information sequence;
pushing the first task identification sequence, the first container sequence, and the first information sequence together to the service based on a communication link with the service;
and in the service, processing the first task identification sequence, the first container sequence and the first information sequence by utilizing an deserialization mode to obtain the task identification, the container and the information.
Optionally, the task further includes a message, where the message is a transmission mode, and is transmitted to the service together with the task identifier, the container, and the information through the communication link, so as to transmit the processing result and the task identifier when the data processing time of the service exceeds a predetermined time.
Optionally, the interface definition language corresponds to the sub-processes one to one, and the tasks in the sub-processes share one interface definition language.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided another data processing method including:
the method comprises the steps that a service in a main process establishes a communication link with a sub-process, and receives a task identifier, a container and information in the container pushed by the sub-process through the communication link; wherein the information comprises data and a processing flow;
calling a main process data processing method, and processing the data according to the processing flow to obtain a processing result;
and returning the processing result and the task identifier to the sub-process through the communication link.
Optionally, the establishing, by the service in the main process, a communication link with the sub-process includes:
the host process creating the service upon startup;
and receiving a binding request of the sub-process to the service, and establishing a communication link with the sub-process.
Optionally, after receiving the task identifier, the container, and the information in the container pushed by the sub-process, the method further includes: creating a task copy and a container copy, storing the information into the container copy, and storing the task identifier and the container copy into the task copy;
the processing 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 sub-process further includes: and returning the task identifier, the container copy and the processing result in the container copy to the child process.
Optionally, the service further receives a message pushed by the child process, where the message is a transmission mode;
the returning the processing result and the task identifier to the sub-process through the communication link further includes:
and when the time for processing the data by the service is greater than or equal to the preset time, returning the processing result and the task identifier to the subprocess through the message.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a data processing apparatus including:
the task creating module is used for responding to a service processing request by a subprocess, creating a task, a task identifier and a processing flow, and storing data to be transmitted and the processing flow into a container of the task;
the information pushing module is used for calling an interface definition language corresponding to the subprocess, pushing the task identifier and the container to the service together based on a communication link between the information pushing module and a main process service, and processing the data according to the processing flow through the service;
and the result storage module is used for receiving the task identifier and the processing result returned by the service and storing the processing result into a container of the task based on the task identifier.
Optionally, the task creating module is configured to: acquiring basic information of the task, processing the basic information by utilizing a hash algorithm, and taking a hash value obtained by processing as the task identifier; wherein the basic information at least comprises a name and an attribute.
Optionally, the system further includes a link establishing module, configured to: establishing a communication link with the service through a binding service device; wherein the service is established for the host process at startup.
Optionally, the information pushing module is configured to:
processing the task identifier, the container and the information in a serialization mode to obtain a first task identifier sequence, a first container sequence and a first information sequence;
pushing the first task identification sequence, the first container sequence, and the first information sequence together to the service based on a communication link with the service;
and in the service, processing the first task identification sequence, the first container sequence and the first information sequence by utilizing an deserialization mode to obtain the task identification, the container and the information.
Optionally, the task further includes a message, where the message is a transmission mode, and is transmitted to the service together with the task identifier, the container, and the information through the communication link, so as to transmit the processing result and the task identifier when the data processing time of the service exceeds a predetermined time.
Optionally, the interface definition language corresponds to the sub-processes one to one, and the tasks in the sub-processes share one interface definition language.
To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided another data processing apparatus including:
the information receiving module is used for establishing a communication link between the service in the main process and the subprocess and receiving the task identifier pushed by the subprocess, the container and the information in the container through the communication link; wherein the information comprises data and a processing flow;
the information processing module is used for calling a main process data processing device and processing the data according to the processing flow to obtain a processing result;
and the information feedback module is used for returning the processing result and the task identifier to the subprocess through the communication link.
Optionally, the information receiving module is configured to:
the host process creating the service upon startup;
and receiving a binding request of the sub-process to the service, and establishing a communication link with the sub-process.
Optionally, the information receiving module is further configured to: creating a task copy and a container copy, storing the information into the container copy, and storing the task identifier and the container copy into the task copy;
the information processing module is further configured to: extracting the data and the processing flow from the container copy, and processing the data according to the processing flow;
the information feedback module is further configured to: and returning the task identifier, the container copy and the processing result in the container copy to the child process.
Optionally, the service further receives a message pushed by the child process, where the message is a transmission mode;
the information feedback module is further configured to: and when the time for processing the data by the service is greater than or equal to the preset time, returning the processing result and the task identifier to the subprocess through the message.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a data processing electronic device.
The electronic device of the embodiment of the invention comprises: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement any of the data processing methods described above.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program implementing any of the data processing methods described above when executed by a processor.
According to the scheme provided by the invention, one embodiment of the invention has the following advantages or beneficial effects: the task transmission between the sub-process and the main process is realized by defining a MainTask realizing a Parcelable interface. All services only need to inherit and realize the three methods of the MainTask, take out the data transmitted by the process of the opposite side from the Bundle, and store the data to be transmitted to the process of the opposite side, so as to realize the data transmission and the task processing of the main process, thereby greatly simplifying the complexity of the communication between the processes.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic main flow chart of a data processing method according to an embodiment of the present invention;
FIG. 2 is a schematic main flow chart of another data processing method according to an embodiment of the present invention;
FIG. 3 is a block diagram of a data processing framework according to an embodiment of the invention;
FIG. 4 is a flow chart diagram of a particular data processing method according to an embodiment of the invention;
FIG. 5 is a schematic diagram of the main blocks of a data processing apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the main blocks of another data processing apparatus according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 8 is a schematic block diagram of a computer system suitable for use with a mobile device or server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the present invention is only applicable to the Android system. The mentioned interface refers to a page in the application, which is a convenient design of the Android system, and can send data and receive return data when jumping from one page to another.
The words to which the invention relates are to be construed as follows:
service (Service): one of the four basic components of Android can run for a long time in the background, providing cross-process access.
AIDL: a description language for defining communication interfaces between a server and a client is used, and the function of the description language is that a user can bind the service of other APPs in the APP of the user, so that the APPs of the user and the APP of the user can interact.
Parcellable: and serializing data to realize data transmission among processes. Serialization is the process of converting an object into a binary sequence that can be transmitted, and deserialization is the reverse process.
Referring to fig. 1, a main flowchart of a data processing method according to an embodiment of the present invention is shown, which includes the following steps:
s101: the sub-process responds to the service processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow into a container of the task;
s102: calling an interface definition language corresponding to the subprocess, pushing the task identifier and the container to the service together based on a communication link between the interface definition language and a main process service, and processing the data according to the processing flow through the service;
s103: and receiving the task identifier and the processing result returned by the service, and storing the processing result into a container of the task based on the task identifier.
In the above embodiment, for step S101, a Service (Service) is established when the main process is started, and the sub-process establishes a persistent link with the Service by using a binding Service, where the link is maintained during the lifetime of the sub-process.
Each sub-process may include a plurality of services that need to interact with the main process, each service corresponds to a Task (Task), each Task includes a data container Bundle for storing necessary data of the service, such as wifi-connected services, and the service data is a name and a password of wifi. And for different sub-processes, the bundles of different services are isolated from each other.
It should be noted that, when Android development is performed, references of objects (such as data) cannot be transmitted to Activities or Fragments, so that the objects need to be placed into an Intent or Bundle and then transmitted.
Figure BDA0002543406370000081
And initializing data needing to be transmitted to the main process by using an onInit method in the subprocess so as to store the data into a Bundle and transmit the data to the main process. The host process can perform specific business operations only after acquiring the data, such as wifi connection according to names and passwords.
Besides the necessary data of the service, the Bundle can also store a processing flow of the service, such as an operation step of connecting wifi, and the processing flow can be input manually. In addition, each Task also stores a Task ID, the Task ID and Bundle are independent from each other and can be obtained through a certain operation, for example, the hash algorithm is used for processing basic information such as the name and the attribute of the Task, and the obtained hash value is the Task ID.
For step S102, the sub-process calls the aidl interface, and pushes the Task ID in the Task, the container, and the data in the container to the main process Service together with the processing flow through the established communication link with the main process Service, so as to process the data according to the processing flow by using the onMainProcess in the Service, thereby obtaining the processing result.
It should be noted that, in the present invention, a mode of creating an aidl interface by processing a task in an existing sub-process is abandoned, and only one aidl interface communicating with the main process is created for one sub-process, and at this time, all services in the sub-process share one aidl interface without redefining the interface.
The invention uses the following aidl interface to transmit Bundle data between the main process and the subprocess:
Figure BDA0002543406370000091
further, the Task for realizing the specific service established by the sub-process is inherited from the interprocess communication basic Task MainTask, which is a concept of an object-oriented programming language. If the MainTask is to perform a Task, the specific Task may be to add an address list, connect wifi, etc. Consider that the MainTask is serializable, so the information transmitted between processes can be serialized and deserialized, specifically:
processing information (including data and processing flow) in a Task ID, Bundle and Bundle by using a serialization mode to obtain a first Task ID sequence, a first Bundle sequence and a first information sequence represented by a binary system;
based on the communication link with the Service, pushing the first Task ID sequence, the first Bundle sequence and the first information sequence to the Service together;
thirdly, in Service, the first Task ID sequence, the first Bundle sequence and the first information sequence are processed in an deserialization mode to obtain information in the Task ID, the Bundle and the Bundle.
For step S103, after the Service processes the data, the sub-process receives the processing result and the Task identifier returned by the Service, and stores the processing result in the Bundle of the Task through the Task ID.
In actual operation, when the host process Service processes data, a Task copy and a Bundle copy need to be constructed first, the Task copy is used for storing a Task ID and a Bundle copy, and the Bundle copy is used for storing data and a processing flow. After receiving the Bundle copy returned by the Service, the processing result in the Bundle copy and the Task ID, the child process needs to deserialize to create a copy of the Task copy, take out the Task ID and the processing result, then find the original Task through the Task ID, and finally store the processing result in the original Task.
The original Task stores the processing result in the Bundle through the onResult to notify the service, and the subsequent service can take the processing result out of the Bundle to complete the service processing.
The whole operation flow is as follows:
Figure BDA0002543406370000101
Figure BDA0002543406370000111
the data in the above operations are all completed through the communication link aidl interface between the processes, and another transmission mode message is provided in the actual operation. The message is also stored in the Task and transmitted to the host process Service along with the Bundle, the Task ID, etc. via the communication link. Since the communication link is mainly initiated by the sub-process and the main process does not have an initiating function, the data feedback can be performed by using the method when the main process processes data for a long time.
The method provided by the embodiment analyzes the data interaction between the subprocess and the main process from the perspective of the subprocess, the subprocess only needs to inherit the MainTask in the task code of the service and realizes the onInit and onResult methods, and the communication with the main process can be easily realized without increasing aidl interfaces and offline service processing procedures negotiated with the main process.
Referring to fig. 2, a schematic main flow chart of another data processing method according to an embodiment of the present invention is shown, including the following steps:
s201: the method comprises the steps that a service in a main process establishes a communication link with a sub-process, and receives a task identifier, a container and information in the container pushed by the sub-process through the communication link; wherein the information comprises data and a processing flow;
s202: calling a main process data processing method, and processing the data according to the processing flow to obtain a processing result;
s203: and returning the processing result and the task identifier to the sub-process through the communication link.
In the above embodiment, in step S201, the main process creates a Service (Service) at startup, and the Service creates a Task copy of the Task using the deserializer after receiving the Task ID, Bundle, and Bundle data (or Task serialization data) pushed by the sub-process.
It should be noted that only data can be transferred between processes, and the same object cannot be used, so that data in the Task needs to be restored to the Task copy through a link, and then actual operation is executed through the Task copy. The Task copy also stores a Task ID and a Bundle copy, and the Bundle copy stores data to be processed and a processing flow.
For steps S202 to S203, the Service in the main process calls onMainProcess, takes out data from the Bundle copy of the Task copy, processes the data according to the Service requirement and the processing flow to obtain a processing result, and writes the processing result into the Bundle copy after the processing is completed.
For example, there is a service connected to wifi in the sub-process, and wifi must be connected in the main process, and the whole data interaction process is as follows:
1. and storing the name and the password of the wifi into the Bundle when the subprocess is Oninit, wherein the Bundle is stored in the Task.
2. And the main process establishes a Task copy and a Bundle copy, takes out the name and the password of the wifi from the Bundle copy when the OnMainProcess, tries to connect the wifi and succeeds, and stores the connection result into the Bundle copy.
3. And the sub-process creates a copy of the Task copy, acquires a successful connection result executed in the main process from the Bundle copy by using deserialization, and stores the result into the Bundle of the Task by using the onResult.
The data in the above operations are all completed through the communication link aidl interface between the processes, and the sub-process is transmitted to the main process Service in the actual operation, and the transmission mode message is also included. The message may return the processing result and the task identifier to the sub-process through the message when the main process processes the data for too long (exceeds a predetermined time), thereby completing the service processing.
According to the method provided by the embodiment, the data interaction between the main process and the sub-process is analyzed from the perspective of the main process, the main process realizes the OnMainProcess method to complete data processing, offline negotiation of a business processing flow with the sub-process is not needed, and communication between the main process and the sub-process can be easily realized without establishing a communication link for a task.
Referring to fig. 3, a block diagram illustrating data processing according to an embodiment of the present invention is shown, including:
1. and the sub-process, such as a client, completes data initialization and processing result storage through the ONInit and the ONResult methods. A sub-process may include a plurality of services that need to interact with the main process, each service corresponds to a Task, and each Task includes a Bundle to store necessary data of the service.
2. And the main process provides Service for the client, processes data through the OnMainProcess and obtains a processing result. The main process can create a Bundle copy and a Task copy according to the Bundle transmitted by the sub-process.
The method onInit, onMainProcess and onResult which integrally realize three phases of the task:
initializing the onInit, storing data to be processed into a subprocess task Bundle and pushing the data to a main process;
OnMainProcess host Process data processing. And the main process acquires and processes the data in the Bundle, and writes a processing result into the Bundle copy after the processing is finished.
And returning an onResult result. The sub-process obtains the result processed by the main process.
Wherein the onInit and the onResult are executed in the sub-process, and the onMainProcess is executed in the main process.
Referring to fig. 4, a flow chart of a specific data processing method according to an embodiment of the present invention is shown, including the following steps:
1. the sub-process establishes a communication link with the main process Service through the bindService, wherein the link is long connection;
2. the subprocess responds to the service processing request, creates a Task and a Task ID, initializes data to a Bundle of the Task, and writes a processing flow into the Bundle;
3. the subprocess calls an aidl interface, and pushes the data in the Task ID, the Bundle and the processing flow to the main process Service through the communication link between the subprocess and the Service;
4. the Service creates a Task copy and a Bundle copy, and processes data according to the processing flow in the Bundle copy through the OnMainProcess to obtain a processing result;
5. after the data processing of the service is finished, the processing result, the Bundle copy and the Task ID are returned to the sub-process together through the communication link;
6. and the child process determines the original Task according to the Task ID, and stores the processing result into the Bundle of the Task by using the onResult.
The method provided by the embodiment of the invention realizes the task transmission between the sub-process and the main process by defining the MainTask realizing the Parcelable interface. All services only need to inherit and realize the three methods of the MainTask, take out the data transmitted by the process of the opposite side from the Bundle, and store the data to be transmitted to the process of the opposite side, so as to realize the data transmission and the task processing of the main process, thereby greatly simplifying the complexity of the communication between the processes.
Referring to fig. 5, a schematic diagram of main modules of a data processing apparatus 500 according to an embodiment of the present invention is shown, including:
a task creating module 501, configured to respond to a service processing request by a sub-process, create a task, a task identifier, and a processing flow, and store data to be transmitted and the processing flow in a container of the task;
an information pushing module 502, configured to invoke an interface definition language corresponding to the sub-process, and push the task identifier and the container to a main process service together based on a communication link with the service, so as to process the data according to the processing flow through the service;
and a result storage module 503, configured to receive the task identifier and the processing result returned by the service, and store the processing result in a container of the task based on the task identifier.
In the device for implementing the present invention, the task creating module 501 is configured to: acquiring basic information of the task, processing the basic information by utilizing a hash algorithm, and taking a hash value obtained by processing as the task identifier; wherein the basic information at least comprises a name and an attribute.
The apparatus further includes a link establishing module 504 (not shown) for: establishing a communication link with the service through a binding service device; wherein the service is established for the host process at startup.
The information pushing module 502 in the apparatus for implementing the present invention is configured to:
processing the task identifier, the container and the information in a serialization mode to obtain a first task identifier sequence, a first container sequence and a first information sequence;
pushing the first task identification sequence, the first container sequence, and the first information sequence together to the service based on a communication link with the service;
and in the service, processing the first task identification sequence, the first container sequence and the first information sequence by utilizing an deserialization mode to obtain the task identification, the container and the information.
In the device for implementing the present invention, the task further includes a message, where the message is a transmission mode, 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 data processing time of the service exceeds a predetermined time.
In the implementation device of the present invention, the interface definition language corresponds to the sub-processes one by one, and the tasks in the sub-processes share one interface definition language.
Referring to fig. 6, a schematic diagram of main modules of another data processing apparatus 600 provided in the embodiment of the present invention is shown, including:
an information receiving module 601, configured to establish a communication link with a sub-process by a service in a main process, and receive, through the communication link, a task identifier pushed by the sub-process, a container, and information in the container; wherein the information comprises data and a processing flow;
the information processing module 602 is configured to invoke a main process data processing apparatus, and process the data according to the processing flow to obtain a processing result;
an information feedback module 603, configured to return the processing result and the task identifier to the sub-process through the communication link.
In the device for implementing the present invention, the information receiving module 601 is configured to:
the host process creating the service upon startup;
and receiving a binding request of the sub-process to the service, and establishing a communication link with the sub-process.
In the device for implementing the present invention, the information receiving module 601 is further configured to: creating a task copy and a container copy, storing the information into the container copy, and storing the task identifier and the container copy into the task copy;
the information processing module 602 is further configured to: extracting the data and the processing flow from the container copy, and processing the data according to the processing flow;
the information feedback module 603 is further configured to: and returning the task identifier, the container copy and the processing result in the container copy to the child process.
In the implementation device of the invention, the service also receives a message pushed by the subprocess, wherein the message is a transmission mode;
the information feedback module 603 is further configured to: and when the time for processing the data by the service is greater than or equal to the preset time, returning the processing result and the task identifier to the subprocess through the message.
In addition, the detailed implementation of the device in the embodiment of the present invention has been described in detail in the above method, so that the repeated description is not repeated here.
FIG. 7 illustrates an exemplary system architecture 700 to which embodiments of the invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704 and a server 705 (by way of example only). The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 701, 702, 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703.
It should be noted that the method provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. 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 necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a task creating module, an information pushing module and a result storing module. Where the names of these modules do not in some cases constitute a limitation on the module itself, for example, the result storage module may also be described as a "store results module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
the sub-process responds to the service processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow into a container of the task;
calling an interface definition language corresponding to the subprocess, pushing the task identifier and the container to the service together based on a communication link between the interface definition language and a main process service, and processing the data according to the processing flow through the service;
and receiving the task identifier and the processing result returned by the service, and storing the processing result into a container of the task based on the task identifier.
According to the technical scheme of the embodiment of the invention, the task transmission between the sub-process and the main process is realized by defining the MainTask realizing the Parcelable interface. All services only need to inherit and realize the three methods of the MainTask, take out the data transmitted by the process of the opposite side from the Bundle, and store the data to be transmitted to the process of the opposite side, so as to realize the data transmission and the task processing of the main process, thereby greatly simplifying the complexity of the communication between the processes.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A data processing method, comprising:
the sub-process responds to the service processing request, creates a task, a task identifier and a processing flow, and stores the data to be transmitted and the processing flow into a container of the task;
calling an interface definition language corresponding to the subprocess, pushing the task identifier and the container to the service together based on a communication link between the interface definition language and a main process service, and processing the data according to the processing flow through the service;
and receiving the task identifier and the processing result returned by the service, and storing the processing result into a container of the task based on the task identifier.
2. The method of claim 1, wherein the creating tasks, task identifiers, and process flows comprise:
acquiring basic information of the task, processing the basic information by utilizing a hash algorithm, and taking a hash value obtained by processing as the task identifier; wherein the basic information at least comprises a name and an attribute.
3. The method of claim 1, further comprising, prior to said invoking an interface definition language corresponding to said sub-process:
establishing a communication link with the service through a binding service method; wherein the service is established for the host process at startup.
4. The method of claim 1, wherein the invoking an interface definition language corresponding to the sub-process, pushing the task identifier and the container together to a host process service based on a communication link with the service, comprises:
processing the task identifier, the container and the information in a serialization mode to obtain a first task identifier sequence, a first container sequence and a first information sequence;
pushing the first task identification sequence, the first container sequence, and the first information sequence together to the service based on a communication link with the service;
and in the service, processing the first task identification sequence, the first container sequence and the first information sequence by utilizing an deserialization mode to obtain the task identification, the container and the information.
5. The method of claim 1, wherein the task further comprises a message, the message being a transmission, transmitted to the service together with the task identifier, the container, and the information via the communication link, for transmitting the processing result and the task identifier when the service processes the data for more than a predetermined time.
6. The method of claim 1, wherein the interface definition language corresponds to the sub-processes one to one, and the tasks in the sub-processes share one interface definition language.
7. A data processing method, comprising:
the method comprises the steps that a service in a main process establishes a communication link with a sub-process, and receives a task identifier, a container and information in the container pushed by the sub-process through the communication link; wherein the information comprises data and a processing flow;
calling a main process data processing method, and processing the data according to the processing flow to obtain a processing result;
and returning the processing result and the task identifier to the sub-process through the communication link.
8. The method of claim 7, wherein the service in the main process establishes a communication link with the sub-process, comprising:
the host process creating the service upon startup;
and receiving a binding request of the sub-process to the service, and establishing a communication link with the sub-process.
9. The method according to claim 7, further comprising, after the receiving information in task identification, container and container pushed by the sub-process: creating a task copy and a container copy, storing the information into the container copy, and storing the task identifier and the container copy into the task copy;
the processing 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 sub-process further includes: and returning the task identifier, the container copy and the processing result in the container copy to the child process.
10. The method of claim 7, wherein the service further receives a message pushed by the child process, wherein the message is a transmission mode;
the returning the processing result and the task identifier to the sub-process through the communication link further includes:
and when the time for processing the data by the service is greater than or equal to the preset time, returning the processing result and the task identifier to the subprocess through the message.
11. A data processing apparatus, comprising:
the task creating module is used for responding to a service processing request by a subprocess, creating a task, a task identifier and a processing flow, and storing data to be transmitted and the processing flow into a container of the task;
the information pushing module is used for calling an interface definition language corresponding to the subprocess, pushing the task identifier and the container to the service together based on a communication link between the information pushing module and a main process service, and processing the data according to the processing flow through the service;
and the result storage module is used for receiving the task identifier and the processing result returned by the service and storing the processing result into a container of the task based on the task identifier.
12. A data processing apparatus, comprising:
the information receiving module is used for establishing a communication link between the service in the main process and the subprocess and receiving the task identifier pushed by the subprocess, the container and the information in the container through the communication link; wherein the information comprises data and a processing flow;
the information processing module is used for calling a main process data processing device and processing the data according to the processing flow to obtain a processing result;
and the information feedback module is used for returning the processing result and the task identifier to the subprocess through the communication link.
13. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-10.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-10.
CN202010553420.8A 2020-06-17 2020-06-17 Data processing method and device Pending CN113760561A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010553420.8A CN113760561A (en) 2020-06-17 2020-06-17 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010553420.8A CN113760561A (en) 2020-06-17 2020-06-17 Data processing method and device

Publications (1)

Publication Number Publication Date
CN113760561A true CN113760561A (en) 2021-12-07

Family

ID=78785468

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010553420.8A Pending CN113760561A (en) 2020-06-17 2020-06-17 Data processing method and device

Country Status (1)

Country Link
CN (1) CN113760561A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115964181A (en) * 2023-03-10 2023-04-14 之江实验室 Data processing method and device, storage medium and electronic equipment
CN117056086A (en) * 2023-10-11 2023-11-14 国网山东省电力公司滨州市滨城区供电公司 Fault detection method, system, terminal and storage medium based on permutation entropy algorithm

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017041398A1 (en) * 2015-09-08 2017-03-16 安一恒通(北京)科技有限公司 Data transmission method and device
CN110413386A (en) * 2019-06-27 2019-11-05 深圳市富途网络科技有限公司 Multiprocessing method, apparatus, terminal device and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017041398A1 (en) * 2015-09-08 2017-03-16 安一恒通(北京)科技有限公司 Data transmission method and device
CN110413386A (en) * 2019-06-27 2019-11-05 深圳市富途网络科技有限公司 Multiprocessing method, apparatus, terminal device and computer readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MOTOSHI HORII: "Stateful process migration for edge computing applications", IEEE, 11 June 2018 (2018-06-11) *
包小明;吴晓;张海辉;程广亮;: "一种企业服务总线的设计与实现", 计算机应用, no. 03, 1 March 2008 (2008-03-01) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115964181A (en) * 2023-03-10 2023-04-14 之江实验室 Data processing method and device, storage medium and electronic equipment
CN117056086A (en) * 2023-10-11 2023-11-14 国网山东省电力公司滨州市滨城区供电公司 Fault detection method, system, terminal and storage medium based on permutation entropy algorithm

Similar Documents

Publication Publication Date Title
CN107844324B (en) Client page jump processing method and device
CN109995801B (en) Message transmission method and device
CN113760561A (en) Data processing method and device
CN110888639A (en) Business code compiling and packaging method and device
CN108804442B (en) Serial number generation method and device
CN113760487B (en) Service processing method and device
CN113779122B (en) Method and device for exporting data
CN111142972B (en) Method, apparatus, system, and medium for extending functions of application program
CN113765983A (en) Site service deployment method and device
CN109669679B (en) Service detection and processing method and device and electronic equipment
CN113254825A (en) Page generation method and device, electronic equipment and storage medium
CN110909269B (en) Log reporting method and device
CN112099841A (en) Method and system for generating configuration file
CN113448960A (en) Method and device for importing form file
CN112860447A (en) Interaction method and system between different applications
CN112559001A (en) Method and device for updating application
CN112068853A (en) Cross-project synchronous updating method and device
CN113765868B (en) Service processing method and device
CN111125676B (en) Joint authorization method and device
CN114202046B (en) Method, device, equipment and medium for generating two-dimension code based on SAP system
CN112311833B (en) Data updating method and device
CN109388536B (en) Data collection method and device
CN113946458A (en) Method and device for realizing client proxy
CN117675897A (en) Application interaction method, device, equipment and storage medium
CN112988408A (en) Multi-terminal interaction method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination