Data distribution service communication control method and related device
By monitoring the operations of the target entity during DDS communication, the program crash problem caused by the uncertainty of the entity creation and release order is solved, and the reliable operation of the program is achieved.
Patent Information
- Application Number
- CN202410875840.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2026-01-06
AI Technical Summary
In DDS communication, the uncertainty of the order of entity creation and release can cause program crashes.
By monitoring the operations of the target entity in real time during DDS communication, it can be determined whether other entities associated with it have already performed the target operation, thus ensuring the correctness of the creation and release order.
This ensures the order of creation and release between entities, preventing program crashes and guaranteeing reliable program operation.
Smart Images

Figure CN121284088A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a data distribution service communication control method and related apparatus. Background Technology
[0002] Data Distribution Service (DDS) communication is a next-generation distributed real-time communication middleware protocol. It adopts a publish / subscribe architecture, is data-centric, and provides rich Quality of Service (QoS) policies to ensure real-time, efficient, and flexible data distribution, thereby meeting the needs of various distributed real-time communication applications.
[0003] In DDS communication, four entities are created: Participant, Topic, Reader, and Writer. The creation of Reader and Writer depends on Participant and Topic, and the destruction of Reader and Writer depends on Participant; the creation and destruction of Topic also depend on Participant.
[0004] In normal communication, the creation order of Participant, Topic, Reader, and Writer is as follows: Figure 1 As shown, the release order of Participant, Topic, Reader, and Writer is indeterminate. For example, their release order could be as follows: Figure 2 As shown, however, in some communication scenarios, it is impossible to actively control the creation and release order of Participant, Topic, Reader, and Writer, making the creation and release order of Participant, Topic, Reader, and Writer uncertain. This can lead to a problem, for example, when a Reader is created before a Participant is created, or when a Participant is released before a Reader is released, the program may crash. Summary of the Invention
[0005] In view of the above problems, this application provides a data distribution service communication control method and related apparatus to solve the problem of program crashes caused by incorrect entity creation and release order. The specific solution is as follows:
[0006] The first aspect of this application provides a data distribution service communication control method, including:
[0007] A data distribution service communication control method, applied in the DDS communication process, includes:
[0008] When it is determined that a target operation needs to be performed on a target entity, it is determined whether the target operation has already been performed on other entities associated with the target entity, the target operation including a creation operation or a release operation;
[0009] If the target operation is not performed on the other entities, the target operation will be performed on the target entity only after the target operation has been performed on the other entities.
[0010] When the target operation has already been performed on the other entities, the target operation is performed on the target entity.
[0011] Optionally, in the above data distribution service communication control method, determining whether the target operation has been performed on other entities associated with the target entity includes:
[0012] Based on the registered entities in the created context variables, it is determined whether the target operation has been performed on other entities associated with the target entity. During DDS communication, each time an entity is created, the created entity is registered in the context variables, and each time an entity is released, the released entity is deregistered from the context variables.
[0013] Optionally, in the above data distribution service communication control method, when the target operation is a creation operation, other entities associated with the target entity refer to other entities that need to be created before the target entity; when the target operation is a release operation, other entities associated with the target entity refer to other entities that need to be released before the target entity.
[0014] Optionally, in the above data distribution service communication control method, when the target operation is a creation operation, determining whether the target operation has been performed on other entities associated with the target entity based on the registered entities in the created context variables includes:
[0015] Determine whether any other entities associated with the target entity are registered in the context variables;
[0016] If the other entity is not registered in the context variable, it is determined that the creation operation was not performed on the other entity associated with the target entity.
[0017] When the other entity has been registered in the context variable, it is determined that the creation operation has been performed on the other entity associated with the target entity.
[0018] Optionally, in the above data distribution service communication control method, when the target operation has not been performed on the other entities, the target operation is performed on the target entity only after the target operation has been performed on the other entities, including...
[0019] If no other entity is registered in the context variables, determine whether there is an entity that is associated with the other entity;
[0020] If no entity is associated with the other entities, the target entity to be created will be created after the other entities are created.
[0021] If there is an entity that is associated with the other entity, the other entity is taken as the target entity, and the process of determining whether other entities associated with the target entity are registered in the context variable and subsequent steps is executed until the target entity to be created is completed.
[0022] Optionally, in the above data distribution service communication control method, when the target operation is a release operation, determining whether the target operation has been performed on other entities associated with the target entity based on the registered entities in the created context variables includes:
[0023] Determine whether any other entities associated with the target entity are registered in the context variables;
[0024] When the other entities are registered in the context variable, it is determined that the release operation has not been performed on the other entities associated with the target entity;
[0025] If the other entity is not registered in the context variable, it is determined that the release operation has been performed on other entities associated with the target entity.
[0026] Optionally, in the above data distribution service communication control method, when the target operation has not been performed on the other entities, the target operation is performed on the target entity only after the target operation has been performed on the other entities, including...
[0027] When the context variable contains other entities, determine whether there are any entities that are associated with those other entities;
[0028] If there is no entity that is associated with the other entities, the target entity to be released will be released after the other entities are released.
[0029] If there is an entity that is associated with the other entity, the other entity is taken as the target entity, and the process of determining whether other entities associated with the target entity are registered in the context variable and subsequent steps is executed until the target entity to be released is released.
[0030] Optionally, in the above data distribution service communication control method, when the target operation is a creation operation, the target entity includes a topic, a writer, and a reader; when the target entity is a topic, other entities associated with the topic include participants; when the target entity is a writer or a reader, other entities associated with the writer or reader include the topic.
[0031] When the target operation is a release operation, the target entity includes the participant, and other entities associated with the participant include the topic, writer, and reader.
[0032] A data distribution service communication control device, applied in the DDS communication process, includes:
[0033] The determination unit is used to determine whether the target operation has already been performed on other entities associated with the target entity when it is determined that a target operation needs to be performed on the target entity. The target operation includes a creation operation or a release operation.
[0034] The first execution unit is configured to execute the target operation on the target entity only after the target operation has been executed on the other entities, when the target operation has not been executed on the other entities.
[0035] The second execution unit is configured to execute the target operation on the target entity when the target operation has already been executed on the other entities.
[0036] A computer program product includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the data distribution service communication control method as described in any of the preceding claims.
[0037] An electronic device includes at least one processor and a memory connected to the processor, wherein:
[0038] The memory is used to store computer programs;
[0039] The processor is used to execute the computer program to enable the electronic device to implement the data distribution service communication control method as described in any of the above.
[0040] A computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the data distribution service communication control method as described in any one of the preceding claims.
[0041] By employing the above technical solution, the solution provided in this application pre-configures the target entities to be monitored under each target operation. During DDS communication, it monitors in real time whether a target operation needs to be performed on the target entity. When a target operation needs to be performed on the target entity, it first determines whether other entities associated with the target entity have already performed the target operation. If other entities have already performed the target operation, the target operation can be performed directly on the target entity. If there are other entities associated with the target entity that have not performed the target operation, the target operation is performed on the target entity only after the other entities have completed their target operations. This ensures the creation and release order between the target entity and other entities, guaranteeing the reliable operation of the program. Attached Figure Description
[0042] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0043] Figure 1 A diagram illustrating the creation order of Participant, Topic, Reader, and Writer in an existing DDS communication scheme;
[0044] Figure 2 This diagram illustrates the release order of Participant, Topic, Reader, and Writer in an existing DDS communication scheme.
[0045] Figure 3 This is a schematic diagram of an implementation system architecture for the data distribution service communication control method provided in this embodiment;
[0046] Figure 4 A schematic diagram of a terminal structure provided in an embodiment of this application;
[0047] Figure 5 A schematic diagram of a server structure provided in an embodiment of this application;
[0048] Figure 6 A flowchart illustrating a data distribution service communication control method provided in an embodiment of this application;
[0049] Figure 7This is a flowchart illustrating a data distribution service communication control method disclosed in another embodiment of this application;
[0050] Figure 8 This is a flowchart illustrating a data distribution service communication control method disclosed in another embodiment of this application;
[0051] Figure 9 This is a schematic diagram of a process for determining whether other entities have been released, as disclosed in an embodiment of this application;
[0052] Figure 10 This is a schematic diagram of the process for releasing a Participant as disclosed in an embodiment of this application;
[0053] Figure 11 This is a schematic diagram of the process for releasing the reader (Writer) as disclosed in an embodiment of this application;
[0054] Figure 12 This is a flowchart illustrating the release of a Topic as disclosed in an embodiment of this application;
[0055] Figure 13 This is a schematic diagram of the process for releasing the writer (Reader) as disclosed in an embodiment of this application;
[0056] Figure 14 This is a flowchart illustrating a data distribution service communication control method disclosed in another embodiment of this application;
[0057] Figure 15 A schematic diagram of the structure of a data distribution service communication control device provided in an embodiment of this application;
[0058] Figure 16 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0059] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0060] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0061] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0062] This application provides a data distribution service communication control scheme that can be applied to DDS communication. The following sections introduce several applicable scenarios of the data distribution service communication control scheme of this application.
[0063] Financial Trading Systems: Financial markets generate massive amounts of trading data, demanding extremely high real-time performance and reliability. DDS (Distributed Data System) provides high-speed read / write capabilities and high availability by distributing data across multiple nodes, ensuring the security and consistency of trading data. Furthermore, DDS can perform real-time analysis of trading data, assisting financial institutions in risk control and decision support.
[0064] Internet of Things (IoT): In IoT applications, DDS is used to store and manage massive amounts of sensor data. IoT devices are typically distributed across different geographical locations, generating huge volumes of data with high real-time requirements. DDS achieves efficient data acquisition, storage, and transmission by distributing data across edge nodes.
[0065] In addition, the data distribution service communication control scheme of this application can also be applied to other scenarios, such as big data analysis, medical and health scenarios, etc., which will not be described in detail here.
[0066] The data distribution service communication control method provided in this application can be applied to, for example... Figure 3 The diagram shows a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers (…). Figure 3 (The example includes a server), and the server 200 can provide the method provided in the embodiments of this application to one or more terminals.
[0067] Both terminal 100 and server 200 can be used independently to execute the data distribution service communication control method provided in this application embodiment. Terminal 110 and server 120 can also be used collaboratively to execute the data distribution service communication control method provided in this application embodiment.
[0068] The following description Figure 3 The product form of the mid-terminal 100;
[0069] The terminal 100 in this application embodiment can be a mobile phone, tablet computer, wearable device, vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc., and this application embodiment does not impose any restrictions on it.
[0070] Figure 4 A schematic diagram of an optional hardware structure for terminal 100 is shown.
[0071] refer to Figure 4 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a headphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190, and other components. Those skilled in the art will understand that... Figure 4 These are merely examples of terminals or multi-functional devices and do not constitute a limitation on terminals or multi-functional devices. They may include more or fewer components than shown in the illustration, or combine certain components, or use different components.
[0072] The input unit 130 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the portable multi-functional device. Specifically, the input unit 130 may include a touchscreen 131 (optional) and / or other input devices 132. The touchscreen 131 can collect touch operations performed by the user on or near it (such as operations performed by the user using fingers, knuckles, styluses, or any suitable object on or near the touchscreen), and drive the corresponding connection devices according to a pre-set program. The touchscreen can detect the user's touch actions, convert the touch actions into touch signals and send them to the processor 170, and can receive and execute commands sent by the processor 170; the touch signal includes at least touch point coordinate information. The touchscreen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, various types of touchscreens, such as resistive, capacitive, infrared, and surface acoustic wave, can be used to implement the touchscreen. Besides the touchscreen 131, the input unit 130 may also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0073] Among them, the input device 132 can receive input data, etc.
[0074] The display unit 140 can be used to display information input by the user or information provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In this embodiment, the display unit 140 can be used to display the interface of data distribution service communication, processing results, etc.
[0075] The memory 120 can be used to store instructions and data. The memory 120 may primarily include an instruction storage area and a data storage area. The data storage area can store various types of data, such as multimedia files and text. The instruction storage area can store software units such as operating systems, applications, and instructions required for at least one function, or subsets or extended sets thereof. It may also include non-volatile random access memory. It provides the processor 170 with hardware, software, and data resources for managing the computing device, supporting control software and applications. It is also used for storing multimedia files, as well as storing running programs and applications.
[0076] The processor 170 is the control center of the terminal 100. It connects various parts of the terminal 100 via various interfaces and lines. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it performs various functions and processes data of the terminal 100, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory can be implemented on a single chip; in some embodiments, they can also be implemented separately on independent chips. The processor 170 can also be used to generate corresponding operation control signals, send them to the corresponding components of the computing processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that the various functional modules therein perform corresponding functions, thereby controlling the corresponding components to act according to the instructions.
[0077] The memory 120 can be used to store software code related to the data distribution service communication method, and the processor 170 can execute the steps of the data distribution service communication method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to achieve the corresponding functions.
[0078] The radio frequency unit 110 (optional) can be used for receiving and transmitting signals during information transmission or calls. For example, it can receive downlink information from the base station and process it for the processor 170; additionally, it can transmit uplink data to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the radio frequency unit 110 can also communicate wirelessly with network devices and other devices. This wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0079] In this embodiment of the application, the radio frequency unit 110 can send data to the server 200 and receive the processing results sent by the server 200.
[0080] It should be understood that the radio frequency unit 110 is optional and can be replaced with other communication interfaces, such as a network port.
[0081] The terminal 100 also includes a power supply 190 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0082] Terminal 100 also includes an external interface 180, which can be a standard Micro USB interface or a multi-pin connector, and can be used to connect terminal 100 to other devices for communication, or to connect a charger to charge terminal 100.
[0083] Although not shown, terminal 100 may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with various functions, etc., which will not be described in detail here. Some or all of the methods described below can be applied to, for example... Figure 4 In the terminal 100 shown.
[0084] The following description Figure 3 The product form of the mid-range server 200;
[0085] Figure 5 A structural diagram of a server 200 is provided, as follows: Figure 5 As shown, server 200 includes bus 201, processor 202, communication interface 203, and memory 204. Processor 202, memory 204, and communication interface 203 communicate with each other via bus 201.
[0086] Bus 201 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0087] The processor 202 can be any one or more of the following processors: central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP), or digital signal processor (DSP).
[0088] Memory 204 may include volatile memory, such as random access memory (RAM). Memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0089] The memory 204 can be used to store software code related to the data distribution service communication control method, and the processor 202 can execute the steps of the chip's data distribution service communication control method, and can also schedule other units to achieve the corresponding functions.
[0090] It should be understood that the aforementioned terminal 100 and server 200 can be centralized or distributed devices. The processors (e.g., processor 170 and processor 202) in the aforementioned terminal 100 and server 200 can be hardware circuits (such as application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processors (DSPs), microprocessors or microcontrollers, etc.) or combinations of these hardware circuits. For example, the processor can be a hardware system with instruction execution capabilities, such as a CPU or DSP, or a hardware system without instruction execution capabilities, such as an ASIC or FPGA, or a combination of the aforementioned hardware systems without instruction execution capabilities and hardware systems with instruction execution capabilities.
[0091] In DDS (Data Distribution Service) communication, if specific entities (such as publishers, subscribers, topics, data writers, and data readers) are involved and the creation and release order of these entities is disrupted, the program may crash. The main reason for this is a dependency error: entities in DDS often have dependencies.
[0092] To address the aforementioned problems, this application provides a data distribution service communication control method. The data distribution service communication control method of this application embodiment will be described in detail below with reference to the accompanying drawings.
[0093] Reference Figure 6 , Figure 6 A flowchart illustrating a data distribution service communication control method provided in this application embodiment is shown below. Figure 6 As shown in the figure, the data distribution service communication control method provided in this application embodiment may include steps S601 to S604, which are described in detail below.
[0094] S601: Determine whether the target operation needs to be performed on the target entity;
[0095] In DDS communication, four entities are created: Participant, Topic, Reader, and Writer.
[0096] Participant: A participant is a core concept in DDS, representing a node or application within the DDS system. Each participant has a unique identifier used for addressing and communication within the distributed system. A participant can contain multiple topics and corresponding writers and readers.
[0097] A topic is a logical channel in DDS used for publishing and subscribing to data. Data publishers publish data to specific topics, while data subscribers subscribe to topics of interest to receive data. Topics are the foundation for data distribution and subscription.
[0098] Writer: The writer is the entity responsible for writing data into the DDS system. It is a component of the data publisher and is responsible for sending data to a specific topic. When a data publisher wants to publish data, it writes the data into the DDS system through the writer, and the DDS system is responsible for distributing the data to all subscribers who have subscribed to that topic.
[0099] Reader: A reader is the entity responsible for reading data from the DDS system. It is a component of a data subscriber and is responsible for receiving data from a specific topic. Once a data subscriber subscribes to a topic, the DDS system sends the data published on that topic to the subscriber's reader, who is then responsible for reading the data into the local application.
[0100] The target operations include creating entities and releasing entities.
[0101] In the technical solution disclosed in this embodiment, it is first necessary to determine one or more entities as target entities to be monitored. The target entity refers to an entity that has an association with other entities and needs to be released later or created first. For example, when the target operation is a creation operation, the target entities to be monitored include Topic, Reader, and Writer. When the target entity is Topic, other entities associated with the topic include Participant. When the target entity is Reader and Writer, other entities associated with Reader and Writer include Topic. When the target operation is a release operation, the target entities to be monitored include Participant, and other entities associated with Participant include Topic, Reader, and Writer.
[0102] This solution uses monitoring logs to determine whether target entities need to be created and released. In this solution, creating an entity refers to creating the resources corresponding to that entity, and releasing an entity refers to releasing those resources. In the DDS application, logs are added for critical operations such as entity creation and release. By viewing and analyzing the logs, entity usage can be tracked, thereby determining when to create and release entities.
[0103] Alternatively, lifecycle management can be used to determine whether entities need to be created and released. An explicit lifecycle management strategy should be implemented in the application. Taking release as an example, in the DDS communication process, each entity is assigned a specific lifecycle and released when its lifecycle ends. For instance, if an entity is associated with a specific task or session, then the entity associated with that task or session can be released when that task or session ends.
[0104] Of course, other methods can also be used to detect whether entities need to be created and released. For example, you can determine whether entities need to be released by monitoring reference counts, resource monitoring, performance analysis, callback functions and event handling, using DDS management tools, and regular cleanup. The specific method used to detect whether entities need to be released can be selected according to the actual scenario and requirements.
[0105] Step S602: When it is determined that a target operation needs to be performed on the target entity, determine whether the target operation has already been performed on other entities associated with the target entity;
[0106] In this step, when it is determined that a target operation needs to be performed on the target entity, firstly, other entities that are related to the target entity need to be identified based on the specific type of the target operation. After the other entities are identified, it is then determined whether the target operation has already been performed on other entities associated with the target entity. Of course, if the target entity does not exist among its related entities, the target operation can be performed on the target entity.
[0107] In this scheme, target entities under each target operation and other entities associated with the target entities can be predefined, and the correspondence between each target operation, target entity and other entities can be stored in a pre-established mapping table. The other entities corresponding to each target entity under each target operation can be determined through the pre-established mapping table.
[0108] Here, when the target operation is a release operation, the "other entities" refer to entities that need to be released before the target entity. If the other entities are released after the target entity, it will cause a system error. For example, when the target entity is a Participant, the other entities are Topic, Reader, and Writer. When the target operation is a creation operation, the "other entities" refer to entities that need to be created before the target entity. If the other entities are created after the target entity, it will cause a system error. For example, when the target entity is a Topic, the other entities are Participants; when the target entity is a Reader and Writer, the other entities are Topics.
[0109] Step S603: If the target operation has not been performed on the other entities, step S604 is executed to perform the target operation on the target entity after the target operation has been performed on the other entities.
[0110] In this step, if it is determined that other entities have not performed the target operation, we can continue to wait until other entities have completed the target operation before proceeding to step S604. Alternatively, we can actively determine whether other entities meet the conditions for performing the target operation. If other entities meet the conditions, we can actively perform the target operation on them. If other entities do not meet the conditions, we can continue to wait for them. Once other entities meet the conditions and have completed the target operation, we can proceed to step S604.
[0111] Step S604: When the target operation has been performed on the other entities, perform the target operation on the target entity.
[0112] For example, when it is necessary to release a Participant, if it is detected that other entities (Topic, Reader, and Writer) have already been released, the resources corresponding to the Participant are released at this time.
[0113] In the technical solution disclosed in this embodiment, the target entities to be monitored under each target operation are pre-configured. During DDS communication, it is monitored in real time whether a target operation needs to be performed on the target entity. When a target operation needs to be performed on the target entity, it is first determined whether other entities associated with the target entity have already performed the target operation. If other entities have already performed the target operation, the target operation can be performed directly on the target entity. If there are other entities associated with the target entity that have not performed the target operation, the target operation is performed on the target entity only after the other entities have completed their target operations. This ensures the creation and release order between the target entity and other entities, guaranteeing the reliable operation of the program.
[0114] In the technical solution disclosed in this embodiment, to facilitate monitoring whether the target operation has been performed on other entities associated with the target entity, a context variable `context` can be configured in the program. During DDS communication, each time an entity is created, the created entity is registered in the context variable; each time an entity is released, the released entity is deregistered from the context variable. The context variable `context` created in this application is used to store information related to the currently executed task, and the relevant information may include the entities that have been created. That is, in this application, when a task needs to be executed, after determining the target entity matching the task and other entities associated with it, during the execution of the task, each time an entity under the task is created, the entity is registered in the context variable `context`; each time an entity is released, the entity is deregistered from the context variable `context`. Therefore, by checking the context variable `context`, it is possible to quickly determine whether an entity has been created and released, thereby facilitating a quick determination of whether the target operation has been performed on other entities associated with the target entity.
[0115] In the technical solution disclosed in this embodiment, the context variable `context` can also be used to determine whether the target entity and other entities have been created or released. After an entity registered in the context variable `context` is released, the released entity needs to be deregistered from the context variable `context`. By detecting entities registered in the context variable `context`, it is determined whether the entity has been released. For example, when an entity is registered in the context variable `context`, it indicates that the entity has been created and has not yet been released. If no entity is registered in the context variable `context`, it indicates that the entity has not been created or has been released. Therefore, in the technical solution disclosed in this embodiment, when each creation or release of an entity is detected, the created or released entity is registered or deregistered from the context variable. At this time, the step "determining whether the target operation has been performed on other entities associated with the target entity" in the previous step can be specifically defined as: determining whether other entities associated with the participant have been executed based on the registration content in the context variable.
[0116] In this embodiment, in conjunction with the context variable `context`, when the target operation is a creation operation, see [reference needed]. Figure 7 The step of determining whether the target operation has been performed on other entities associated with the target entity based on the registered entities in the created context variables includes:
[0117] Step S701: Determine whether other entities associated with the target entity are registered in the context variables.
[0118] In this step, each entity registered in the context variable is traversed to determine whether other entities associated with the target entity are detected. If the other entities are detected, it indicates that the other entities have been created; otherwise, it indicates that the other entities have not yet been created.
[0119] Step S702: When the other entity is not registered in the context variable, it is determined that the creation operation has not been performed on other entities associated with the target entity;
[0120] Step S703: When the other entity has been registered in the context variable, it is determined that the creation operation has been performed on the other entity associated with the target entity.
[0121] Furthermore, in this embodiment, if the target operation is a creation operation, and the target entity is a Reader or a Writer, then the other entities corresponding to Reader and Writer are Topics. A Topic can also be considered a target entity, which also has other entities that need to be created after the other entities. Therefore, when it is detected that an uncreated other entity can also be used as a target entity, it is necessary to continue iterating to see if the other entities corresponding to that other entity have already been created. Therefore, see [link to relevant documentation]. Figure 8 When the target operation is not performed on the other entities, the target operation is performed on the target entity only after the target operation has been performed on the other entities, including:
[0122] Step S801: When the other entity is not registered in the context variable, determine whether there is an entity that is associated with the other entity.
[0123] For example, if the other entity corresponding to the target entity to be registered is a Topic, then there exists an entity Participant that is associated with the Topic during the creation operation; if the other entity corresponding to the target entity to be registered is a Participant, then there does not exist any other entity that is associated with the Participant during the creation operation.
[0124] Step S802: If there is no entity that is associated with the other entities, the target entity to be created will be created after the other entities are created.
[0125] For example, when the other entity is a Participant, there is no entity that is associated with the other entity. The target entity to be created will be created after the Participant is created.
[0126] Step S803: If there is an entity that is associated with the other entity, take the other entity as the target entity, and execute the judgment of whether the context variable has other entities associated with the target entity and subsequent steps until the target entity to be created is created.
[0127] For example, when other entities are Topics, the other entities or Topics need to be used as the target entity. Then, the steps to determine whether other entities associated with the target entity are registered in the context variables and subsequent steps are executed until the target entity to be created is completed.
[0128] In this embodiment, taking a release scenario as an example, and in conjunction with the context variable `context`, the step of "determining whether the target operation has been performed on other entities associated with the target entity" can specifically include:
[0129] Step S901: Call the context variable.
[0130] When it is necessary to release the target entity, the context variable is first called so as to determine whether the target entity and other entities associated with the target entity have been released.
[0131] Step S902: Check whether the target entity is registered in the context variables.
[0132] In this step, the registered content in the context variable is checked to determine whether the target entity is registered in the context variable. If the target entity is registered, it indicates that the target entity has not been released; otherwise, it indicates that the target entity has been released.
[0133] Step S903: When the target entity exists, determine whether other entities associated with the target entity are registered in the context variables.
[0134] When the target entity is registered in the context variable `context`, the system continues to check whether other entities associated with the target entity are registered in the `context`. If these other entities are detected, it indicates that they have not been released. If no such entities are detected, it indicates that all other entities associated with the target entity have been released.
[0135] For example, see Figure 10When it is detected that a participant needs to be released, the interface corresponding to the context variable is first called to prepare for the unregistration of the participant by the context variable. Then, the context variable checks whether a participant is registered. If no participant is detected in the context variable, it indicates that the participant has been unregistered. If a participant is detected in the context variable, it indicates that the participant has not been unregistered. After detecting a participant, it is determined whether other entities with an association with the participant are registered in the context variable. Here, the other entities refer to the topic, reader, and writer. If the topic, reader, or writer is registered in the context variable, the topic, reader, or writer is released and unregistered from the context variable. After the topic, reader, or writer is released, the participant is released and unregistered from the context variable.
[0136] For example, see Figure 11 When it is detected that the Writer needs to be released, the interface corresponding to the context variable is first called to prepare for the Writer to be unregistered by the context variable. Then, the context variable checks whether a Writer is registered. If no Writer is detected in the context variable, it means that the Writer has been unregistered. If a Writer is detected in the context variable, it means that the Writer has not been unregistered. After the Writer is detected, it is released and unregistered from the context variable.
[0137] For example, see Figure 12When a topic needs to be released, the interface corresponding to the context variable is first called to prepare for the topic to be unregistered by the context variable. Then, the context variable is checked to see if a topic is registered. If no topic is detected in the context variable, it means that the topic has been unregistered. If a topic is detected in the context variable, it means that the topic has not been unregistered. After the topic is detected, it is released and unregistered by the context variable.
[0138] For example, see Figure 13 When it is detected that the writer Reader needs to be released, the interface corresponding to the context variable is first called to prepare for the writer Reader to be unregistered by the context variable. Then, the context variable is checked to see if a writer Reader is registered. If no writer Reader is detected in the context variable, it means that the writer Reader has been unregistered. If a writer Reader is detected in the context variable, it means that the writer Reader has not been unregistered. After the writer Reader is detected, it is released and unregistered from the context variable.
[0139] and Figure 8 Correspondingly, in the relevant embodiments, when the target operation is a release operation, if other entities associated with the target entity are also associated with other entities, these other entities associated with the target entity can also be considered as a single target entity. When releasing other entities associated with the target entity, it is also necessary to first determine whether there are any entities associated with the other entities. That is, the other entities associated with the target entity are taken as the target entity, and the steps of determining whether other entities associated with the target entity are registered in the context variables and subsequent steps are executed until the target entity to be released is released. Specifically, see [link to specific examples]. Figure 14 The step described above, "when the target operation has not been performed on the other entities, the target operation is performed on the target entity only after the target operation has been performed on the other entities," specifically includes:
[0140] Step S141: When the other entities are registered in the context variables, determine whether there are any entities that are associated with the other entities.
[0141] For example, see Figure 2If the target entity is a participant, and the other entities associated with the target entity and still registered in the context variables are topics, then it is necessary to determine whether the topic is associated with other entities, that is, to determine whether there are other entities that are associated with the topic.
[0142] Step S142: If there is no entity associated with the other entities, release the target entity to be released after releasing the other entities.
[0143] Taking other entities as the topic, in this step, if it is detected that the topic is not associated with other entities, that is, there are no entities that are associated with the topic, then the target entity to be released will be released after the topic is released.
[0144] Step S143: If there is an entity that is associated with the other entity, take the other entity as the target entity, and execute the judgment of whether the context variable has other entities associated with the target entity and subsequent steps until the target entity to be released is released.
[0145] Taking other entities as the topic as an example, in this step, if it is detected that the topic is associated with other entities, that is, there are entities that are associated with the topic, then the topic can be used as the target entity, and the following steps are executed: determine whether other entities associated with the target entity are registered in the context variable and follow up, until the target entity to be released is released.
[0146] The above describes a data distribution service communication control method provided by the embodiments of this application. The following will describe the apparatus for performing the above data distribution service communication control.
[0147] Please see Figure 15 , Figure 15 This is a schematic diagram of a data distribution service communication control device provided in an embodiment of this application. Figure 15 As shown, the data distribution service communication control device includes:
[0148] The determination unit 10 is used to determine whether the target operation has been performed on other entities associated with the target entity when it is determined that a target operation needs to be performed on the target entity. The target operation includes a creation operation or a release operation.
[0149] The first execution unit 20 is configured to perform the target operation on the target entity only after the target operation has been performed on the other entities when the target operation has not been performed on the other entities.
[0150] The second execution unit 30 is configured to execute the target operation on the target entity when the target operation has already been executed on the other entities.
[0151] In one possible implementation, when the execution unit determines whether the target operation has been performed on other entities associated with the target entity, the determination unit 10 is specifically used to: determine whether the target operation has been performed on other entities associated with the target entity based on the registered entities in the created context variables, wherein, during DDS communication, each time an entity is created, the created entity is registered in the context variables, and each time an entity is released, the released entity is deregistered from the context variables.
[0152] In one possible implementation, when the target operation is a creation operation, the determining unit 10, based on the registered entities in the created context variables, determines whether the target operation has been performed on other entities associated with the target entity. Specifically, this is done by: determining whether other entities associated with the target entity are registered in the context variables; if no other entity is registered in the context variables, determining that the creation operation has not been performed on other entities associated with the target entity; and if the other entity is registered in the context variables, determining that the creation operation has been performed on other entities associated with the target entity.
[0153] In one possible implementation, when the target operation is a creation operation, the first execution unit 20, when not performing the target operation on the other entities and then performing the target operation on the target entity after performing the target operation on the other entities, specifically performs the following: when the other entities are not registered in the context variables, it determines whether there is an entity associated with the other entities; if there is no entity associated with the other entities, it creates the target entity to be created after creating the other entities; if there is an entity associated with the other entities, it uses the other entities as the target entity and performs the determination of whether there are other entities associated with the target entity registered in the context variables and subsequent steps, until the target entity to be created is created.
[0154] In one possible implementation, when the target operation is a release operation, the determining unit 10, based on the registered entities in the created context variables, determines whether the target operation has been performed on other entities associated with the target entity. Specifically, this is done by: determining whether other entities associated with the target entity are registered in the context variables; if other entities are registered in the context variables, determining that the release operation has not been performed on other entities associated with the target entity; and if other entities are not registered in the context variables, determining that the release operation has been performed on other entities associated with the target entity.
[0155] In one possible implementation, when the target operation is a release operation, the first execution unit, when not performing the target operation on the other entities, waits until the target operation is performed on the other entities before performing the target operation on the target entity. Specifically, this is done by: when the other entities are registered in the context variable, determining whether there is an entity associated with the other entities; if no entity is associated with the other entities, releasing the other entities before releasing the target entity to be released; if an entity is associated with the other entities, using the other entities as the target entity, and performing the determination of whether other entities associated with the target entity are registered in the context variable and subsequent steps, until the target entity to be released is released.
[0156] This application also provides an electronic device in its embodiments. (See reference...) Figure 16 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 16 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0157] like Figure 16 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. When the electronic device is powered on, the RAM 603 also stores various programs and data required for the operation of the electronic device. The processing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0158] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, memory cards, hard drives, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 16 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0159] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the data distribution service communication control methods provided in this application.
[0160] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the data distribution service communication control methods provided in this application.
[0161] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0162] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0163] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0164] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A data distribution service communication control method applied in a DDS communication process, characterized in that, The application comprises: When it is determined that a target operation needs to be performed on a target entity, it is determined whether the target operation has been performed on another entity associated with the target entity, the target operation comprising a creation operation or a release operation; When the target operation has not been performed on the another entity, the target operation is performed on the target entity after the target operation has been performed on the another entity; When the target operation has been performed on the another entity, the target operation is performed on the target entity.
2. The data distribution service communication control method of claim 1, wherein, The determination of whether the target operation has been performed on the another entity associated with the target entity comprises: Based on registered entities in a created context variable, it is determined whether the target operation has been performed on the another entity associated with the target entity, wherein in a DDS communication process, each time an entity is created, the created entity is registered in the context variable, and each time an entity is released, the released entity is unregistered from the context variable.
3. The data distribution service communication control method of claim 2, wherein, When the target operation is a creation operation, the another entity associated with the target entity refers to an entity that needs to be created before the target entity; when the target operation is a release operation, the another entity associated with the target entity refers to an entity that needs to be released before the target entity.
4. The data distribution service communication control method of claim 3, wherein, When the target operation is a creation operation, the determination of whether the target operation has been performed on the another entity associated with the target entity based on registered entities in a created context variable comprises: It is determined whether the another entity associated with the target entity is registered in the context variable; When the another entity is not registered in the context variable, it is determined that the creation operation has not been performed on the another entity associated with the target entity; When the another entity is registered in the context variable, it is determined that the creation operation has been performed on the another entity associated with the target entity.
5. The data distribution service communication control method of claim 4, wherein, When the target operation has not been performed on the another entity, the target operation is performed on the target entity after the target operation has been performed on the another entity, which comprises: When the another entity is not registered in the context variable, it is determined whether there is an entity having an association relationship with the another entity; If there is no entity having an association relationship with the another entity, the target entity to be created is created after the another entity is created; If there is an entity having an association relationship with the another entity, the another entity is taken as a target entity, and it is determined whether there is another entity associated with the target entity in the context variable and subsequent steps are performed until the target entity to be created is created.
6. The data distribution service communication control method of claim 3, wherein, When the target operation is a release operation, the determination of whether the target operation has been performed on the another entity associated with the target entity based on registered entities in a created context variable comprises: It is determined whether the another entity associated with the target entity is registered in the context variable; When the another entity is registered in the context variable, it is determined that the release operation has not been performed on the another entity associated with the target entity; When the other entity is not registered in the context variable, it is determined that the release operation has been performed on the other entity associated with the target entity.
7. The data distribution service communication control method of claim 6, wherein, When the target operation is not performed on the other entity, the target operation is performed on the target entity after the target operation is performed on the other entity, including When the other entity is registered in the context variable, it is determined whether there is an entity having an association relationship with the other entity; If there is no entity having an association relationship with the other entity, the target entity to be released is released after the other entity is released; If there is an entity having an association relationship with the other entity, the other entity is taken as a target entity, and the subsequent steps of determining whether there is an entity associated with the target entity in the context variable and the like are performed until the target entity to be released is released.
8. The data distribution service communication control method of any one of claims 1-7, wherein, When the target operation is a creation operation, the target entity includes a topic, a writer and a reader, and when the target entity is a topic, the other entity associated with the topic includes a participant, and when the target entity is a writer or a reader, the other entity associated with the writer or the reader includes a topic; When the target operation is a release operation, the target entity includes a participant, and the other entity associated with the participant includes a topic, a writer and a reader.
9. A data distribution service communication control apparatus applied in a DDS communication process, characterized in that, Comprising: A judging unit is configured to determine whether the target operation has been performed on the other entity associated with the target entity when it is determined that the target operation needs to be performed on the target entity, the target operation including a creation operation or a release operation; A first execution unit is configured to perform the target operation on the target entity after the target operation is performed on the other entity when the target operation is not performed on the other entity; A second execution unit is configured to perform the target operation on the target entity when the target operation has been performed on the other entity.
10. A computer program product, characterised in that, The computer readable instructions, when executed on an electronic device, enable the electronic device to implement the data distribution service communication control method in any one of claims 1 to 8.
11. An electronic device, comprising: Comprising at least one processor and a memory connected with the processor, wherein: The memory is configured to store computer programs; The processor is configured to execute the computer programs, so that the electronic device can implement the data distribution service communication control method in any one of claims 1 to 8.
12. A computer storage medium, characterized in that The storage medium carries one or more computer programs, which, when executed by an electronic device, can enable the electronic device to implement the data distribution service communication control method in any one of claims 1 to 8.