CN105630540A - Application class loading method and device as well as web application class loader - Google Patents

Application class loading method and device as well as web application class loader Download PDF

Info

Publication number
CN105630540A
CN105630540A CN201510960904.3A CN201510960904A CN105630540A CN 105630540 A CN105630540 A CN 105630540A CN 201510960904 A CN201510960904 A CN 201510960904A CN 105630540 A CN105630540 A CN 105630540A
Authority
CN
China
Prior art keywords
class
loading
request
loader
load
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
CN201510960904.3A
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.)
CVIC Software Engineering Co Ltd
Original Assignee
CVIC Software Engineering 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 CVIC Software Engineering Co Ltd filed Critical CVIC Software Engineering Co Ltd
Priority to CN201510960904.3A priority Critical patent/CN105630540A/en
Publication of CN105630540A publication Critical patent/CN105630540A/en
Pending legal-status Critical Current

Links

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 invention provides an application class loading method and device as well as a web application class loader. The method comprises the following steps: obtaining a class loading request, wherein the class loading request comprises the class name of a class requested to be loaded; judging whether the class requested to be loaded needs to entrust a parent loader to load according to the class name of the class requested to be loaded; if the judging result is positive, sending the class requested to be loaded to the parent loader; and if the judging result is negative, locally loading the class requested to be loaded. Through the method, a dynamic configurable class loading mechanism is provided and the class loading manner can be controlled flexibly, so that the application deployment or migration can be efficiently and conveniently completed.

Description

A kind of application kind loading method, device and web application Classloader
Technical field
The present invention relates to Computer Applied Technology field, particularly relate to a kind of application kind loading method, device and web application Classloader.
Background technology
At present, for with the javax. class started, Classloader in application server can entrust father's loader to carry out class loading, application server self have various version with javax. beginning class, the application that application server to be disposed or to migrate also can introduce various version with javax. start class. Visible, the class of application server and application server wait that the class of the application disposed or migrate is likely to be class of the same name, for instance be all with the class of javax. beginning.
In the process realizing the present invention, inventor have found that prior art at least exists following technical problem:
Owing to application server can preferentially load the class of self, rather than the class of the application to dispose or to migrate, so when class and the application server of application server is when the class of the application disposed or migrate is class of the same name, can cause that class loads loaded is not the class of the application to dispose or to migrate, but the class of the same name that application server has, thus cause that application is disposed unsuccessfully; It addition, the class of application server also can exist the two from the class waiting the application disposed or migrate belongs to the class of the same name that version is different, now can cause class collision problem, dispose thus will also result in application or migrate unsuccessfully.
Summary of the invention
Application kind loading method provided by the invention, device and web application Classloader, it is by the class load mechanism of dynamic and configurable, it is possible to control class load mode flexibly, thus efficiently and conveniently completing deployment or the migration of application.
First aspect, the present invention provides a kind of application kind loading method, including:
Obtaining class load request, described class load request includes the class name of request of loading class;
Class name according to request of loading class, it is judged that described request of loading class loads the need of trust father's loader;
If it is, described request of loading class is sent to described father's loader;
If it is not, then self loads described request of loading class.
Alternatively, the described class name according to request of loading class, it is judged that described request of loading class carries out loading the need of trust father's loader and includes:
Reading does not need described father's loader and carries out the class name set of loading classes;
Judge the class name whether comprising described request of loading class in the class name set read, if it is, show that described request of loading class needs self to load; If it is not, then show that described request of loading class needs to entrust described father's loader to load.
Second aspect, the present invention provides a kind of application class charger, including acquisition module, judge module, sending module and load-on module, wherein,
Described acquisition module, is used for obtaining class load request, and described class load request includes the class name of request of loading class;
Described judge module, for the class name according to request of loading class, it is judged that described request of loading class loads the need of trust father's loader;
Described sending module, for when the judged result of described judge module is for being, sending described request of loading class to described father's loader;
Described load-on module, for when the judged result of described judge module is no, loading described request of loading class.
Alternatively, described judge module includes reading unit and judging unit, wherein,
Described reading unit, need not carry out the class name set of loading classes by described father's loader for reading;
Described judging unit, for judging whether to comprise in the class name set read the class name of described request of loading class, if it is, show that described request of loading class needs self to load; If it is not, then show that described request of loading class needs to entrust described father's loader to load.
The third aspect, the present invention provides a kind of web application Classloader, and described web application Classloader includes the application class charger described in any of the above-described item.
Application kind loading method, device and the web application Classloader that the embodiment of the present invention provides, compared with prior art, it is by the class load mechanism of dynamic and configurable, class load mode can be controlled flexibly, namely before loading, first pass through the class name set reading the class that father's loader need not be entrusted to carry out loading, determine the load mode of requested loading classes, namely self load or entrust father's loader to load, thus efficiently and conveniently completing deployment or the migration of application.
Accompanying drawing explanation
Fig. 1 is the flow chart of one embodiment of the invention application kind loading method;
Fig. 2 is the flow chart of another embodiment of the present invention application kind loading method;
Fig. 3 is the structural representation of one embodiment of the invention application class charger;
Fig. 4 is the structural representation of another embodiment of the present invention application class charger.
Detailed description of the invention
For making the purpose of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only a part of embodiment of the present invention, rather than whole embodiments. Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under not making creative work premise, broadly fall into the scope of protection of the invention.
The present invention provides a kind of application kind loading method, as it is shown in figure 1, described method includes:
S11, acquisition class load request, described class load request includes the class name of request of loading class;
S12, class name according to request of loading class, it is judged that described request of loading class loads the need of entrusting father's loader;
If it is, proceed to step S13; If it is not, then proceed to step S14;
S13, described request of loading class is sent to described father's loader;
S14, self load described request of loading class.
The application kind loading method that the embodiment of the present invention provides, compared with prior art, it is by the class load mechanism of dynamic and configurable, it is possible to control class load mode flexibly, thus efficiently and conveniently completing deployment or the migration of application.
Alternatively, as in figure 2 it is shown, described step S12 specifically may include that
S121, reading do not need described father's loader and carry out the class name set of loading classes;
Whether the class name set that S122, judgement are read comprises the class name of described request of loading class, if it is, show that described request of loading class needs self to load; If it is not, then show that described request of loading class needs to entrust described father's loader to load.
The application kind loading method that the embodiment of the present invention provides, compared with prior art, it is by the class load mechanism of dynamic and configurable, class load mode can be controlled flexibly, namely before loading, first pass through the class name set reading the class that father's loader need not be entrusted to carry out loading, determine the load mode of requested loading classes, namely self load or entrust father's loader to load, thus efficiently and conveniently completing deployment or the migration of application.
After described request of loading class completes to load, it is possible to be entrust the loading that carries out of father's loader by checking that load path knows requested loading classes, what be also by self loads.
The embodiment of the present invention also provides for a kind of application class charger, as it is shown on figure 3, described device includes acquisition module 21, judge module 22, sending module 23 and load-on module 24, wherein,
Described acquisition module 21, is used for obtaining class load request, and described class load request includes the class name of request of loading class;
Described judge module 22, for the class name according to request of loading class, it is judged that described request of loading class loads the need of trust father's loader;
Described sending module, for when the judged result of described judge module is for being, sending described request of loading class to described father's loader;
Described load-on module, for when the judged result of described judge module is no, loading described request of loading class.
The application class charger that the embodiment of the present invention provides, compared with prior art, it is by the class load mechanism of dynamic and configurable, it is possible to control class load mode flexibly, thus efficiently and conveniently completing deployment or the migration of application.
Alternatively, as shown in Figure 4, described judge module 22 includes reading unit 221 and judging unit 222, wherein,
Described reading unit 221, need not carry out the class name set of loading classes by described father's loader for reading;
Described judging unit 222, for judging whether to comprise in the class name set read the class name of described request of loading class, if it is, show that described request of loading class needs self to load; If it is not, then show that described request of loading class needs to entrust described father's loader to load.
The application class charger that the embodiment of the present invention provides, compared with prior art, it is by the class load mechanism of dynamic and configurable, class load mode can be controlled flexibly, namely before loading, first pass through the class name set reading the class that father's loader need not be entrusted to carry out loading, determine the load mode of requested loading classes, namely self load or entrust father's loader to load, thus efficiently and conveniently completing deployment or the migration of application.
The embodiment of the present invention also provides for a kind of web application Classloader, and described web application Classloader includes the application class charger described in any of the above-described item.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, can be by the hardware that computer program carrys out instruction relevant to complete, described program can be stored in a computer read/write memory medium, this program is upon execution, it may include such as the flow process of the embodiment of above-mentioned each side method. Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory, ROM) or random store-memory body (RandomAccessMemory, RAM) etc.
The above; being only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, any those familiar with the art is in the technical scope that the invention discloses; the change that can readily occur in or replacement, all should be encompassed within protection scope of the present invention. Therefore, protection scope of the present invention should be as the criterion with scope of the claims.

Claims (5)

1. an application kind loading method, is applied in web application Classloader, it is characterised in that including:
Obtaining class load request, described class load request includes the class name of request of loading class;
Class name according to described request of loading class, it is judged that described request of loading class loads the need of trust father's loader;
If it is, described request of loading class is sent to described father's loader;
If it is not, then self loads described request of loading class.
2. method according to claim 1, it is characterised in that the described class name according to request of loading class, it is judged that described request of loading class carries out loading the need of trust father's loader and includes:
Reading does not need described father's loader and carries out the class name set of loading classes;
Judge the class name whether comprising described request of loading class in the class name set read, if it is, show that described request of loading class needs self to load; If it is not, then show that described request of loading class needs to entrust described father's loader to load.
3. an application class charger, is applied in web application Classloader, it is characterised in that include acquisition module, judge module, sending module and load-on module, wherein,
Described acquisition module, is used for obtaining class load request, and described class load request includes the class name of request of loading class;
Described judge module, for the class name according to described request of loading class, it is judged that described request of loading class loads the need of trust father's loader;
Sending module, for when the judged result of described judge module is for being, sending described request of loading class to described father's loader;
Load-on module, for when the judged result of described judge module is no, loading described request of loading class.
4. device according to claim 3, its spy is in that, described judge module includes reading unit and judging unit, wherein,
Described reading unit, need not carry out the class name set of loading classes by described father's loader for reading;
Described judging unit, for judging whether to comprise in the class name set read the class name of described request of loading class, if it is, show that described request of loading class needs self to load; If it is not, then show that described request of loading class needs to entrust described father's loader to load.
5. a web application Classloader, it is characterised in that described web application Classloader includes the application class charger described in any one of claim 3-4.
CN201510960904.3A 2015-12-21 2015-12-21 Application class loading method and device as well as web application class loader Pending CN105630540A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510960904.3A CN105630540A (en) 2015-12-21 2015-12-21 Application class loading method and device as well as web application class loader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510960904.3A CN105630540A (en) 2015-12-21 2015-12-21 Application class loading method and device as well as web application class loader

Publications (1)

Publication Number Publication Date
CN105630540A true CN105630540A (en) 2016-06-01

Family

ID=56045521

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510960904.3A Pending CN105630540A (en) 2015-12-21 2015-12-21 Application class loading method and device as well as web application class loader

Country Status (1)

Country Link
CN (1) CN105630540A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201592A (en) * 2016-06-29 2016-12-07 北京小米移动软件有限公司 A kind of method and apparatus searching class
CN110020297A (en) * 2017-10-31 2019-07-16 北京国双科技有限公司 A kind of loading method of web page contents, apparatus and system
CN112631685A (en) * 2020-12-30 2021-04-09 中国农业银行股份有限公司 Class loading method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101017436A (en) * 2006-02-01 2007-08-15 佳能株式会社 Execution apparatus and method
CN101118497A (en) * 2007-09-20 2008-02-06 金蝶软件(中国)有限公司 Method and device for class loading process
CN102158490A (en) * 2011-04-07 2011-08-17 山东中创软件商用中间件股份有限公司 Service switching method based on OSGi and device thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101017436A (en) * 2006-02-01 2007-08-15 佳能株式会社 Execution apparatus and method
CN101118497A (en) * 2007-09-20 2008-02-06 金蝶软件(中国)有限公司 Method and device for class loading process
CN102158490A (en) * 2011-04-07 2011-08-17 山东中创软件商用中间件股份有限公司 Service switching method based on OSGi and device thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
孙鸣 等: "Java 类的热替换 —— 概念、设计与实现", 《HTTPS://WWW.IBM.COM/DEVELOPERWORKS/CN/JAVA/J-LO-HOTSWAPCLS/》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201592A (en) * 2016-06-29 2016-12-07 北京小米移动软件有限公司 A kind of method and apparatus searching class
CN110020297A (en) * 2017-10-31 2019-07-16 北京国双科技有限公司 A kind of loading method of web page contents, apparatus and system
CN112631685A (en) * 2020-12-30 2021-04-09 中国农业银行股份有限公司 Class loading method and device
CN112631685B (en) * 2020-12-30 2024-04-12 中国农业银行股份有限公司 Class loading method and device

Similar Documents

Publication Publication Date Title
CN106897095B (en) Method and device for hot repairing application program, readable storage medium and computing equipment
CN105677258A (en) Method and system for managing log data
US20080114923A1 (en) Apparatus and method for controlling operation processing in nonvolatile memory
US20120284471A1 (en) Virtual machine disk migration
CN105760191A (en) Embedded system equipment programming mass production method
US9910679B2 (en) Selective loading of components within a node to speed up maintenance actions
CN105630540A (en) Application class loading method and device as well as web application class loader
US20100037094A1 (en) Application Failure Recovery
CN114924923A (en) Method, system, equipment and medium for verifying correctness of hard disk write-in point
CN107864209B (en) Data writing method and device and server
US20190286544A1 (en) Method, device and server for checking a defective function
CN103617053A (en) Method and device for upgrading software
CN105446856A (en) Electronic device interface detection method and apparatus
CN106843764B (en) Method and system for creating soft independent redundant disk array
KR102116096B1 (en) Multisystem, and method of booting the same
US11630742B2 (en) System and method of performing recovery using a backup image
US20140181161A1 (en) Method and system for speeding up computer program
CN102760063B (en) A kind of file loading method and device
CN106817355B (en) Method and device for controlling webpage permission
CN103677879A (en) Software installation method and corresponding software installation device
US9298602B2 (en) Nonvolatile random access memory use
CN107222355B (en) Server upgrading method and device
CN104615387A (en) Vehicle-mounted equipment based on XPE system and design method of vehicle-mounted equipment
CN114780208A (en) Method, system, device and storage medium for verifying backup validity of multi-platform virtual machine
CN101329623B (en) Computer system and memory control method

Legal Events

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

Application publication date: 20160601

RJ01 Rejection of invention patent application after publication