CN110874246A - Module loading method, system and equipment - Google Patents

Module loading method, system and equipment Download PDF

Info

Publication number
CN110874246A
CN110874246A CN201810990034.8A CN201810990034A CN110874246A CN 110874246 A CN110874246 A CN 110874246A CN 201810990034 A CN201810990034 A CN 201810990034A CN 110874246 A CN110874246 A CN 110874246A
Authority
CN
China
Prior art keywords
module
loading
dependent
target
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810990034.8A
Other languages
Chinese (zh)
Inventor
董延平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TCL Corp
TCL Research America Inc
Original Assignee
TCL Research America Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TCL Research America Inc filed Critical TCL Research America Inc
Priority to CN201810990034.8A priority Critical patent/CN110874246A/en
Publication of CN110874246A publication Critical patent/CN110874246A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The invention is suitable for the technical field of data processing, and provides a module loading method, a system and equipment, wherein when a loading request of a target module is detected, whether a dependent module having a dependent relationship with the target module exists is searched according to the name of the target module; when the dependency module with the dependency relationship with the target module does not exist, triggering the loading operation of the target module, and updating the loading state of the target module; when a dependent module with a dependency relationship with a target module exists, determining a corresponding loading strategy according to the loading state of the dependent module to trigger the loading operation of the corresponding module, and updating the loading state of the corresponding module, so as to determine whether the target module is directly loaded or the target module is loaded after the dependent module is completely loaded according to whether the target module with the dependency relationship with the target module exists, thereby achieving the purpose of correctly and quickly loading the target module, improving the response efficiency of the system and reducing the load of the system.

Description

Module loading method, system and equipment
Technical Field
The invention belongs to the technical field of data processing, and particularly relates to a module loading method, system and device.
Background
With the development of the technology, modules in different service systems depend on each other along with the subdivision of services, and the modules at different levels can complete a complete function, that is, corresponding dependency relationships exist among the modules.
Disclosure of Invention
In view of this, embodiments of the present invention provide a module loading method, system and device, so as to correctly and quickly load other modules having a dependency relationship, improve response efficiency of a system, and reduce system load.
A first aspect of an embodiment of the present invention provides a module loading method, including:
when a loading request of a target module is detected, acquiring the name of the target module;
searching whether a dependency module having a dependency relationship with the target module exists according to the name;
when a dependency module which has a dependency relationship with the target module does not exist, triggering the loading operation of the target module, and updating the loading state of the target module;
when a dependent module with a dependent relation with the target module exists, searching the loading state of the dependent module according to the name of the dependent module;
and determining a corresponding loading strategy according to the loading state of the dependent module to trigger the loading operation of the corresponding module and updating the loading state of the corresponding module.
A second aspect of an embodiment of the present invention provides a module loading system, including:
the dependency module searching unit is used for searching whether a dependency module which has a dependency relationship with the target module exists according to the name of the target module when the loading request of the target module is detected;
the target module loading unit is used for triggering the loading operation of the target module and updating the loading state of the target module when no dependent module with a dependent relation with the target module exists;
the first loading state searching unit is used for searching the loading state of a dependent module according to the name of the dependent module when the dependent module with the dependency relationship with the target module exists;
and the module loading triggering unit is used for determining a corresponding loading strategy according to the loading state of the dependent module so as to trigger the loading operation of the corresponding module and update the loading state of the corresponding module.
A third aspect of an embodiment of the present invention provides a module loading apparatus, including:
the module loading method comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the steps of the module loading method provided by the first aspect of the embodiment of the invention are realized when the computer program is executed by the processor.
Wherein the computer program comprises:
the dependency module searching unit is used for searching whether a dependency module which has a dependency relationship with the target module exists according to the name of the target module when the loading request of the target module is detected;
the target module loading unit is used for triggering the loading operation of the target module and updating the loading state of the target module when no dependent module with a dependent relation with the target module exists;
the first loading state searching unit is used for searching the loading state of a dependent module according to the name of the dependent module when the dependent module with the dependency relationship with the target module exists;
and the module loading triggering unit is used for determining a corresponding loading strategy according to the loading state of the dependent module so as to trigger the loading operation of the corresponding module and update the loading state of the corresponding module.
A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, which stores a computer program, where the computer program, when executed by a processor, implements the steps of the module loading method provided by the first aspect of the embodiments of the present invention.
Wherein the computer program comprises:
the dependency module searching unit is used for searching whether a dependency module which has a dependency relationship with the target module exists according to the name of the target module when the loading request of the target module is detected;
the target module loading unit is used for triggering the loading operation of the target module and updating the loading state of the target module when no dependent module with a dependent relation with the target module exists;
the first loading state searching unit is used for searching the loading state of a dependent module according to the name of the dependent module when the dependent module with the dependency relationship with the target module exists;
and the module loading triggering unit is used for determining a corresponding loading strategy according to the loading state of the dependent module so as to trigger the loading operation of the corresponding module and update the loading state of the corresponding module.
Compared with the prior art, the embodiment of the invention has the following beneficial effects: when a loading request of a target module is detected, whether a dependent module having a dependent relationship with the target module exists is searched according to the name of the target module; when the dependency module with the dependency relationship with the target module does not exist, triggering the loading operation of the target module, and updating the loading state of the target module; when a dependent module with a dependency relationship with a target module exists, determining a corresponding loading strategy according to the loading state of the dependent module to trigger the loading operation of the corresponding module, and updating the loading state of the corresponding module, so as to determine whether the target module is directly loaded or the target module is loaded after the dependent module is completely loaded according to whether the target module with the dependency relationship with the target module exists, thereby achieving the purpose of correctly and quickly loading the target module, improving the response efficiency of the system and reducing the load of the system.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart illustrating an implementation of a module loading method according to an embodiment of the present invention;
FIG. 2 is a diagram of a module having dependency relationships according to an embodiment of the present invention;
fig. 3 is a flowchart of a specific implementation of a method for searching whether a dependency module having a dependency relationship with a target module exists according to a name of the target module according to the second embodiment of the present invention;
fig. 4 is a flowchart of a specific implementation of a method for triggering a load operation of a target module and updating a load state of the target module according to a third embodiment of the present invention;
fig. 5 is a flowchart illustrating a specific implementation of a method for searching a loading status of a dependent module according to a name of the dependent module according to a fourth embodiment of the present invention;
fig. 6 is a flowchart of a specific implementation of a method for determining a corresponding loading policy according to a loading state of a dependent module to trigger the corresponding module according to a fifth embodiment of the present invention;
fig. 7 is a flowchart illustrating a specific implementation of a method for displaying a loading status of a target module and a dependent module according to a sixth embodiment of the present invention;
fig. 8 is a schematic diagram of a module loading system according to a seventh embodiment of the present invention;
fig. 9 is a schematic diagram of a module loading device according to an eighth embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Example one
Referring to fig. 1, fig. 1 shows an implementation flow of a module loading method provided in an embodiment of the present invention, which is detailed as follows:
in step S101, when a load request of a target module is detected, whether a dependent module having a dependency relationship with the target module exists is searched for according to a name of the target module.
In the embodiment of the present invention, the target module is a module that needs to be loaded currently, and the module is specifically a program code with a complete function or a functional module or a business module with a specific function.
Here, the dependent module is a module on which the target module depends, and has a dependency relationship with the target module. The dependency module comprises at least two modules with dependency relationship or association dependency relationship; the dependency relationship shows that the first module can determine whether the first module can be correctly loaded depending on the loading state of the second module, and the first module can be correctly loaded only when the second module is in the finished loading state; the association dependency relationship shows that the first module depends on the second module, and the second module depends on the loading state of the third module to determine whether the loading can be correctly carried out, wherein the dependency relationship between the first module and the third module is called the association dependency relationship. Whether the target module is loaded successfully or not needs to be determined according to the loading state of the dependent module, and when the dependent module with the dependency relationship with the target module is not loaded or is not loaded successfully, the target module cannot be loaded successfully.
In one application scenario, the embodiment of the present invention provides a schematic diagram of a module with dependency relationship as shown in fig. 2. The module A is a target module to be loaded currently, and the module D and the module C are dependent modules which have a dependent relationship with the module A, namely the module A can determine whether to be loaded correctly or not depending on the loading states of the module D and the module C, and the module A can be loaded correctly only when the module D and the module C are in the loading completion state. The module E, the module F and the module G are dependent modules with an association dependency relationship with the module A, the module D can be correctly loaded only by depending on the module E and the module F, the module C can be correctly loaded only by depending on the module F and the module G, and the module D and the module C can be correctly loaded only after the module E, the module F and the module G are correctly loaded, so that the module A can be correctly loaded, and if any one of the module D, the module C, the module E, the module F and the module G cannot be correctly loaded, the module A cannot be correctly loaded.
On the other hand, module a is a depended module of module D and module C, module B is a depended module of module C, module D is a depended module of module E and module F, and module C is a depended module of module F and module G. When the module D and the module C are completely loaded, the module A can be correctly loaded. Similarly, when the module C is loaded, the module B can be loaded correctly; when the module E and the module F are loaded, the module D can be loaded correctly; when the module F and the module G are loaded completely, the module C can be loaded correctly.
It can be understood that if module a is to work normally, module D, module C, module E, module F and module G are all to work normally, and module a can only work normally. And if the module B needs to work normally, the module C, the module F and the module G need to work normally to ensure that the module B can work normally.
Specifically, when a loading request of a target module is detected, the name of the target module is obtained, and a dependent module having a dependency relationship with the target module is searched according to the name of the target module, so as to determine whether a dependent module having a dependency relationship with the target module exists.
Here, the dependency module having a dependency relationship with the target module includes, but is not limited to, one dependency module, and may include a plurality of dependency modules. Other dependent modules which have a dependent relationship with the dependent module may exist under the dependent module, and the target module can be normally loaded only after all the dependent modules are successfully loaded.
It is understood that the target module may also be a dependent module of other modules, being dependent on other modules.
Before the target module is loaded, the dependent module with the dependent relationship with the target module is searched in the module cache data according to the name of the target module so as to determine whether the dependent module with the dependent relationship with the target module exists in the module cache data.
Here, the module cache data includes a module dependency state data area, and the module dependency state data area includes dependency relationships of the respective modules.
In step S102, when there is no dependent module having a dependency relationship with the target module, a loading operation of the target module is triggered, and a loading state of the target module is updated.
In the embodiment of the invention, when the target module has no dependent module with a dependent relationship with the target module, the loading operation of the target module is directly triggered, the target module is directly loaded to realize the corresponding function of the target module, and the state of the target module is updated to the finished loading state after the target module is loaded, so that other modules which can be normally started only depending on the target module are quickly loaded, completed and started, the loading speed of other modules and the response efficiency of a system are improved, and the load of the system is reduced because the modules do not need to be repeatedly reloaded.
Here, the loading operation is specifically to execute a corresponding function of the target module, so that a service corresponding to the target module can normally work. After the loading operation of the target module is completed, the relevant state data of the target module and the like are stored in the module cache data, so that other modules which can be normally started depending on the module can call the relevant state data of the target module from the module cache data, the other modules can be quickly loaded and started, the loading speed of the other modules and the response efficiency of the system are improved, and the load of the system is reduced because the modules do not need to be repeatedly reloaded.
In step S103, when there is a dependent module having a dependency relationship with the target module, the loading state of the dependent module is searched according to the name of the dependent module.
In the embodiment of the invention, when a dependency module having a dependency relationship with a target module exists, firstly, according to the name of the dependency module, the loading state of the dependency module is searched in module cache data to determine whether the dependency module is loaded and stored in the module cache data, and when the dependency module is loaded and stored in the module cache data, the target module can rapidly complete loading by calling the relevant state data of the dependency module; when the dependent module is not loaded and is stored in the module cache data, the state of the dependent module stored in the module cache data is updated to be a loaded state, and related data of the dependent module is called to enable the target module to quickly complete loading; and when the dependent module is not loaded and is not stored in the module cache data, directly creating the dependent module and storing the dependent module in the module cache data.
In step S104, according to the loading state of the dependent module, a corresponding loading policy is determined to trigger the loading operation of the corresponding module, and the loading state of the corresponding module is updated.
In the embodiment of the present invention, the loading policy specifically determines how to trigger the loading operation of the target module and/or the dependent module according to the loading state of the dependent module, and specifically includes the following steps:
when the dependent module exists in the module cache data, triggering the loading operation of the corresponding module according to the following loading strategy:
when the loading state of the dependent module is a waiting loading state, updating the loading state of the dependent module to a finished loading state, and traversing and updating the loading state of the dependent module in the module dependent state data area; and only when the loading states of all the dependent modules are the finished loading states, executing the loading operation of the target module so as to ensure that the target module can be loaded correctly.
And when the loading states of the dependent modules are all the completed loading states, executing the loading operation of the target module, so that the target module can complete loading quickly, and the response efficiency of the system is improved.
When the dependency module does not exist in the module cache data, directly triggering the loading operation of the dependency module to create the dependency module, wherein the loading operation comprises setting the loading state of the dependency module to be a completed loading state; and storing the created relevant state data of the dependent module into module cache data.
In the embodiment of the invention, when a loading request of a target module is detected, whether a dependent module having a dependent relationship with the target module exists is searched according to the name of the target module; when the dependency module with the dependency relationship with the target module does not exist, triggering the loading operation of the target module, and updating the loading state of the target module; when a dependent module with a dependency relationship with a target module exists, determining a corresponding loading strategy according to the loading state of the dependent module to trigger the loading operation of the corresponding module, and updating the loading state of the corresponding module, so as to determine whether the target module is directly loaded or the target module is loaded after the dependent module is completely loaded according to whether the target module with the dependency relationship with the target module exists, thereby achieving the purpose of correctly and quickly loading the target module, improving the response efficiency of the system and reducing the load of the system.
Example two
Referring to fig. 3, fig. 3 shows a specific implementation flow of a method for searching whether a dependent module having a dependency relationship with a target module exists according to the name of the target module, which is provided by the embodiment of the present invention, and the detailed description is as follows:
in step S301, according to the name of the target module, a dependent module having a dependency relationship with the target module is searched from module cache data in a traversal manner, and the module cache data records the interdependence relationship between modules with different names.
In the embodiment of the present invention, the module cache data records caches of all module state recording structures, and all module data can be searched from the module cache data in a Key (name of module) manner. For example, the cache data of module D, i.e. the relevant state data of module D, is as follows:
Figure BDA0001780574660000081
Figure BDA0001780574660000091
the module state recording structure is used for recording the state of the module and the data model between modules with dependency relationship.
For example: in an application scenario, the target module to be loaded currently is module D, module D depends on module E and module F, and module D is depended on module a, and then the state record of module A, D, E, F and the data model between modules having dependency relationship are recorded in the module state record structure as follows:
Figure BDA0001780574660000092
Figure BDA0001780574660000101
wherein, the nodeName is a module name which has uniqueness; status is module loading state; loading represents that the module is loaded (represents that the module does not complete the loading state) or waits for the loading of the dependent module, and loaded represents that the module and all the dependent modules are loaded completely (represents that the module is in the loading completion state); dependents, the dependent module of the module; onload: waiting for the module loaded by the module.
In step S302, when a dependent module having a dependency relationship with the target module is found in the module cache data, it is determined that a dependent module having a dependency relationship with the target module exists.
In the embodiment of the invention, when the dependent module with the dependency relationship with the target module can be found in the module cache data, the dependency module with the dependency relationship with the target module already exists in the current module cache data, and the loading operation of the target module can be quickly completed only by confirming the loading state of the dependent module, so that the loading efficiency of the target module is improved, the execution efficiency of corresponding services is correspondingly improved, and the response efficiency of the system is higher.
In step S303, when a dependent module having a dependent relationship with the target module is not found in the module cache data, it is determined that there is no dependent module having a dependent relationship with the target module.
In the embodiment of the present invention, when a dependent module having a dependency relationship with a target module cannot be found in module cache data, on one hand, it is described that no dependent module having a dependency relationship with the target module exists in current module cache data, that is, the target module does not have a dependent module having a dependency relationship with the target module; on the other hand, it is also possible that the dependent module having the dependency relationship with the target module is not loaded and stored in the module cache data, and at this time, the dependent module having the dependency relationship with the target module may be searched from the preset module dependency relationship table according to the name of the target module, so as to create the corresponding dependent module, so that the target module can be loaded correctly.
EXAMPLE III
Referring to fig. 4, fig. 4 shows a specific implementation flow of a method for triggering a load operation of a target module and updating a load state of the target module according to an embodiment of the present invention, which is detailed as follows:
in step S401, it is determined whether the target module exists in the module cache data according to the name of the target module.
In the embodiment of the invention, according to whether the target module exists in the module cache data, whether the relevant state data of the corresponding target module in the module cache data is directly called and the target module is loaded or the relevant state data of the target module needs to be created is determined, so that the rapid loading can be realized when the target module exists in the module cache data, and the loading efficiency of the module is improved.
In step S402, when the target module exists in the module cache data, the load state of the target module is updated to a completed load state, and the load state of the target module in the module dependency state data area is updated in a traversal manner.
In the embodiment of the invention, when the target module exists in the module cache data, the relevant state data of the corresponding target module in the module cache data is directly called to carry out loading operation, the loading state of the target module is updated to the finished loading state, and meanwhile, the loading states of all the target modules in the dependent data are updated in a traversing manner, so that the correctness of the loading state of the target module is ensured.
In step S403, when the target module does not exist in the module cache data, triggering a loading operation of the target module to create the target module, storing the created relevant state data of the target module in the module cache data, updating the loading state of the target module to a completed loading state, and traversing the loading state of the target module in the updated module dependent state data area.
In the embodiment of the invention, when the target module does not exist in the module cache data, the loading operation of the target module is firstly triggered to directly create the target module and complete the loading operation of the target module, after the target module is successfully loaded, the loading state of the target module is set to be the completed loading state, the created relevant state data of the target module is stored into the module cache data, and the loading state of the target module in the module dependent state data area is updated in a traversing manner, so that other modules dependent on the target module can quickly complete the loading operation of the other modules, and the loading efficiency of the other modules is improved.
Example four
Referring to fig. 5, fig. 5 shows a specific implementation flow of a method for searching a loading state of a dependent module according to a name of the dependent module according to an embodiment of the present invention, which is detailed as follows:
in step S501, when there is a dependent module having a dependency relationship with the target module, it is determined whether the dependent module exists in the module cache data.
In step S502, when the dependent module exists in the module cache data, it is searched for and determined whether the loading state of the dependent module is a completed loading state or a waiting loading state according to the name of the dependent module.
In the embodiment of the present invention, when there is a dependent module having a dependency relationship with a target module, it is determined whether the dependent module exists in module cache data by the name of the dependent module, that is, whether related state data of the dependent module can be found in the module cache data, and if the related state data of the dependent module can be found, it is determined whether the loading state of the dependent module is a completed loading state or a waiting loading state, so as to determine whether to directly call the related state data of the dependent module in the module cache data or to directly create the related state data of the dependent module according to the loading state of the dependent module and store the created related state data of the dependent module into the module cache data.
EXAMPLE five
The loading policy specifically includes:
strategy 1: when the dependent module does not exist in the module cache data, triggering a loading operation of the dependent module to create the dependent module.
Strategy 2: when the dependent module exists in the module cache data and the loading state of the dependent module is a waiting loading state, updating the loading state of the dependent module to a finished loading state
Referring to fig. 6, fig. 6 shows a specific implementation flow of a method for determining a corresponding loading policy according to a loading state of a dependent module to trigger the corresponding module according to an embodiment of the present invention, which is detailed as follows:
in step S601, when the dependent module does not exist in the module cache data, a load operation of the dependent module is triggered to create the dependent module.
In the embodiment of the invention, when the dependent module does not exist in the module cache data, the loading operation of the dependent module is triggered to create the dependent module, and the relevant state data of the dependent module is stored in the module cache data. Here, the load operation includes setting the load state of the dependent module to a completed load state.
In step S602, the created relevant state data of the dependent module is stored into module cache data, where the module cache data includes a module dependent state data area.
In the embodiment of the invention, the created dependency module takes the name as a key word for storage, and takes the module state record structure as a value, and records the dependency relationship among all modules through the module dependency state data area, so as to maintain the module state record structure and the module cache.
In step S603, when the dependent module exists in the module cache data and the loading state of the dependent module is a waiting loading state, the loading state of the dependent module is updated to a completed loading state.
In the embodiment of the invention, when the module cache data already has the relevant state data of the dependent module which has the dependency relationship with the target module and the loading state of the dependent module is the waiting loading state, the loading state of the dependent module is updated to the finished loading state, so that the target module can be loaded normally.
In step S604, the loading state of the dependent module in the module dependent state data area is updated through traversal.
In the embodiment of the present invention, the loading state of the dependent module in the module dependent state data area is updated to the completed loading state in a traversal manner, so as to ensure that the target module can complete the loading operation correctly and quickly.
In step S605, when the loading states of the dependent modules are all the completed loading states, the loading operation of the target module is executed.
In the embodiment of the present invention, when the load states of all dependent modules in the module cache data have completed the load state, the load operation of the target module is executed.
EXAMPLE six
Referring to fig. 7, fig. 7 shows a specific implementation flow of a method for displaying a loading state of a target module and a dependent module according to an embodiment of the present invention, which is detailed as follows:
in step S701, based on the module cache data, the loading state of the dependent module having a dependency relationship or an association dependency relationship with the target module is searched in a traversal manner.
In the embodiment of the present invention, because the dependency relationship of each module and the loading state record of each module are stored in the module cache data, the loading state of the dependency module having the dependency relationship or the associated dependency relationship with the target module can be searched through traversal of the name of the target module, so as to determine whether all the dependency modules are loaded correctly, or whether the target module cannot be loaded normally due to the fact that which dependency modules are not loaded, or which modules have an influence on the functions of which modules.
In step S702, the state information of the loading states of all modules including all dependency relationships or associated dependency relationships in the dependency modules is displayed.
In the embodiment of the invention, the loading states of the target module which needs to be loaded currently and all the dependent modules which have dependency relationships or association dependency relationships with the target module are displayed to form state information, so that a user can quickly know which modules are not loaded normally, and the loading of the target module is influenced.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 8 is a schematic diagram of a module loading system according to an embodiment of the present invention, which corresponds to a module loading method according to the foregoing embodiment, and only shows a part related to the embodiment of the present invention for convenience of description.
Referring to fig. 8, the system includes:
the dependency module searching unit is used for searching whether a dependency module which has a dependency relationship with the target module exists according to the name of the target module when the loading request of the target module is detected;
the target module loading unit is used for triggering the loading operation of the target module and updating the loading state of the target module when no dependent module with a dependent relation with the target module exists;
the first loading state searching unit is used for searching the loading state of a dependent module according to the name of the dependent module when the dependent module with the dependency relationship with the target module exists;
and the module loading triggering unit is used for determining a corresponding loading strategy according to the loading state of the dependent module so as to trigger the loading operation of the corresponding module and update the loading state of the corresponding module.
Optionally, the dependent module searching unit includes:
the dependency module searching subunit is used for traversing and searching a dependency module having a dependency relationship with the target module from module cache data according to the name of the target module, wherein the module cache data records the mutual dependency relationship between modules with different names;
a first dependency module determining subunit, configured to determine that a dependency module having a dependency relationship with the target module exists when the dependency module having a dependency relationship with the target module is found in the module cache data;
and the second dependency module determining subunit is configured to determine that there is no dependency module having a dependency relationship with the target module when the dependency module having a dependency relationship with the target module is not found in the module cache data.
Optionally, the target module loading unit includes:
the target module existence confirming subunit is used for determining whether the target module exists in the module cache data or not according to the name of the target module;
a first target module loading subunit, configured to update a loading state of the target module to a completed loading state when the target module exists in the module cache data, and traverse the loading state of the target module in an update module dependency state data area;
and the second target module loading subunit is configured to, when the target module does not exist in the module cache data, trigger a loading operation of the target module to create the target module, store the created relevant state data of the target module in the module cache data, update the loading state of the target module to a completed loading state, and traverse the loading state of the target module in the updated module dependency state data area.
Optionally, the first loading state searching unit includes:
the dependency module existence confirming subunit is used for determining whether the dependency module exists in the module cache data or not when the dependency module which has the dependency relationship with the target module exists;
and the dependent module state confirmation subunit is used for searching and determining whether the loading state of the dependent module is a finished loading state or a waiting loading state according to the name of the dependent module when the dependent module exists in the module cache data.
Optionally, the module loading triggering unit includes:
a first module loading triggering subunit, configured to, when the dependent module does not exist in the module cache data, trigger a loading operation of the dependent module to create the dependent module, where the loading operation includes setting a loading state of the dependent module to a completed loading state;
a module state data storage unit, configured to store the created relevant state data of the dependent module into module cache data, where the module cache data includes a module dependent state data area;
a first module state updating subunit, configured to update the loading state of the dependent module to a completed loading state when the dependent module exists in the module cache data and the loading state of the dependent module is a waiting loading state;
the second module state updating subunit is used for updating the loading state of the dependent module in the module dependent state data area in a traversing manner;
and the second module loading triggering subunit is used for executing the loading operation of the target module when the loading states of the dependent modules are all the completed loading states.
Optionally, the dependency module includes at least two modules having dependency relationships or association dependency relationships; the dependency relationship shows that the first module can determine whether the first module can be correctly loaded depending on the loading state of the second module, and the first module can be correctly loaded only when the second module is in the finished loading state; the association dependency relationship shows that the first module depends on the second module, and the second module depends on the loading state of the third module to determine whether the loading can be correctly carried out, wherein the dependency relationship between the first module and the third module is called the association dependency relationship.
Optionally, the system further includes:
the dependent module loading state searching unit is used for traversing and searching the loading state of a dependent module which has a dependent relationship or an associated dependent relationship with the target module based on module cache data;
and the module state display unit is used for displaying the state information of the loading states of all modules which contain all dependency relationships or association dependency relationships in the dependency modules.
In the embodiment of the invention, when a loading request of a target module is detected, whether a dependent module having a dependent relationship with the target module exists is searched according to the name of the target module; when the dependency module with the dependency relationship with the target module does not exist, triggering the loading operation of the target module, and updating the loading state of the target module; when a dependent module with a dependency relationship with a target module exists, determining a corresponding loading strategy according to the loading state of the dependent module to trigger the loading operation of the corresponding module, and updating the loading state of the corresponding module, so as to determine whether the target module is directly loaded or the target module is loaded after the dependent module is completely loaded according to whether the target module with the dependency relationship with the target module exists, thereby achieving the purpose of correctly and quickly loading the target module, improving the response efficiency of the system and reducing the load of the system.
Fig. 9 is a schematic diagram of a module loading device according to an embodiment of the present invention. As shown in fig. 9, the module loading apparatus 9 of this embodiment includes: a processor 90, a memory 91 and a computer program 92 stored in said memory 91 and executable on said processor 90. The processor 90, when executing the computer program 92, implements the steps in the above-described various module loading method embodiments, such as the steps 101 to 104 shown in fig. 1. Alternatively, the processor 90, when executing the computer program 92, implements the functions of the units in the system embodiments, such as the functions of the modules 81 to 84 shown in fig. 8.
Illustratively, the computer program 92 may be divided into one or more units, which are stored in the memory 91 and executed by the processor 90 to carry out the invention. The one or more units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program 92 in the module loading device 9. For example, the computer program 92 may be divided into a dependent module searching unit 81, a target module loading unit 82, a first loading state searching unit 83, and a module loading triggering unit 84, and the specific functions of each unit are as follows:
a dependent module searching unit 81, configured to search, when a loading request of a target module is detected, whether a dependent module having a dependency relationship with the target module exists according to a name of the target module;
a target module loading unit 82, configured to, when there is no dependent module having a dependency relationship with the target module, trigger a loading operation of the target module, and update a loading state of the target module;
a first loading state searching unit 83, configured to search, when there is a dependent module having a dependency relationship with the target module, a loading state of the dependent module according to a name of the dependent module;
a module loading triggering unit 84, configured to determine a corresponding loading policy according to the loading state of the dependent module to trigger a loading operation of the corresponding module, and update the loading state of the corresponding module.
Optionally, the dependent module searching unit 81 includes:
the dependency module searching subunit is used for traversing and searching a dependency module having a dependency relationship with the target module from module cache data according to the name of the target module, wherein the module cache data records the mutual dependency relationship between modules with different names;
a first dependency module determining subunit, configured to determine that a dependency module having a dependency relationship with the target module exists when the dependency module having a dependency relationship with the target module is found in the module cache data;
and the second dependency module determining subunit is configured to determine that there is no dependency module having a dependency relationship with the target module when the dependency module having a dependency relationship with the target module is not found in the module cache data.
Optionally, the target module loading unit 82 includes:
the target module existence confirming subunit is used for determining whether the target module exists in the module cache data or not according to the name of the target module;
a first target module loading subunit, configured to update a loading state of the target module to a completed loading state when the target module exists in the module cache data, and traverse the loading state of the target module in an update module dependency state data area;
and the second target module loading subunit is configured to, when the target module does not exist in the module cache data, trigger a loading operation of the target module to create the target module, store the created relevant state data of the target module in the module cache data, update the loading state of the target module to a completed loading state, and traverse the loading state of the target module in the updated module dependency state data area.
Optionally, the first loading state searching unit 83 includes:
the dependency module existence confirming subunit is used for determining whether the dependency module exists in the module cache data or not when the dependency module which has the dependency relationship with the target module exists;
and the dependent module state confirmation subunit is used for searching and determining whether the loading state of the dependent module is a finished loading state or a waiting loading state according to the name of the dependent module when the dependent module exists in the module cache data.
Optionally, the module loading triggering unit 84 includes:
a first module loading triggering subunit, configured to, when the dependent module does not exist in the module cache data, trigger a loading operation of the dependent module to create the dependent module, where the loading operation includes setting a loading state of the dependent module to a completed loading state;
a module state data storage unit, configured to store the created relevant state data of the dependent module into module cache data, where the module cache data includes a module dependent state data area;
a first module state updating subunit, configured to update the loading state of the dependent module to a completed loading state when the dependent module exists in the module cache data and the loading state of the dependent module is a waiting loading state;
the second module state updating subunit is used for updating the loading state of the dependent module in the module dependent state data area in a traversing manner;
and the second module loading triggering subunit is used for executing the loading operation of the target module when the loading states of the dependent modules are all the completed loading states.
Optionally, the dependency module includes at least two modules having dependency relationships or association dependency relationships; the dependency relationship shows that the first module can determine whether the first module can be correctly loaded depending on the loading state of the second module, and the first module can be correctly loaded only when the second module is in the finished loading state; the association dependency relationship shows that the first module depends on the second module, and the second module depends on the loading state of the third module to determine whether the loading can be correctly carried out, wherein the dependency relationship between the first module and the third module is called the association dependency relationship.
Optionally, the system further includes:
the dependent module loading state searching unit is used for traversing and searching the loading state of a dependent module which has a dependent relationship or an associated dependent relationship with the target module based on module cache data;
and the module state display unit is used for displaying the state information of the loading states of all modules which contain all dependency relationships or association dependency relationships in the dependency modules.
The module loading device 9 may be a terminal device such as a desktop computer, a notebook, a palm computer, and a smart phone. The module loading device 9 may include, but is not limited to, a processor 90, a memory 91. Those skilled in the art will appreciate that fig. 9 is only an example of the module loading device 9, does not constitute a limitation of the module loading device 9, and may include more or less components than those shown, or combine some components, or different components, for example, the terminal may further include an input-output device, a network access device, a bus, etc.
The Processor 90 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 91 may be an internal storage unit of the module loading apparatus 9, such as a hard disk or a memory of the module loading apparatus 9. The memory 91 may also be an external storage device of the module loading device 9, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the module loading device 9. Further, the memory 91 may also include both an internal storage unit and an external storage device of the module loading device 9. The memory 91 is used for storing the computer program and other programs and data required by the terminal. The memory 91 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the system is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system/module loading apparatus and method may be implemented in other ways. For example, the above-described system/module loading device embodiments are merely illustrative, and for example, the division of the module or unit is only one logical division, and there may be other divisions when the actual implementation is performed, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, systems or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or system capable of carrying said computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A method for loading a module, the method comprising:
when a loading request of a target module is detected, whether a dependent module having a dependent relationship with the target module exists is searched according to the name of the target module;
when a dependency module which has a dependency relationship with the target module does not exist, triggering the loading operation of the target module, and updating the loading state of the target module;
when a dependent module with a dependent relation with the target module exists, searching the loading state of the dependent module according to the name of the dependent module;
and determining a corresponding loading strategy to trigger the loading operation of the corresponding module according to the loading state of the dependent module, and updating the loading state of the corresponding module.
2. The method of claim 1, wherein the step of finding whether a dependent module having a dependency relationship with the target module exists according to the name comprises:
according to the name of the target module, traversing and searching a dependent module which has a dependent relationship with the target module from module cache data, wherein the module cache data records the mutual dependent relationship between modules with different names;
when finding out the dependent module with the dependency relationship with the target module in the module cache data, determining the dependent module with the dependency relationship with the target module;
and when the dependent module with the dependency relationship with the target module is not found in the module cache data, determining that the dependent module with the dependency relationship with the target module does not exist.
3. The method of claim 1, wherein said step of triggering a load operation of said target module to update a load state of said target module comprises:
determining whether the target module exists in module cache data or not according to the name of the target module;
when the target module exists in the module cache data, updating the loading state of the target module to a finished loading state, and traversing the loading state of the target module in the update module dependency state data area;
when the target module does not exist in the module cache data, triggering the loading operation of the target module to create the target module, storing the created relevant state data of the target module into the module cache data, updating the loading state of the target module to a finished loading state, and traversing the loading state of the target module in the updated module dependent state data area.
4. The method of claim 1, wherein the step of finding the loading state of the dependent module according to the name of the dependent module when the dependent module having the dependency relationship with the target module exists comprises:
when a dependent module having a dependent relationship with the target module exists, determining whether the dependent module exists in module cache data;
when the dependent module exists in the module cache data, searching and determining whether the loading state of the dependent module is a finished loading state or a waiting loading state according to the name of the dependent module.
5. The method of claim 4, wherein the step of determining a corresponding loading policy according to the loading state of the dependent module to trigger a loading operation of the corresponding module and updating the loading state of the corresponding module comprises:
when the dependency module does not exist in the module cache data, triggering a loading operation of the dependency module to create the dependency module, wherein the loading operation comprises setting a loading state of the dependency module to be a completed loading state;
storing the created relevant state data of the dependent module into module cache data, wherein the module cache data comprises a module dependent state data area;
when the dependent module exists in the module cache data and the loading state of the dependent module is a waiting loading state, updating the loading state of the dependent module to a finished loading state;
traversing and updating the loading state of the dependent module in the module dependent state data area;
and when the loading states of the dependent modules are all the finished loading states, executing the loading operation of the target module.
6. The method of any one of claims 1 to 5, wherein the dependency modules include at least two modules having a dependency or an association dependency; the dependency relationship shows that the first module can determine whether the first module can be correctly loaded depending on the loading state of the second module, and the first module can be correctly loaded only when the second module is in the finished loading state; the association dependency relationship shows that the first module depends on the second module, and the second module depends on the loading state of the third module to determine whether the loading can be correctly carried out, wherein the dependency relationship between the first module and the third module is called the association dependency relationship.
7. The method of claim 6, wherein upon detecting a load request for a target module, after the step of obtaining a name of the target module, further comprising:
based on module cache data, traversing and searching the loading state of a dependent module which has a dependent relationship or an associated dependent relationship with the target module;
and displaying the state information of the loading states of all modules containing all dependency relationships or associated dependency relationships in the dependency modules.
8. A module loading system, comprising:
the dependency module searching unit is used for searching whether a dependency module which has a dependency relationship with the target module exists according to the name of the target module when the loading request of the target module is detected;
the target module loading unit is used for triggering the loading operation of the target module and updating the loading state of the target module when no dependent module with a dependent relation with the target module exists;
the first loading state searching unit is used for searching the loading state of a dependent module according to the name of the dependent module when the dependent module with the dependency relationship with the target module exists;
and the module loading triggering unit is used for determining a corresponding loading strategy according to the loading state of the dependent module so as to trigger the loading operation of the corresponding module and update the loading state of the corresponding module.
9. Module loading device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the steps of the module loading method according to any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the module loading method according to any one of claims 1 to 7.
CN201810990034.8A 2018-08-28 2018-08-28 Module loading method, system and equipment Pending CN110874246A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810990034.8A CN110874246A (en) 2018-08-28 2018-08-28 Module loading method, system and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810990034.8A CN110874246A (en) 2018-08-28 2018-08-28 Module loading method, system and equipment

Publications (1)

Publication Number Publication Date
CN110874246A true CN110874246A (en) 2020-03-10

Family

ID=69714131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810990034.8A Pending CN110874246A (en) 2018-08-28 2018-08-28 Module loading method, system and equipment

Country Status (1)

Country Link
CN (1) CN110874246A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101002174A (en) * 2004-06-15 2007-07-18 格姆普拉斯公司 Method for loading software with an intermediate object oriented language in a portable device
CN101281461A (en) * 2007-04-04 2008-10-08 国际商业机器公司 Method and device for transfer applying dependent system environment
US20090282395A1 (en) * 2004-05-28 2009-11-12 Sap Ag Common class loaders
CN102226888A (en) * 2011-05-23 2011-10-26 成都市华为赛门铁克科技有限公司 Framework loading method and device
CN102486734A (en) * 2010-12-03 2012-06-06 上海宝信软件股份有限公司 Rich client application system
CN105528225A (en) * 2015-11-30 2016-04-27 用友优普信息技术有限公司 Application loading method and loading apparatus
CN105589715A (en) * 2014-11-10 2016-05-18 日本电气株式会社 Information processing device, library loading method, and computer readable medium
CN106940714A (en) * 2017-03-06 2017-07-11 掌阅科技股份有限公司 A kind of data processing method, device and electronic equipment
CN107329785A (en) * 2017-06-27 2017-11-07 郑州云海信息技术有限公司 A kind of method and system of dynamic load JavaScript modules
CN107766036A (en) * 2017-10-13 2018-03-06 深圳市金证科技股份有限公司 A kind of construction method of module, construction device and terminal device
CN108170493A (en) * 2017-12-27 2018-06-15 广州安食通信息科技有限公司 A kind of loading method of system module, system and device

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090282395A1 (en) * 2004-05-28 2009-11-12 Sap Ag Common class loaders
CN101002174A (en) * 2004-06-15 2007-07-18 格姆普拉斯公司 Method for loading software with an intermediate object oriented language in a portable device
CN101281461A (en) * 2007-04-04 2008-10-08 国际商业机器公司 Method and device for transfer applying dependent system environment
CN102486734A (en) * 2010-12-03 2012-06-06 上海宝信软件股份有限公司 Rich client application system
CN102226888A (en) * 2011-05-23 2011-10-26 成都市华为赛门铁克科技有限公司 Framework loading method and device
CN105589715A (en) * 2014-11-10 2016-05-18 日本电气株式会社 Information processing device, library loading method, and computer readable medium
CN105528225A (en) * 2015-11-30 2016-04-27 用友优普信息技术有限公司 Application loading method and loading apparatus
CN106940714A (en) * 2017-03-06 2017-07-11 掌阅科技股份有限公司 A kind of data processing method, device and electronic equipment
CN107329785A (en) * 2017-06-27 2017-11-07 郑州云海信息技术有限公司 A kind of method and system of dynamic load JavaScript modules
CN107766036A (en) * 2017-10-13 2018-03-06 深圳市金证科技股份有限公司 A kind of construction method of module, construction device and terminal device
CN108170493A (en) * 2017-12-27 2018-06-15 广州安食通信息科技有限公司 A kind of loading method of system module, system and device

Similar Documents

Publication Publication Date Title
CN110704398B (en) Database migration method and device from MySQL to Oracle and computer equipment
CN107798038B (en) Data response method and data response equipment
CN107832062B (en) Program updating method and terminal equipment
CN111352902A (en) Log processing method and device, terminal equipment and storage medium
CN105989076A (en) Data statistical method and device
CN107818168B (en) Topic searching method, device and equipment
CN109829287A (en) Api interface permission access method, equipment, storage medium and device
CN112860953A (en) Data importing method, device, equipment and storage medium of graph database
CN111767270A (en) Data migration method, device, server and storage medium
CN104765792A (en) Dimension data storing method, device and system
CN114020193A (en) Cross-page checking determination method and device, electronic equipment and storage medium
WO2019109514A1 (en) Datasheet backup method, device, electronic apparatus and medium
CN107679222A (en) Image processing method, mobile terminal and computer-readable recording medium
CN110222046B (en) List data processing method, device, server and storage medium
CN107169115A (en) Add the method and device of self-defined participle
CN111143092A (en) Fault recording data processing method and system and terminal equipment
CN111221742A (en) Test case updating method and device, storage medium and server
CN116467179A (en) Test case batch editing method and device and processing equipment
TWI816294B (en) Order processing method, apparatus, device, warehousing system and storage medium
CN110874246A (en) Module loading method, system and equipment
CN110347683B (en) Data table merging processing method and device
CN113760237A (en) Compiling address updating method and device, terminal equipment and readable storage medium
CN111988195B (en) Response scheme determination method, device, equipment and medium for packet test
CN112261168A (en) Multi-IP port user information searching method, terminal equipment and storage medium
CN112667682A (en) Data processing method, data processing device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200310