Plug-in support method based on preloading mechanism
A preloading and plug-in technology, applied in the field of communication, can solve the problems of migration and transformation obstacles, the inability to call the main program arbitrarily, and the exposure of script source code, so as to speed up the running speed of plug-ins and reduce the time for type search and reading.
Patent Information
- Authority / Receiving Office
- CN · China
- Current Assignee / Owner
- Publication Date
- 2015-06-03
Smart Images
Figure 1 Figure 2
Abstract
Description
technical field
[0001] The invention belongs to the communication field, and in particular relates to a plug-in support method based on a preloading mechanism. Background technique
[0002] Modern software applications are generally developed based on object-oriented thinking. In order to execute program codes, corresponding classes or interfaces need to be loaded. The so-called loading is the process of finding the binary form of a class or an interface and using the binary form to construct a class object representing this class or this interface.
[0003] Generally speaking, after the program is developed, the object type contained in the compiled result is determined, that is, its application logic is determined. If it is desired to enhance software functions without modifying the main body of the software program, the system needs to have the ability to dynamically load external object types at runtime.
[0004] In order to solve the above problems, it is necessary to...
Examples
Embodiment Construction
[0027] Specific embodiments of the present invention will be described in detail below.
[0028] like figure 2 As shown, the plug-in support method based on the preloading mechanism includes the following steps:
[0029] (1), the main program starts and loads the plug-in running framework at the same time, and the plug-in running framework is responsible for reading all external plug-ins;
[0030] (2), the plug-in running framework starts an independent class loader for each external plug-in, each class loader loads the types in the plug-in, and saves the type obtained after loading into the global cache;
[0031] (3) The plug-in running framework obtains the current class loader of the main program, modifies the parent loader of the current loader of the main program through reflection, and replaces the parent loader of the current class loader of the main program with the proxy class of the original parent loader , the proxy class of the original parent loader will interc...