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.

CN104679572AActive Publication Date: 2015-06-03北京神舟航天软件技术股份有限公司
9 Cites 16 Cited by

Patent Information

Authority / Receiving Office
CN · China
Current Assignee / Owner
Publication Date
2015-06-03

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
Patent Text Reader

Abstract

The invention relates to a plug-in support method based on a preloading mechanism. The method comprises the following steps that 1, a main program starts, in addition, a plug-in operation framework is loaded, and the plug-in operation framework is in charge of reading an external plug-in; 2, the plug-in operation framework starts an independent class loader for the external plug-in, the class loader loads the types in the plug-in, and in addition, the types are stored in the local global buffer; 3, the plug-in operation framework obtains the current class loader of the main program, a parent loader of the current class loader of the main program is replaced into the agent class of the original parent loader, and the agent class of the original parent loader can intercept all classes sent to the original class loader for loading and calling; 4, when the main program requests to call the Class type, the Class type is found in the original parent loader according to the type names, if the target type is not found, whether the types provided by the corresponding plug-in exists or not is matched in the local global buffer, if the matching is successful, the direct loading and executing is carried out, and otherwise, exception is thrown.
Need to check novelty before this filing date? Find Prior Art

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...