CN107038045B - Method and device for loading library file - Google Patents

Method and device for loading library file Download PDF

Info

Publication number
CN107038045B
CN107038045B CN201710203810.0A CN201710203810A CN107038045B CN 107038045 B CN107038045 B CN 107038045B CN 201710203810 A CN201710203810 A CN 201710203810A CN 107038045 B CN107038045 B CN 107038045B
Authority
CN
China
Prior art keywords
library file
target library
file
target
loading
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.)
Active
Application number
CN201710203810.0A
Other languages
Chinese (zh)
Other versions
CN107038045A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710203810.0A priority Critical patent/CN107038045B/en
Publication of CN107038045A publication Critical patent/CN107038045A/en
Application granted granted Critical
Publication of CN107038045B publication Critical patent/CN107038045B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method for loading library files, which comprises the following steps: detecting a service calling process, and determining a target library file according to the service calling process; searching the target library file in a cache directory, and determining a library file server corresponding to the target library file when the target library file is not searched; initiating a download request corresponding to the target library file to the library file server; accessing the library file server, and downloading the target library file from the library file server to the cache directory; and checking whether the target library file in the cache directory is consistent with the file version stored on the library file server, and if so, adding the target library file into a class loading path to load the target library file. By adopting the invention, the reliability of the hot update library file can be improved.

Description

Method and device for loading library file
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for loading library files.
Background
When an application (for example, android App) is executed, it is necessary to implement a plurality of functions, and therefore, it is necessary to rely on a plurality of library files corresponding to the respective functions. However, in order to prevent the amount of the installation package data of the application program from becoming too large, the library files corresponding to some infrequently used functions are not packaged into the installation package, and only when the corresponding function module is operated in the execution process of the application program, the library files corresponding to the function module are dynamically downloaded to the specified address. Dynamically loading library files during application execution is also called hot update of library files.
However, the success rate of the current hot update scheme is low, which is mainly indicated in that the downloaded library files may be hijacked, or incomplete downloading is caused by network fluctuation, incomplete library files are caused by copy failure in the process of copying the library files to the loading path directory of the App, file loading failure is caused, repeated downloading is caused by failure, and other problems. Therefore, the scheme of the hot update of the library file applied in the conventional art is insufficient in reliability.
Disclosure of Invention
Based on this, in order to solve the technical problem of insufficient reliability of the conventional scheme for hot update of the application library file, a library file loading method is particularly provided, and the library file loading method comprises the following steps:
detecting a service calling process, and determining a target library file according to the service calling process;
searching the target library file in a cache directory, and determining a library file server corresponding to the target library file when the target library file is not searched; initiating a downloading request corresponding to the target library file to the library file server;
accessing the library file server, and downloading the target library file from the library file server to the cache directory;
and checking whether the target library file in the cache directory is consistent with the file version stored on the library file server, and if so, adding the target library file into a class loading path to load the target library file.
In addition, in order to solve the technical problem of insufficient reliability of the conventional scheme for hot update of the application library file, an apparatus for loading the library file is provided, which includes:
the target library file determining module is used for detecting a service calling process and determining a target library file according to the service calling process;
the target library file searching module is used for searching the target library file in a cache directory and determining a library file server corresponding to the target library file when the target library file is not searched; initiating a downloading request corresponding to the target library file to the library file server;
the target library file caching module is used for accessing the library file server and downloading the target library file from the library file server to the caching directory;
the first checking module is used for checking whether the target library file in the cache directory is consistent with the file version stored on the library file server or not;
and the target library file loading module is used for loading the target library file by adding the target library file into the class loading path when the result of the checking module is yes.
The embodiment of the invention has the following beneficial effects:
after the method and the device for loading the library file are adopted, when the library file outside the installation package needs to be called in the service calling process, the library file is determined, then the library file is downloaded from the server to the newly added cache directory, then the library file is verified, and after the library file is verified to be correct, the library file is loaded through the class loader, so that the loading process can be prevented when the library file fails to be downloaded or the library file is maliciously replaced, and the safety and the reliability are improved.
In addition, when the library file needs to be loaded again in subsequent service calling, the library file can be directly searched in the cache directory, the library file in the cache directory is verified, the library file in the cache directory is directly loaded after the verification is passed, and the file does not need to be downloaded again by the server, so that the network flow is also saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Wherein:
FIG. 1 is a schematic flow chart diagram illustrating a method for loading library files in one embodiment;
FIG. 2 is a diagram of file directory architecture during application runtime in one embodiment;
FIG. 3 is a schematic flow chart diagram illustrating a method for loading library files in one embodiment;
FIG. 4 is a diagram illustrating an exemplary implementation of an apparatus for loading library files;
fig. 5 is a schematic structural diagram of a computer device for executing the method for loading a library file in one embodiment.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to realize the function of hot loading of library files, the embodiment of the invention particularly provides a method for loading library files. The method may be implemented in dependence on a computer program that is executable on a computer system based on the von neumann architecture, the computer program may be based on a class load module or class loader of an application, such as the classLoader class in the Android system, extremely extended class, etc.; or it may be a file management function implemented based on the application program itself, such as an application program based on python language or JavaScript language. In the embodiment of the present invention, under the runtime environment of the compiled programming language, the library file may be a dynamic link library file, and the type of the library file may be so (library file in linux system),. Jar (library file in Android system or Java system), or. Dll (library file in windows system); in the runtime environment of the interpreted programming language, the corresponding class file or script file of the programming language, such as a py file in python programming language or a js file in JavaScript programming language, may be used.
Specifically, as shown in fig. 1, the method for loading a library file includes the following steps:
step S102: and detecting a service calling process, and determining a target library file according to the service calling process.
In this embodiment, when a developer of an application develops an application product and packages an installation package of the application, only basic functions may be added to the installation package, and uncommon functions may be packaged into a library file.
For example, a P-graph application, including multiple functions, may be developed to package some commonly used P-graph algorithms and sharing functions in an installation package, and package some less commonly used P-graph algorithms in multiple corresponding library files. After the user installs the P-map application, the photos can be modified by normally using the common P-map algorithm, and the sharing function in the installation package can be directly called to share the processed photos. Because the class file or program code corresponding to this part of functions is already loaded into the memory when the application is started. However, when the user needs to use an unusual P-map algorithm, the application needs to automatically access the server to download the library file of the corresponding P-map algorithm and perform hot loading.
As described above, in the present embodiment, for hot loading of library files, an application may determine a target library file that needs to be loaded by detecting the progress of a service invocation procedure.
Specifically, in one embodiment, the application may monitor the service invocation process through an exception handling mechanism (this embodiment requires the development language of the application to support the exception handling mechanism). The exception handling mechanism is a try-catch mechanism, and when an application program executes a certain service logic, the application program calls an interface function corresponding to the service module.
As in the foregoing example, when a P-map application uses a certain P-map algorithm to perform image processing, an interface function of a class file or a library file corresponding to the P-map algorithm is always called. The interface function may be executed in the code space of try, and when the class file or the library file corresponding to the P-graph algorithm is loaded in the memory, or the class file or the library file corresponding to the P-graph algorithm exists in the class loading path classpath of the application runtime, the interface function may be normally called without throwing an exception. However, if the P-map algorithm is the foregoing unusual algorithm, then under an installation package or an installation directory of the application, or when a library file corresponding to the algorithm does not exist in a class loading path classpath of the application, a corresponding Exception may be thrown due to a fact that a corresponding reference relationship or pointer relationship cannot be found when a corresponding interface function is called (for example, a nulpointexception type Exception may be thrown in an Android system), at this time, the application may determine that a corresponding library file lacks when the interface function of the service module is called according to the type of the Exception, and then determine a package name of a target library file according to the type of the Exception.
In another embodiment, the application may monitor the service invocation process through a class loader (the development language of the application is required to support the class loading function of the runtime, such as java, android). For example, in an android system, a service logic is defined by a corresponding class file and library file, and when an interface function of a service module is called, a package name (package name) of the class file or library file to be loaded is first transferred to a classLoader component, and then the classLoader is used to read the corresponding class file and library file in a classpath for loading. However, if the classLoader does not find the class file or library file corresponding to the package name in the classpath, the application may determine that the package name is the target library file that needs to be subjected to hot loading.
For example, in other embodiments, the application program may determine the target library file by adding a logic judgment in the service calling process, and may also add the mapping relationship between the service module and the library file in the configuration file in advance, and determine the target library file by querying the configuration file during the service calling.
Step S104: searching a target library file in the cache directory, and determining a library file server corresponding to the target library file when the target library file is not searched; and initiating a downloading request corresponding to the target library file to the library file server.
Step S106: and accessing the library file server, and downloading the target library file from the library file server to the cache directory.
In this embodiment, to implement hot loading of the library file, a cache directory is further provided. As shown in fig. 2, when the application program runs, the program file in the hard disk is loaded into the memory. In this embodiment, the application program in operation may access at least two types of storage areas, that is, the class load path directory and the cache directory newly set in this embodiment, where the cache directory is used to cache the downloaded library file.
In this embodiment, when there is no target library file in the classpath, it is preferred to search for whether there is a target library file corresponding to the package name in the cache directory, and if found, the target library file of the version in the cache directory is used for hot loading, and if found, the library file access server downloads the target library file into the cache directory.
The library file server may be a single server that stores a plurality of library files, or may be a plurality of servers provided by a third party and corresponding to the respective library files.
For example, in an embodiment of a single server, the library file server may be a server in an application market, when an application developer publishes an application in the application market, a part of functions may be separately encapsulated in the library file, so that an installation package of the application and a corresponding library file are stored in the application market server, and a terminal executing the method sends a package name of a target library file determined in a service invocation process to the server in the application market, that is, the target library file may be downloaded to the cache directory.
It should be noted that, in order to improve security, the connection between the library file server and the terminal may be based on the https protocol, which may prevent the target library file from being tampered during the downloading process.
In an embodiment of multiple servers, the library file server is a server of an open-source organization that issues the library file, for example, a library file that a certain open-source organization issues a specific image processing algorithm, and when a terminal needs to load the library file, the terminal may first search a mapping table stored in advance for a library file server address corresponding to a package name, and then access the address to download a target library file into a cache directory.
Step S108: and checking whether the target library file in the cache directory is consistent with the file version stored on the library file server, and if so, loading the target library file by adding the target library file into the class loading path.
Because the target library file is possibly maliciously tampered in the process of being downloaded into the cache directory by the library file server, or replaced by the library file added with malicious codes. Particularly, in the process of downloading by using an http protocol, a target library file is very easy to be replaced by a library file containing trojans and viruses, and if the library file is loaded by an application, the application may execute malicious codes during execution to cause file damage or privacy disclosure.
Therefore, after downloading is completed, whether the target library file in the cache directory is consistent with the file version stored on the library file server or not can be checked by comparing at least one of the version number, the file size or the hash value (comparing the MD5 code, the SHA code and the like).
If the verification result is matching, namely the version number, the file size and the hash value of the target library file in the cache directory and the file version on the library file server are consistent, hot loading can be carried out on the target library file in the cache directory; and if the verification result is not matched, deleting the target library file in the cache directory and the class loading path directory, executing the step of determining the library file server corresponding to the target library file, and re-accessing the library file server to download the target library file. If the downloading fails for multiple times, the application can prompt to report an error and prompt that the corresponding service module cannot be called.
In this embodiment, the manner of loading the target library file includes at least two types:
in the first embodiment, the loading the target library file by adding the target library file to the class loading path may specifically be: and copying the target library file from the cache directory to a class loading path directory corresponding to the class loading path, and loading the target library file by a system class loader corresponding to the class loading path directory.
Referring to fig. 2, in this embodiment, the error-free target library file is stored in the cache directory, and may be copied to a corresponding directory corresponding to the classpath of the application, for example, an installation directory of the application, a directory defined by a path attribute in a system environment variable, or a directory defined in another manner, and then the copied target library file is loaded through a system class loader that is default in a program compiler or an interpreter. But if the default system class loader fails to load, deleting the target library file in the cache directory and the class loading path directory.
The implementation is suitable for most applications developed by compiled and interpreted programming languages, such as java, android, python, javascript, and the like.
In a second embodiment, loading the target library file by adding the target library file to the class load path comprises: and transferring the path of the target library file in the cache directory as a parameter of the class loading path to a preset custom class loader, and loading the target library file by the custom class loader.
For example, an application developer may write a custom classLoader class in advance to replace the default classLoader class of the system and reload the class loading interface function, so that the class loading interface function has the argument of the class loading path. When the target library file is loaded, the path of the target library file in the cache directory is only needed to be transmitted as a parameter, and the path can be added into the class loading path, so that the hot loading of the library file is realized. Similarly, if the loading fails, the target library file in the cache directory may be deleted.
Further, in this embodiment, returning to step S104, if the target library file is found in the cache directory, the library file server may not be accessed to download the target library file, but a step of checking whether the target library file in the cache directory is consistent with the file version stored on the library file server may be performed. The verification is as described above. That is, for the library file downloaded into the cache directory, the library file does not need to be accessed to the library file server for downloading again when the library file is called for multiple times, and the library file can be directly loaded for use if the library file is verified to be correct.
Further, before searching the target library file in the cache directory, when the target library file exists in the class loading path directory, whether the target library file in the class loading path directory is consistent with the file version stored on the library file server or not can be verified, and if not, the step of searching the target library file in the cache directory is executed.
That is, even if the target library file exists in the class loading path directory, the target library file is not required to be directly loaded for use, but is firstly verified, if the verification is passed, the library file is not tampered in the copying process or the application execution process, and the library file is a safe library file and can be directly loaded for use; and if the verification is not passed, executing the step of searching the target library file in the cache directory until the most safe version is obtained.
Further, in order to save the storage space of the cache directory, when the file size of the cache directory is larger, that is, larger than or equal to the threshold, the library files in the cache directory may be deleted according to the downloading time sequence or the loading times from small to large until the file size is smaller than the threshold. This enables library files that are not called for a long time to be quickly cleared out of the cache directory, thereby saving storage space.
As shown in fig. 3, fig. 3 illustrates a complete flow of hot loading library files according to an embodiment of the present invention.
Embodiments of the present invention further provide a computer storage medium, which includes computer instructions, and when the computer instructions are executed on a computer, the computer executes the method for loading a library file as described above.
In the above embodiments, the method for loading the library file may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
In addition, in order to implement a function of hot loading a library file, an embodiment of the present invention further provides an apparatus for loading a library file, as shown in fig. 4, where the apparatus for loading a library file includes a target library file determining module 102, a target library file searching module 104, a target library file caching module 106, a first checking module 108, and a target library file loading module 110, where:
the target library file determining module 102 is configured to detect a service calling process, and determine a target library file according to the service calling process;
a target library file searching module 104, configured to search the target library file in a cache directory, and determine a library file server corresponding to the target library file when the target library file is not searched; initiating a downloading request corresponding to the target library file to the library file server;
a target repository file caching module 106, configured to access the repository file server, and download the target repository file from the repository file server to the caching directory;
a first checking module 108, configured to check whether a target library file in the cache directory is consistent with a file version stored on the library file server;
and the target library file loading module 110 is configured to load the target library file by adding the target library file to the class loading path if the result of the checking module is yes.
Optionally, in an embodiment, the target library file searching module 104 is further configured to call the target library file loading module 110 when the target library file is found in the cache directory.
Optionally, in an embodiment, the target library file loading module 110 is further configured to copy the target library file from the cache directory to a class loading path directory corresponding to the class loading path, and load the target library file by a system class loader corresponding to the class loading path directory.
Optionally, in an embodiment, the first checking module 108 is further configured to check whether the target library file in the cache directory is consistent with the file version stored on the library file server by comparing at least one of a version number, a file size, or a hash value.
Optionally, in an embodiment, as shown in fig. 4, the apparatus further includes a first deleting module 112, configured to delete the target library file in the cache directory and the class load path directory and call the target library file searching module when the result of the checking module is negative.
Optionally, in an embodiment, as shown in fig. 4, the apparatus further includes a second checking module 114, configured to check, when the target library file exists in the class load path directory, whether the target library file in the class load path directory is consistent with the file version stored on the library file server, and if a result of the second checking module is no, invoke the target library file searching module 104.
Optionally, in an embodiment, as shown in fig. 4, the apparatus further includes a second deleting module 116, configured to delete the target library file in the cache directory and the class loading path directory when the system class loader corresponding to the class loading path directory fails to load the target library file.
Optionally, in an embodiment, the target library file loading module 110 is further configured to transfer a path of the target library file in the cache directory as a parameter of a class loading path to a preset custom class loader, and load the target library file by the custom class loader.
Optionally, in an embodiment, as shown in fig. 4, the apparatus further includes a cache cleaning module 118, configured to detect a size of a file in the cache directory, and delete library files in the cache directory according to a downloading time sequence or a sequence from small to large of loading times when the size of the file is greater than or equal to a threshold, until the size of the file is smaller than the threshold.
The embodiment of the invention has the following beneficial effects:
after the method and the device for loading the library file are adopted, when the library file outside the installation package needs to be called in the service calling process, the library file is determined, then the library file is downloaded from the server to the newly added cache directory, then the library file is verified, and after the library file is verified to be correct, the library file is loaded through the class loader, so that the loading process can be prevented when the library file fails to be downloaded or the library file is maliciously replaced, and the safety and the reliability are improved.
In addition, when the library file needs to be loaded again in subsequent service calling, the library file can be directly searched in the cache directory, the library file in the cache directory is verified, the library file in the cache directory is directly loaded after the verification is passed, and the file does not need to be downloaded again by the server, so that the network flow is also saved.
In one embodiment, as shown in fig. 5, fig. 5 illustrates a VR device 10 of a von neumann based computer system running the method of loading library files described above. The computer system may be a host device of the VR device or a VR head mounted display device that integrates host functionality. Specifically, an external input interface 1001, a processor 1002, a memory 1003, and an output interface 1004, which are connected through a system bus, may be included. The external input interface 1001 may optionally include at least a network interface 10012 and a gyro sensor 10014. Memory 1003 can include external memory 10032 (e.g., a hard disk, optical or floppy disk, etc.) and internal memory 10034. The output interface 1004 may include at least a display 10042 or the like.
In this embodiment, the method is executed based on a computer program, program files of the computer program are stored in the external memory 10032 of the computer system 10 based on the von neumann system, loaded into the internal memory 10034 at the time of execution, and then compiled into machine code and then transferred to the processor 1002 for execution, so that the logical target library file determination module 102, the target library file lookup module 104, the target library file cache module 106, the first verification module 108, the target library file loading module 110, the first deletion module 112, the second verification module 114, the second deletion module 116, and the cache cleaning module 118 are formed in the computer system 10 based on the von neumann system. In the execution process of the method for loading the library file, the input parameters are all received through the external input interface 1001, and are transferred to the memory 1003 for caching, and then are input into the processor 1002 for processing, and the processed result data is cached in the memory 1003 for subsequent processing, or is transferred to the output interface 1004 for outputting.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (11)

1. A method of loading a library file, comprising:
detecting a service calling process, and determining a target library file according to the service calling process, wherein the target library file is a library file which is missed in the service calling process;
searching the target library file in a cache directory, and determining a library file server corresponding to the target library file when the target library file is not searched; initiating a download request corresponding to the target library file to the library file server;
accessing the library file server, and downloading the target library file from the library file server to the cache directory;
checking whether the target library file in the cache directory is consistent with the file version stored on the library file server, if so, adding the target library file into a class loading path to load the target library file;
when the target library file is loaded by adding the target library file into the class loading path, namely copying the target library file from the cache directory into the class loading path directory corresponding to the class loading path, and loading the target library file by a system class loader corresponding to the class loading path directory, before the target library file is searched in the cache directory, if the target library file exists in the class loading path directory, checking whether the target library file in the class loading path directory is consistent with the file version stored on the library file server, if not, executing the step of searching the target library file in the cache directory, and if so, loading the target library file by the system class loader.
2. The method of loading a library file according to claim 1, wherein after searching the target library file in the cache directory, the method further comprises:
if the target library file is found, the step of checking whether the target library file in the cache directory is consistent with the file version stored on the library file server is executed.
3. The method of loading a library file according to claim 1, wherein after the loading the target library file by the system class loader corresponding to the class loading path directory further comprises:
and when the loading fails, deleting the target library file in the cache directory and the class loading path directory.
4. The method of loading a library file of claim 1, wherein verifying that the target library file in the cache directory is consistent with the version of the file stored on the library file server further comprises:
and checking whether the target library file in the cache directory is consistent with the file version stored on the library file server or not by comparing at least one of the version number, the file size or the hash value.
5. The method for loading a library file according to claim 1, wherein the verifying whether the target library file in the cache directory is consistent with the file version stored on the library file server further comprises:
and if the target library file is inconsistent with the target library file in the class loading path directory, deleting the target library file in the cache directory and the class loading path directory, and executing a step of determining a library file server corresponding to the target library file.
6. The method for loading a library file according to claim 1, wherein the loading the target library file by adding the target library file to a class loading path comprises:
and transmitting the path of the target library file in the cache directory as a parameter of a class loading path to a preset custom class loader, and loading the target library file by the custom class loader.
7. The method of loading a library file of claim 1, further comprising:
and detecting the size of the file in the cache directory, and deleting the library files in the cache directory according to the downloading time sequence or the loading times from small to large when the size of the file is larger than or equal to a threshold value until the size of the file is smaller than the threshold value.
8. An apparatus for loading a library file, comprising:
the target library file determining module is used for detecting a service calling process and determining a target library file according to the service calling process, wherein the target library file is a library file which is missed in the service calling process;
the target library file searching module is used for searching the target library file in a cache directory, and determining a library file server corresponding to the target library file when the target library file is not searched; initiating a download request corresponding to the target library file to the library file server;
the target library file caching module is used for accessing the library file server and downloading the target library file from the library file server to the caching directory;
the first checking module is used for checking whether the target library file in the cache directory is consistent with the file version stored on the library file server or not;
the target library file loading module is used for loading the target library file by adding the target library file into the class loading path when the result of the checking module is positive;
the target library file loading module is further configured to copy the target library file from the cache directory to a class loading path directory corresponding to the class loading path, and load the target library file by a system class loader corresponding to the class loading path directory;
and the second check module is used for checking whether the target library file in the class loading path directory is consistent with the file version stored on the library file server or not when the target library file exists in the class loading path directory, and calling the target library file search module when the result of the second check module is negative.
9. The apparatus for loading a library file according to claim 8, wherein the target library file loading module is further configured to pass a path of the target library file in the cache directory as a parameter of a class loading path to a preset custom class loader, and load the target library file by the custom class loader.
10. The apparatus according to claim 8, further comprising a cache cleaning module, configured to detect a size of a file in the cache directory, and delete the library files in the cache directory according to a downloading time sequence or a sequence of increasing loading times when the size of the file is greater than or equal to a threshold value until the size of the file is smaller than the threshold value.
11. A computer storage medium comprising computer instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1-7.
CN201710203810.0A 2017-03-30 2017-03-30 Method and device for loading library file Active CN107038045B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710203810.0A CN107038045B (en) 2017-03-30 2017-03-30 Method and device for loading library file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710203810.0A CN107038045B (en) 2017-03-30 2017-03-30 Method and device for loading library file

Publications (2)

Publication Number Publication Date
CN107038045A CN107038045A (en) 2017-08-11
CN107038045B true CN107038045B (en) 2022-10-14

Family

ID=59533847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710203810.0A Active CN107038045B (en) 2017-03-30 2017-03-30 Method and device for loading library file

Country Status (1)

Country Link
CN (1) CN107038045B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228717A (en) * 2017-12-06 2018-06-29 五八有限公司 The loading method and device of the page
CN108037929A (en) * 2017-12-25 2018-05-15 北京中关村科金技术有限公司 A kind of message treatment method and system
CN110209427B (en) * 2018-02-28 2022-07-15 阿里巴巴集团控股有限公司 Application system, starting method thereof, electronic device and storage medium
US10705857B2 (en) * 2018-04-25 2020-07-07 Hewlett Packard Enterprise Development Lp Initialising operations support systems
CN109408107B (en) * 2018-10-09 2022-06-21 深圳点猫科技有限公司 Method for improving retrieval speed based on education system and electronic equipment
CN109583198B (en) * 2018-12-12 2021-06-08 北京字节跳动网络技术有限公司 Page monitoring method and device, storage medium and electronic equipment
CN109857454B (en) * 2018-12-15 2023-07-18 中国平安人寿保险股份有限公司 Method, device, electronic equipment and storage medium for generating and caching installation package
CN109857432B (en) * 2019-01-14 2022-05-20 珠海金山网络游戏科技有限公司 Hot updating method and device for game application
CN110096272A (en) * 2019-03-19 2019-08-06 深圳壹账通智能科技有限公司 Library file processing method, device, computer equipment and storage medium
CN110673869B (en) * 2019-09-24 2023-09-12 聚好看科技股份有限公司 Library file loading method, device and system
CN111124373A (en) * 2019-12-26 2020-05-08 武汉精鸿电子技术有限公司 Test software development method and device and test equipment
CN111290999B (en) * 2020-01-10 2023-06-13 高新兴物联科技股份有限公司 Library file self-adaptive matching method, device and computer readable storage medium
CN112732349A (en) * 2020-12-31 2021-04-30 深圳市珍爱捷云信息技术有限公司 Method and device for loading SO library, electronic equipment and computer readable storage medium
CN113010181B (en) * 2021-03-24 2022-05-27 北京百度网讯科技有限公司 Deployment method and device of operators in deep learning framework and electronic equipment
CN113050984A (en) * 2021-03-26 2021-06-29 挂号网(杭州)科技有限公司 Resource calling method and device, electronic equipment and storage medium
CN114356441B (en) * 2021-12-22 2022-09-23 北京海泰方圆科技股份有限公司 Plug-in preloading method and device, electronic equipment and storage medium
CN114968394A (en) * 2022-04-18 2022-08-30 广州博冠信息科技有限公司 Loading method and device of dynamic link library file and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB9925510D0 (en) * 1999-10-29 1999-12-29 Ibm Incorporating native code in java archive files
CN102262555A (en) * 2011-08-22 2011-11-30 迈普通信技术股份有限公司 Method and device for loading different versions of JAVA three-party library
EP2677451A2 (en) * 2012-06-20 2013-12-25 Samsung Electronics Co., Ltd License verification method and apparatus, and computer readable storage medium storing program therefor
CN105245369A (en) * 2015-10-12 2016-01-13 天津市普迅电力信息技术有限公司 Component issuing container method supporting multiple transport protocols
KR20160025881A (en) * 2014-08-28 2016-03-09 주식회사 안랩 Apparatus and method for detecting malicious shared library file
CN105488418A (en) * 2015-11-24 2016-04-13 航天恒星科技有限公司 Trusted boot method and system for virtualization platform server
CN105511902A (en) * 2015-11-09 2016-04-20 Tcl集团股份有限公司 Android platform module dynamic loading method and system
CN105786538A (en) * 2014-12-24 2016-07-20 博雅网络游戏开发(深圳)有限公司 Software upgrading method and device based on Android system

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6591418B2 (en) * 1999-03-26 2003-07-08 Dell U.S.A., L.P. Factory software management system
US20080275923A1 (en) * 2007-05-02 2008-11-06 International Business Machines Corporation Method for the expungement of backup versions of files on server targets that are configured to be updated sequentially
CN101938469A (en) * 2010-08-08 2011-01-05 北京大学 Method and system for transparently loading Android library file during operation
US9703578B2 (en) * 2012-08-23 2017-07-11 Red Hat, Inc. Providing class loading for JAVA™ applications
CN104049986B (en) * 2013-03-14 2018-12-18 腾讯科技(深圳)有限公司 plug-in loading method and device
CN104102502B (en) * 2013-04-09 2018-09-04 腾讯科技(深圳)有限公司 A kind of processing method that realizing heat deployment, device and server
CN103970563B (en) * 2014-04-15 2017-04-05 四川长虹电器股份有限公司 The method of dynamic load Android class
JP6409514B2 (en) * 2014-11-10 2018-10-24 日本電気株式会社 Information processing apparatus, library loading method, and computer program
CN104717561B (en) * 2015-04-05 2018-02-23 西安航空学院 A kind of video downloading system
CN105204914B (en) * 2015-10-23 2018-06-19 中国联合网络通信集团有限公司 Application software method for down loading and device
CN105389186A (en) * 2015-11-20 2016-03-09 福建亿榕信息技术有限公司 Hot deployment method and system for Java application

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB9925510D0 (en) * 1999-10-29 1999-12-29 Ibm Incorporating native code in java archive files
CN102262555A (en) * 2011-08-22 2011-11-30 迈普通信技术股份有限公司 Method and device for loading different versions of JAVA three-party library
EP2677451A2 (en) * 2012-06-20 2013-12-25 Samsung Electronics Co., Ltd License verification method and apparatus, and computer readable storage medium storing program therefor
KR20160025881A (en) * 2014-08-28 2016-03-09 주식회사 안랩 Apparatus and method for detecting malicious shared library file
CN105786538A (en) * 2014-12-24 2016-07-20 博雅网络游戏开发(深圳)有限公司 Software upgrading method and device based on Android system
CN105245369A (en) * 2015-10-12 2016-01-13 天津市普迅电力信息技术有限公司 Component issuing container method supporting multiple transport protocols
CN105511902A (en) * 2015-11-09 2016-04-20 Tcl集团股份有限公司 Android platform module dynamic loading method and system
CN105488418A (en) * 2015-11-24 2016-04-13 航天恒星科技有限公司 Trusted boot method and system for virtualization platform server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于Android平台软件保护方法研究";王琳;《中国优秀硕士学位论文全文数据库 信息科技辑》;20150715;I138-26 *

Also Published As

Publication number Publication date
CN107038045A (en) 2017-08-11

Similar Documents

Publication Publication Date Title
CN107038045B (en) Method and device for loading library file
US9596257B2 (en) Detection and prevention of installation of malicious mobile applications
US10552610B1 (en) Adaptive virtual machine snapshot update framework for malware behavioral analysis
US8245289B2 (en) Methods and systems for preventing security breaches
RU2646352C2 (en) Systems and methods for using a reputation indicator to facilitate malware scanning
JP4676744B2 (en) Security-related programming interface
CN105786538B (en) software upgrading method and device based on android system
WO2019072008A1 (en) Security scanning method and apparatus for mini program, and electronic device
AU2021206497B2 (en) Method and apparatus for authority control, computer device and storage medium
US9330260B1 (en) Detecting auto-start malware by checking its aggressive load point behaviors
CN102999720A (en) Program identification method and system
CN113391874A (en) Virtual machine detection countermeasure method and device, electronic equipment and storage medium
US11416614B2 (en) Statistical detection of firmware-level compromises
CN110765394A (en) So file loading method and device, storage medium and terminal equipment
CN102999721B (en) A kind of program processing method and system
CN106295371B (en) Using operation method, file reinforcement means and device
CN108959915B (en) Rootkit detection method, rootkit detection device and server
US10241696B1 (en) Securely launching files downloaded to potentially unsafe locations on a computer system
US20210073386A1 (en) Trusted sequence for computing devices via hashes
US20190080090A1 (en) Method and apparatus for detecting dynamically-loaded malware with run time predictive analysis
US10997285B2 (en) Selectively blocking the loading of a privileged application
CN117193874B (en) Plug-in processing method and device, storage medium and electronic equipment
JP7255681B2 (en) Execution control system, execution control method, and program
US20240289303A1 (en) Namespace mapping to support file hash generation
US20240289475A1 (en) Fingerprinting techniques to support file hash generation

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
GR01 Patent grant
GR01 Patent grant