Module scheduling method and apparatus, electronic device, and machine-readable storage medium

CN115248725BActive Publication Date: 2026-10-16GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210762310.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2026-10-16
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

[0003]然而,在这样的组合模式的架构下还存在着一些潜在问题,当功能数量不断增加时,大量的子模块会给主模块带来更多的新增代码量

Benefits of technology

[0018]According to the module scheduling method, apparatus, electronic device, and machine-readable storage medium of embodiments of the present invention, each submodule includes a classification method unit and a submodule method unit. During initialization, matching submodules are added to the main module based on the category of the main module and the classification method unit of the submodules. In the process of adding submodules, the addition is achieved by relying on the matching relationship between the classification method unit included in the submodule and the category of the main module. This reduces the need for the main module to dedicate significant code to adding submodules, thereby alleviating the code burden on main modules with numerous submodules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115248725B_ABST
    Figure CN115248725B_ABST
Patent Text Reader

Abstract

The application provides a module scheduling method and device, electronic equipment and machine readable storage medium, wherein the method comprises: providing a plurality of sub-modules, each sub-module comprising a classification method unit and a sub-module method unit; in an initialization process, according to the category of the main module and the classification method unit of the sub-module, adding a matched sub-module to the main module; and calling the sub-module method unit of the added sub-module through the main module. According to the module scheduling method of the embodiment of the application, in the adding process of the sub-module, the adding of the sub-module is realized by relying on the matching relationship between the classification method unit included in the sub-module and the category of the main module, and the main module no longer needs more codes for adding the sub-module, thereby reducing the code amount pressure of the main module with more sub-modules to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of application technology, and in particular to a module scheduling method, apparatus, electronic device, and machine-readable storage medium. Background Technology

[0002] In live streaming applications, live streaming rooms are often the most complex and concentrated modules. A live streaming room typically includes major functional modules such as audio / video playback, chat / public screen, gifting, guest ranking, and streamer space. These major functionalities are further subdivided into more specific features. Therefore, the entire live streaming room business can be broken down. The core functions of the live streaming room, such as creating, entering, connecting to, and leaving a room, as well as audio / video playback, can be configured as corresponding main modules. Gift effects, gameplay, chat, bullet comments, and pop-ups can be configured as sub-modules. Subsequent iterative development of the live streaming room can involve adding new sub-modules.

[0003] However, there are some potential problems with this combination pattern architecture. As the number of functions increases, a large number of submodules will bring more new code to the main module. Summary of the Invention

[0004] In view of this, the present invention provides a module scheduling method, apparatus, electronic device and machine-readable storage medium, which can reduce the code volume pressure of a main module with many sub-modules to a certain extent.

[0005] In a first aspect, embodiments of the present invention provide a module scheduling method, comprising: providing a plurality of sub-modules, each sub-module including a classification method unit and a sub-module method unit; adding matching sub-modules to the main module during initialization according to the category of the main module and the classification method unit of the sub-modules; and calling the sub-module method unit of the added sub-modules through the main module.

[0006] According to the foregoing embodiments of the first aspect of the present invention, the classification method unit includes: classification method name information, the classification method name information including matching information corresponding to the category of a preset main module; and submodule feedback information, the submodule feedback information being feature information of the submodule method unit.

[0007] According to any of the foregoing embodiments of the first aspect of the present invention, the step of adding the matching sub-module to the main module according to the category of the main module and the classification method unit of the sub-module during the initialization process includes: filtering all the sub-modules according to the category of the main module during the initialization process; filtering out all the sub-modules whose classification method name information matches the category of the main module as sub-modules to be added; and adding the sub-modules to be added to the main module by calling the feedback information of the sub-module through the main module.

[0008] According to any of the foregoing embodiments of the first aspect of the present invention, the prefix of the classification method name information is the same as the name of the category of the preset main module.

[0009] According to any of the foregoing embodiments of the first aspect of the present invention, the feedback information of the submodule includes at least one of the following: the class name of the submodule, the class object of the submodule, or the instance object of the submodule.

[0010] According to any of the foregoing embodiments of the first aspect of the present invention, the step of providing multiple sub-modules includes: providing at least one sub-module to be modified, the sub-module to be modified including the sub-module method unit; adding the classification method unit to the sub-module to be modified, such that the sub-module to be modified is transformed into the sub-module, wherein the classification method unit matches the category of a preset main module.

[0011] According to any of the foregoing embodiments of the first aspect of the present invention, after the step of adding the classification method unit to the submodule to be modified, the step of providing multiple submodules further includes: retrieving redundant units in the main module, the redundant units being function units in the main module that use the add interface of the submodule to be modified; and removing the redundant units.

[0012] According to any of the foregoing embodiments of the first aspect of the present invention, the step of calling the submodule method unit of the added submodule through the main module includes: triggering a message forwarding function in response to the instruction of the main module to start calling the submodule; traversing all the submodules through the message forwarding function to obtain callable submodules that can respond to the call; and the main module calling the submodule method unit of the callable submodule, so that the main module communicates with the callable submodule.

[0013] According to any of the foregoing embodiments of the first aspect of the present invention, after the step of traversing all the sub-modules through the message forwarding function, the step of calling the sub-module method unit of the added sub-module through the main module further includes: configuring the traversal detection result of traversing all the sub-modules as a traversal result cache; after the step of triggering the message forwarding function in response to the instruction of the main module to start calling the sub-module, the step of calling the sub-module method unit of the added sub-module through the main module further includes: determining whether the message forwarding function hits the traversal result cache; if it does not hit, then continuing the step of traversing all the sub-modules through the message forwarding function; if it hits, then obtaining a callable sub-module that can respond to the call through the traversal result cache, and skipping the step of traversing all the sub-modules through the message forwarding function.

[0014] According to any of the foregoing embodiments of the first aspect of the present invention, the message forwarding function is a runtime language library function.

[0015] Secondly, embodiments of the present invention provide a module scheduling device, comprising: a submodule configuration module for providing multiple submodules, each submodule including a classification method unit and a submodule method unit; a submodule addition module for adding matching submodules to the main module during initialization based on the category of the main module and the classification method unit of the submodule; and a submodule invocation module for invoking the submodule method unit of the added submodule through the main module.

[0016] Thirdly, embodiments of the present invention provide an electronic device including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement a module scheduling method according to any of the foregoing embodiments of the first aspect of the present invention.

[0017] Fourthly, embodiments of the present invention provide a machine-readable storage medium, characterized in that the machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the module scheduling method according to any of the foregoing embodiments of the first aspect of the present invention.

[0018] According to the module scheduling method, apparatus, electronic device, and machine-readable storage medium of embodiments of the present invention, each submodule includes a classification method unit and a submodule method unit. During initialization, matching submodules are added to the main module based on the category of the main module and the classification method unit of the submodules. In the process of adding submodules, the addition is achieved by relying on the matching relationship between the classification method unit included in the submodule and the category of the main module. This reduces the need for the main module to dedicate significant code to adding submodules, thereby alleviating the code burden on main modules with numerous submodules.

[0019] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0021] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 A flowchart of a module scheduling method provided in one embodiment of the present invention;

[0023] Figure 2 A flowchart of multiple sub-module steps is provided in a module scheduling method according to an alternative embodiment of the present invention;

[0024] Figure 3 A flowchart illustrating the steps of a submodule method unit in a module scheduling method provided by a main module to call an added submodule in an alternative embodiment of the present invention;

[0025] Figure 4 This is a structural block diagram of a module scheduling device provided in one embodiment of the present invention;

[0026] Figure 5 This is a structural block diagram of an electronic device provided in one embodiment of the present invention. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] The Composite pattern is a code design pattern typically used to design and combine multiple objects to implement a tree structure, representing a hierarchical structure with whole-part relationships. When developing modules with many functionalities and high complexity, extending and maintaining them based on a clear and reasonable architecture can significantly improve the efficiency and robustness of module development. The Composite pattern is suitable for architectural designs with whole-part, main-module, and sub-module relationships.

[0029] In some terminal applications, there are scenarios where complex functions need to be modularized and broken down, often using the composite pattern. For example, in live streaming applications, the live streaming room is often a complex and concentrated module. A live streaming room includes major functional modules such as audio / video playback, chat / public screen, gifts, guest ranking, and streamer space. These major functions are further subdivided into more specific functionalities. Therefore, the entire live streaming room business can be broken down. The core functions of the live streaming room, such as creating a room, entering a room, connecting to a room, leaving a room, and audio / video playback, can be configured as corresponding main modules. Gift effects, gameplay, chat, bullet comments, and pop-ups can be configured as sub-modules. Subsequent iterative development of the live streaming room can involve adding new sub-modules.

[0030] However, there are some potential problems with this combination pattern architecture. As the number of functions increases, a large number of sub-modules will bring more new code to the main module, putting a lot of code pressure on the main module.

[0031] The inventors discovered that in the combined architecture of related technologies, the code volume pressure of the main module mainly comes from two sources.

[0032] The first source of code volume pressure is the addition of submodules. While the initial architecture design aims for simplicity and ease of use in adding submodules, the sheer volume of code becomes enormous when a large number of submodules need to be added. For example, in a sample live-streaming room scenario, a single method in the class responsible for adding submodules already has 600 to 700 lines of code, and the entire class contains over a thousand lines of code related to submodule addition. This creates a potential for poor maintainability, and this problem will worsen with subsequent iterations of new features.

[0033] The second source of code volume pressure comes from communication with submodules. In related technologies, when the main module calls a method of a submodule, it needs to first traverse all submodules, detect which submodules can implement the method, and finally call the method on the selected submodules to complete the call from the main module to the submodules. Whenever a new communication method is needed, and the main module wants to call a new method of a submodule, the main module itself needs to add a new function. The function implementation repeats the above logic: first traverse all submodules, then detect all submodules that implement the new method, and then complete the call on each one. Often, the emergence of a new submodule may require multiple new methods to be called by the main module, and the main module needs to add multiple new functions accordingly. Thus, the increase in the main module's code volume caused by each submodule is even greater, because in this case, the main module is adding functions, and often multiple functions.

[0034] Based on this, embodiments of the present invention provide a module scheduling method, apparatus, electronic device, and machine-readable storage medium. The module scheduling method can be applied to applications that adopt a composite pattern architecture, including but not limited to live streaming applications and game scenarios.

[0035] The module scheduling method in one embodiment of the present invention can run on a touch-screen local terminal device or a server. When the module scheduling method runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0036] In some alternative implementations, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program's execution and the game screen presentation are separated. The storage and execution of module scheduling methods are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, information processing is performed by the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses game screen data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.

[0037] In some alternative implementations, taking a game as an example, the local touch terminal device stores the game program and is used to display the game screen. The local touch terminal device is used to interact with the player through a graphical user interface (GUI), i.e., conventionally downloading, installing, and running the game program via an electronic device. The local touch terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen or providing it to the player via holographic projection. For example, the local touch terminal device can include a display screen for displaying the GUI, which includes game screens, and a processor for running the game, generating the GUI, and controlling the display of the GUI on the display screen.

[0038] In one possible implementation, this invention provides a module scheduling method that provides a graphical user interface (GUI) via a touch terminal device. The touch terminal device can be either a local touch terminal device or a client device in a cloud interaction system. This GUI provides a graphical user interface that displays content based on the type of application being launched, such as game scene images, communication interaction windows, etc.

[0039] To facilitate understanding of this embodiment, a module scheduling method disclosed in this embodiment will first be described in detail. Figure 1 The flowchart illustrates a module scheduling method according to an embodiment of the present invention. This module scheduling method provides a graphical user interface through a terminal device, wherein the terminal device can be either the aforementioned local terminal device or the aforementioned client device.

[0040] In this embodiment, the module scheduling method is described using the iOS operating system as an example, specifically in the composite pattern architecture of a live streaming application on the iOS operating system. In this embodiment, the module scheduling method includes steps S110 to S130.

[0041] In step S110, multiple sub-modules are provided, each sub-module including a classification method unit and a sub-module method unit.

[0042] In step S120, during the initialization process, matching submodules are added to the main module according to the category of the main module and the classification method unit of the submodules.

[0043] In step S130, the main module calls the submodule method unit of the added submodule.

[0044] According to the module scheduling method of this invention, each submodule includes a classification method unit and a submodule method unit. During initialization, matching submodules are added to the main module based on the category of the main module and the classification method unit of the submodule. In this submodule addition process, the addition is achieved by relying on the matching relationship between the classification method unit of the submodule and the category of the main module. The main module no longer needs a large amount of code for adding submodules, thereby reducing the code load pressure on a main module with many submodules to a certain extent.

[0045] In some embodiments, in step S110, the classification method unit includes classification method name information and submodule feedback information. The classification method name information includes matching information corresponding to the category of a preset main module. The classification method name information is used by the main module to filter classification method units subsequently. The submodule feedback information is the feature information of the submodule method unit. The submodule feedback information can represent the submodule method unit of that submodule, and is used by the main module to accurately add the submodule in subsequent steps.

[0046] Optionally, the prefix of the classification method name information is the same as the name of the category in the preset main module. In this case, this prefix is ​​used for subsequent filtering of classification method units by the main module.

[0047] Optionally, the submodule feedback information includes at least one of the following: the submodule's class name, a submodule's class object, or a submodule's instance object. At least one of the submodule's class name, submodule's class object, or submodule's instance object can represent a submodule method unit. After the main module receives such submodule feedback information, it can add and initialize the corresponding submodule.

[0048] The module scheduling method of this invention can also be used to optimize traditional composite architecture.

[0049] Figure 2 This is a flowchart illustrating the steps of providing multiple sub-modules in a module scheduling method according to an alternative embodiment of the present invention. In some optional embodiments, step S110 of providing multiple sub-modules may include steps S111 and S112.

[0050] In step S111, at least one submodule to be modified is provided, which includes a submodule method unit. The submodule to be modified is, for example, a submodule in a traditional composite pattern architecture that does not include a classification method unit.

[0051] In step S112, a classification method unit is added to the submodule to be modified, thus transforming the submodule into a submodule. The classification method unit matches the category of a preset main module. For example, the classification method unit includes classification method name information and submodule feedback information. The classification method name information includes matching information corresponding to the category of the preset main module, used by the main module for subsequent filtering of classification method units. The submodule feedback information is the feature information of the submodule method unit, used by the main module for accurate addition of the submodule.

[0052] In some optional embodiments, after step 112 of adding the classification method unit in the submodule to be modified, step S110 of providing multiple submodules further includes steps S113 and S114.

[0053] In step S113, redundant units are retrieved in the main module. The redundant units are function units in the main module that use the added interface of the submodule to be modified.

[0054] In step S114, redundant units are removed.

[0055] In the above embodiment, through optimization, unnecessary function units used to add the original submodules to be modified were removed from the main module. In subsequent iterations, these redundant units can be avoided, keeping the main module under relatively low code load.

[0056] In some optional embodiments, step 120 of adding matching sub-modules to the main module during initialization based on the category of the main module and the classification method unit of the sub-modules includes: filtering all sub-modules according to the category of the main module during initialization; filtering out all sub-modules whose classification method name information matches the category of the main module as sub-modules to be added; and adding the sub-modules to be added to the main module by calling the feedback information of the sub-modules through the main module.

[0057] In step 120 above, runtime language library functions can be used for filtering. For example, the `class_copyMethodList` function can be used to retrieve all matching classification method units from the main module, and the `method_getname` function can be used to retrieve the classification method name information of the classification method units, detecting classification method names prefixed with their own category names. The main module then calls the feedback information from the submodules to add the submodules to the main module.

[0058] Figure 3This is a flowchart illustrating the steps of a submodule method unit in a module scheduling method provided by a main module to call an added submodule in an alternative embodiment of the present invention. In some optional embodiments, step S130, which provides multiple submodules, may include steps S131, S133, and S135.

[0059] In step S131, in response to the instruction from the main module to start calling the sub-module, the message forwarding function is triggered.

[0060] In step S133, all submodules are traversed through the message forwarding function to obtain the callable submodules that can respond to the call.

[0061] Optionally, the message forwarding function is a runtime language library function. For example, the message forwarding function includes a forwarding function and a signature function; the forwarding function is, for example, the `forwardInvocation` function, and the signature function is, for example, the `methodSignatureForSelector` function. The signature function returns a signature for each submodule's method unit. The forwarding function is used to implement broadcasting to submodules.

[0062] In step S135, the main module calls the submodule method unit of the callable submodule, enabling the main module to communicate with the callable submodule.

[0063] In some embodiments, after step S133 of traversing all submodules via the message forwarding function, step S130 of calling the submodule method unit of the added submodule via the main module further includes step S134. In step S134, the traversal detection result of traversing all submodules is configured as a traversal result cache. In one example, the traversal result cache uses the method name of the submodule method unit as the key.

[0064] In some embodiments, after step S131, which triggers the message forwarding function in response to the instruction from the main module to begin calling the submodule, step S130, which calls the submodule method unit of the added submodule through the main module, further includes step S132. In step S132, it is determined whether the message forwarding function hits the traversal result cache. If it does not hit, the process continues to step S133, which traverses all submodules through the message forwarding function; if it hits, step S136 is performed, skipping step S133, which traverses all submodules through the message forwarding function. In step S136, callable submodules capable of responding to the call are obtained through the traversal result cache.

[0065] In the above embodiments, by setting a traversal result cache, the detection efficiency of the corresponding callable sub-modules can be improved during the process of the main module calling the sub-modules.

[0066] According to the module scheduling method of this invention, each submodule includes a classification method unit and a submodule method unit. During initialization, matching submodules are added to the main module based on the category of the main module and the classification method unit of the submodule. In this submodule addition process, the addition is achieved by relying on the matching relationship between the classification method unit of the submodule and the category of the main module. The main module no longer needs a large amount of code for adding submodules, thereby reducing the code load pressure on a main module with many submodules to a certain extent.

[0067] In some implementations, the reflection mechanism of the Runtime library functions is utilized to detect the new submodule by examining the classification method unit set in the main module corresponding to the new submodule, thus identifying the submodule to be added and completing the addition process. In this case, adding a specific new submodule does not require modifying the main module internally, reducing the code load on the main module.

[0068] In some implementations, the runtime's message forwarding mechanism is used to forward calls from the main module to all sub-modules, efficiently implementing a broadcast notification communication method. When the main module wants to make a new sub-module method call, there is no need to modify the main module to add a new function; it can be called directly. After the message forwarding function is triggered, the sub-module is ultimately notified to complete the call.

[0069] This invention also provides a module scheduling device. This module scheduling device can be used in code-related architectures of composite patterns. Figure 4 This is a structural block diagram of a module scheduling device provided in one embodiment of the present invention. The module scheduling device includes a submodule configuration module 110, a submodule addition module 120, and a submodule invocation module 130.

[0070] The submodule configuration module 110 is used to provide multiple submodules, each of which includes a classification method unit and a submodule method unit.

[0071] The submodule adding module 120 is used to add matching submodules to the main module during the initialization process, based on the category of the main module and the classification method unit of the submodules.

[0072] Submodule calling module 130 is used to call the submodule method unit of the added submodule through the main module.

[0073] According to the module scheduling apparatus of the present invention, the submodule configuration module 110 provides multiple submodules, each submodule including a classification method unit and a submodule method unit. During initialization, the submodule adding module 120 adds matching submodules to the main module according to the category of the main module and the classification method unit of the submodule. In the process of adding submodules, the addition is achieved by relying on the matching relationship between the classification method unit included in the submodule and the category of the main module. The main module no longer needs a large amount of code for adding submodules, thereby reducing the code load pressure on the main module with many submodules to a certain extent.

[0074] In some embodiments, the classification method unit includes classification method name information and submodule feedback information. The classification method name information includes matching information corresponding to the category of the preset main module. The submodule feedback information is the feature information of the submodule method unit. Optionally, the prefix of the classification method name information is the same as the name of the category of the preset main module. In this case, the prefix is ​​used for subsequent filtering of classification method units by the main module. Optionally, the submodule feedback information includes at least one of the following: the class name of the submodule, the class object of the submodule, or the instance object of the submodule. At least one of the class name, class object, or instance object of the submodule can represent the submodule method unit of the submodule. After the main module obtains such submodule feedback information, it can add and initialize the corresponding submodule.

[0075] In some embodiments, the submodule configuration module 110 includes a submodule configuration module to be modified and a modification module.

[0076] The configuration module for the submodule to be modified is used to provide at least one submodule to be modified, which includes submodule method units. For example, the submodule to be modified is a submodule in a traditional composite pattern architecture that does not contain a classification method unit.

[0077] The modification module is used to add classification method units to the submodule to be modified, so that the submodule to be modified becomes a submodule, where the classification method units match the categories of the preset main module.

[0078] In some embodiments, the submodule configuration module 110 further includes a redundancy detection module and a redundancy removal module. The redundancy detection module is used to retrieve redundant units in the main module, whereby the redundant units are function units in the main module that use the add interface of the submodule to be modified. The redundancy removal module is used to remove redundant units.

[0079] In some embodiments, the submodule adding module 120 includes a filtering module and an adding module. The filtering module is used to filter all submodules according to the category of the main module during the initialization process; and to select all submodules whose classification method name information matches the category of the main module as submodules to be added. The adding module can add the submodules to be added to the main module by calling the feedback information from the submodules through the main module.

[0080] In some embodiments, the submodule invocation module 130 includes a message forwarding module and a communication module. The message forwarding module triggers a message forwarding function in response to an instruction from the main module to initiate a call to the submodule; the message forwarding module iterates through all submodules using the message forwarding function to obtain callable submodules capable of responding to the call. The communication module invokes the submodule method units of the callable submodules through the main module, enabling communication between the main module and the callable submodules.

[0081] Optionally, the message forwarding function is a runtime language library function. For example, the message forwarding function includes a forwarding function and a signature function; the forwarding function is, for example, the `forwardInvocation` function, and the signature function is, for example, the `methodSignatureForSelector` function. The signature function returns a signature for each submodule's method unit. The forwarding function is used to implement broadcasting to submodules.

[0082] In some embodiments, the submodule calling module 130 further includes a caching module and a judgment module.

[0083] After traversing all submodules through the message forwarding function, the caching module configures the traversal detection results of all submodules as the traversal result cache.

[0084] After the message forwarding function is triggered in response to the main module's instruction to start calling the submodule, the judgment module determines whether the message forwarding function hits the traversal result cache. If it misses, it continues to traverse all submodules through the message forwarding function; if it hits, it obtains the callable submodules that can respond to the call through the traversal result cache, skipping the step of traversing all submodules through the message forwarding function.

[0085] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the module scheduling method described above. This electronic device can be a server or a terminal device.

[0086] Figure 5The present invention provides a structural block diagram of an electronic device, which includes a processor 901 and a memory 902. The memory 902 stores machine-executable instructions that can be executed by the processor 901. The processor 901 executes the machine-executable instructions to implement the above-described module scheduling method.

[0087] The module scheduling method includes: providing multiple sub-modules, each sub-module including a classification method unit and a sub-module method unit; adding matching sub-modules to the main module during initialization based on the main module's category and the sub-module's classification method unit; and calling the sub-module method unit of the added sub-modules through the main module.

[0088] Furthermore, the electronic device may also include a communication interface 903 and a bus 904, with the processor 901, communication interface 903 and memory 902 connected via the bus 904.

[0089] The memory 902 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 903 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 904 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0090] The processor 901 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 901 or by instructions in software form. The processor 901 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 902. Processor 901 reads information from memory 902 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0091] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described module scheduling method.

[0092] The module scheduling method includes: providing multiple sub-modules, each sub-module including a classification method unit and a sub-module method unit; adding matching sub-modules to the main module during initialization based on the main module's category and the sub-module's classification method unit; and calling the sub-module method unit of the added sub-modules through the main module.

[0093] The module scheduling method, apparatus, electronic device, and computer program product of machine-readable storage medium provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0095] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0096] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0097] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0098] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A module scheduling method, characterized in that, include: Multiple sub-modules are provided, each of which includes a classification method unit and a sub-module method unit; The classification method unit includes: classification method name information, which includes matching information corresponding to the category of the preset main module; and submodule feedback information, which is the feature information of the submodule method unit; the submodule feedback information includes at least one of the following: the class name of the submodule, the class object of the submodule, or the instance object of the submodule; During initialization, based on the category of the main module and the classification method unit of the sub-modules, the matching sub-modules are added to the main module; and The main module calls the submodule method unit of the added submodule; The step of calling the submodule method unit of the added submodule through the main module includes: In response to the instruction from the main module to initiate a call to the sub-module, a message forwarding function is triggered; The message forwarding function iterates through all the sub-modules to obtain the callable sub-modules that can respond to the call; The main module calls the method unit of the callable submodule, enabling the main module to communicate with the callable submodule; After the step of traversing all the submodules through the message forwarding function, the step of calling the submodule method unit of the added submodule through the main module further includes: Configure the traversal detection results of all the aforementioned submodules as a traversal result cache. After the step of triggering the message forwarding function in response to the instruction from the main module to initiate the call to the submodule, the step of calling the submodule method unit of the added submodule through the main module further includes: Determine whether the message forwarding function hits the traversal result cache. If it does not, continue with the step of traversing all the sub-modules through the message forwarding function. If it does, obtain the callable sub-module that can respond to the call through the traversal result cache, and skip the step of traversing all the sub-modules through the message forwarding function.

2. The method according to claim 1, characterized in that, The step of adding the matching sub-module to the main module during initialization according to the category of the main module and the classification method unit of the sub-module includes: During initialization, all sub-modules are filtered according to the category of the main module; All sub-modules whose classification method names match the category of the main module are selected as sub-modules to be added; and The main module calls the feedback information from the sub-module to add the sub-module to the main module.

3. The method according to claim 1, characterized in that, The prefix of the classification method name information is the same as the name of the category in the preset main module.

4. The method according to claim 1, characterized in that, The step of providing multiple sub-modules includes: Provide at least one submodule to be modified, the submodule to be modified including the submodule method unit; The classification method unit is added to the submodule to be modified, so that the submodule to be modified is transformed into the submodule, wherein the classification method unit matches the category of the preset main module.

5. The method according to claim 4, characterized in that, After the step of adding the classification method unit to the submodule to be modified, the step of providing multiple submodules further includes: Retrieve redundant units in the main module, where the redundant units are function units in the main module that use the add interface of the sub-module to be modified; Remove the redundant unit.

6. The method according to claim 1, characterized in that, The message forwarding function is a runtime language library function.

7. A module scheduling device, characterized in that, include: A submodule configuration module is used to provide multiple submodules, each of which includes a classification method unit and a submodule method unit; The classification method unit includes: classification method name information, which includes matching information corresponding to the category of the preset main module; and submodule feedback information, which is the feature information of the submodule method unit; the submodule feedback information includes at least one of the following: the class name of the submodule, the class object of the submodule, or the instance object of the submodule; A submodule adding module is used to add matching submodules to the main module during initialization based on the category of the main module and the classification method unit of the submodules; and The submodule calling module is used to call the submodule method unit of the added submodule through the main module; The submodule calling module includes a message forwarding module and a communication module; The message forwarding module is used to respond to the instruction from the main module to start calling the sub-module by triggering a message forwarding function; and to traverse all the sub-modules through the message forwarding function to obtain the callable sub-modules that can respond to the call. The communication module is used to call the method unit of the callable submodule through the main module, so that the main module and the callable submodule can communicate. The submodule calls the module, which also includes a caching module and a judgment module; After traversing all sub-modules through the message forwarding function, the caching module is used to configure the traversal detection results of traversing all the sub-modules as traversal result cache; After the message forwarding function is triggered in response to the instruction from the main module to start calling the sub-module, the judgment module determines whether the message forwarding function hits the traversal result cache. If it does not hit, it continues to traverse all the sub-modules through the message forwarding function. If it hits, it obtains the callable sub-module that can respond to the call through the traversal result cache, skipping the step of traversing all sub-modules through the message forwarding function.

8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the module scheduling method according to any one of claims 1-6.

9. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the module scheduling method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Module processing method and device

    CN109697089A

  • Method for controlling equipment

    CN109840122A