CN102402427B - A kind of update method of java application and device - Google Patents
A kind of update method of java application and device Download PDFInfo
- Publication number
- CN102402427B CN102402427B CN201010279955.7A CN201010279955A CN102402427B CN 102402427 B CN102402427 B CN 102402427B CN 201010279955 A CN201010279955 A CN 201010279955A CN 102402427 B CN102402427 B CN 102402427B
- Authority
- CN
- China
- Prior art keywords
- class
- loading procedure
- class file
- target
- target class
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 97
- 230000007246 mechanism Effects 0.000 claims description 14
- 238000012545 processing Methods 0.000 claims description 9
- 230000011514 reflex Effects 0.000 claims description 8
- 230000008569 process Effects 0.000 abstract description 18
- 230000008859 change Effects 0.000 description 13
- 230000000875 corresponding effect Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 6
- 230000006399 behavior Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 238000005538 encapsulation Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 230000008685 targeting Effects 0.000 description 1
Landscapes
- Stored Programmes (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
This application discloses a kind of update method and device of java application, for improving the renewal efficiency of java application.The method is: obtain at least one target class file, and for the corresponding class loading procedure of at least one target class file set up obtained, in java application operational process, adopt described class loading procedure by least one target class files loading described in the java application of running status; Wherein, described class loading procedure inherits current environment loading procedure.Like this, only need load the target class file of recompility, the heat just achieving java application is disposed, thus improves the renewal efficiency of java application.Invention also provides corresponding device.
Description
Technical field
The application relates to computer realm, particularly a kind of update method of application program and device.
Background technology
In Java software performance history, developer needs after revising code to recompilate at every turn, and is encapsulated as application program, then restarts application program, just can see amended final implementation effect; After some application program recompilates, restart and need the long period, such as, the application program (e.g., the WEB layer exploitation of WEB application) of Development of Module cannot be divided into, for this kind of application program, even if the code that each amendment is seldom measured, all need to recompilate the whole application program of encapsulation, and closedown restarts WEB application server (e.g., Jboss) again.In the exploitation of enterprise-level, generally, common application program is revised, from amendment code to closing and restarting WEB server, this time of about 5 minutes of process need, for larger application program, this process may need the time of more than 10 minute; And in programming process, developer needs regularly to check the operation result of current code and makes corresponding modify, to ensure that code presents corresponding effect according to the wish of developer, therefore need constantly close and restart WEB server, like this, just make and meaninglessly spend the time on code compilation, re-launching applications greatly to promote, especially when repairing code error, this consumption is more obvious, thus seriously reduces the efficiency of code research and development.In addition, for large-scale service application program, in escalation process, often need to restart application program, recompilate and dispose, and release application program again, restarting in service process, often needing to interrupt external service, thus the service quality of influential system.
For the problems referred to above, under prior art, provide two kinds of solutions:
The first solution is: directly use the heat of WEB server (e.g., tomcat, Jboss) to dispose function.Namely WEB server monitoring file changes, if certain file is modified, WEB server just reloads this file said module; Thus realize heat deployment.
But adopt this kind of solution, there is following shortcoming:
A, WEB server are changed by monitoring file, reload whole module, only can carry out heat for sevlet (a kind of java application of server end) and load; For the application program employing framework, cannot content in loading frame, if load the renewal of implementation framework code by servlet heat, need initialization framework again, speed is slowly.
After B, each amendment file, WEB server automatically can be carried out heat and be disposed, and this can make memory requirements increase, meanwhile, owing to reinitializing corresponding module, so can take a large amount of cpu resource; After repeatedly heat is disposed, system resource can be taken in a large number, thus has to stop heat disposing, and recompilates application program and restarts service.
The second solution is: the method adopting hotswap, the interface (Jpda or Jvmti) provided by Java Virtual Machine (Jvm), change the state of Java Virtual Machine, the class file revised (.class file) is replaced original .class file in Jvm.Modify in the region adopting above-mentioned solution can realize arriving in running status, the debugging tool of employing can be debug, has certain heat and dispose ability.
But, adopt this kind of solution, there is following shortcoming:
Modifying in A, the region that only can be able to arrive for running status, and can not increase new region.As, only support the amendment to method body, do not support increase method, amending method name, the operations such as method parameter.Dispose for heat, cannot accomplish that the heat of whole code is disposed, particularly regular operation, such as increases method, increases inner classes, amending method name etc.; The range of application of heat deploying method can be had a strong impact on, there is certain limitation.
The heat that B, Hotswap provide disposes more complicated, can produce unstable phenomenon, collapse sometimes during use.
C, the exploitation amount being realized the instrument adopted when heat is disposed by this kind of solution are very big, can increase exploitation complexity.
In sum, the heat of the java application that existing solution all cannot be realized ideal is disposed, and needs to provide a kind of new scheme to overcome the defect of existing scheme.
Summary of the invention
The application provides a kind of amending method and device of java application, in order in the process of modifying to java application, reduces the complexity of operating process, improves its execution efficiency.
The concrete technical scheme that the application provides is as follows:
A update method for java application, comprising:
Determine the target class file that there is at least one compiling generation;
At least one target class file described is obtained in designated storage location;
For the corresponding class loading procedure of at least one target class file set up obtained, adopt described class loading procedure by least one target class files loading described in the java application of running status; Wherein, described class loading procedure inherits current environment loading procedure.
For the device that java application upgrades, comprising:
Scanning element, for determining the target class file that there is at least one compiling generation;
Acquiring unit, for obtaining at least one target class file described in designated storage location;
Processing unit, for for the corresponding class loading procedure of at least one target class file set up obtained, adopts described class loading procedure by least one target class files loading described in the java application of running status; Wherein, described class loading procedure inherits current environment loading procedure.
In the embodiment of the present application, develop new hot deployment tool, by the easyStartClassLoader of newly-built succession current environment classloader, at designated storage location loaded targets class file, and be loaded in the java application of running status, thus completed the renewal of java application, like this, only need load the target class file of recompility, the heat just achieving java application is disposed, thus improves the renewal efficiency of java application.
Accompanying drawing explanation
Fig. 1 is WEB server principle of work schematic diagram in the embodiment of the present application;
Fig. 2 is WEB server functional structure chart in the embodiment of the present application;
Fig. 3 is that in the embodiment of the present application, WEB server carries out renewal process flow diagram to the java application of running status.
Embodiment
Consult shown in Fig. 1, in the process that java application is modified, in order to reduce the complexity of operating process, improve its execution efficiency, in the embodiment of the present application, have developed a kind of hot deployment tool newly, preferably, the WEB server that this hot Some tools is operationally adopted is Jboss, the code development environment (i.e. code editor) adopted is: eclipse, and the embodiment of the present application is not limited to Jboss and eclipse two kinds of implementations, be only citing herein, just exemplary explanation here
As shown in Figure 1, under prior art, when developer has write source code, the compilation tools such as antx/maven can be used to carry out compiling encapsulation to source code, and finally generate software product (e.g., a java application that can run); Then, this software product is deployed on Jboss by developer, restart Jvm (JavaVirtual Machine, Java Virtual Machine), Jboss is started by Jvm, software product (comprise startup application framework, started the application code of software product by application framework) is started again by Jboss; Now, developer sends a fill order to Jboss, can see corresponding implementation effect.If find to need to modify to source code according to implementation effect, so developer needs to close Jboss, and repeat the amendment of above-mentioned source code, compiling encapsulation process, the software product generated according to amended source code is deployed on Jboss again, then restarts Jboss to run amended software product.This process need long period, the amendment efficiency of java application can be reduced, thus affect the performance of whole service system.
Different from ordinary procedure, java applet (.class file) is not local executable program.When needs run .class file, first Jvm (Java Virtual Machine) should be run, and then run in .class files loading to Jvm, the instrument being responsible for loading .class file is just called classloader, and the interface that Jvm uses in loading procedure is called Jvmti interface.In the embodiment of the present application, in the hot deployment tool redesigned, redefine the function of Jvmti interface, substituted for original skeleton code in Jvm, like this, when starting Jvm, Jvm can re-create a classloader (being called EasyStartClassLoader) automatically according to the skeleton code after change, directly obtain the .class file of up-to-date compiling generation in designated storage location, wherein
Jvmti interface: as shown in Figure 1, when original framework (also can be called application framework) runs, Jboss generally goes to obtain the application code comprised in local software product by the classLoader in running environment, and in the embodiment of the present application, by redefining Jvmti interface, change the behavior of original framework, when making each invocation target .class file of Jboss, the target .class file of up-to-date compiling generation is obtained to designated storage location, so-called designated storage location can be the build targets folder in developer's code editor of specifying.
In practical application, also target .class file can not be obtained from code editor, such as, call Jvm instruction direct compilation by order line and generate a target .class file, or, copy from other assigned address new target .class etc. that a compiling generates, its object is to acquisition target .class file and heat is deployed in the java application of running status, the not source of limited target .class file.In following examples, obtain target .class file for the prescribed storage means in code editor and be described.
EasyStartClassLoader: re-create classloader when obtaining target .class file, in the present embodiment, when creating EasyStartClassLoader, the mechanism that the parents having put upside down the routine of classLoader appoint (is first loaded by father classLoader, loaded by sub-classLoader again), adopt and first loaded by EasyStartClassLoader, the mode loaded by the father classLoader of EasyStartClassLoader again, this father classLoader is set as environment classLoader simultaneously, and can only loaded targets .class file by limiting EasyStartClassLoader, ensure that other .class files relevant to target .class file or .class library are loaded by environment classLoader.Wherein, namely so-called environment classLoader is the founder of current environment, and namely so-called environment refers to current running status, i.e. the state of one group of code operation, namely the classLoader loading this group code is current environment classLoader.
In loading procedure, the general mode by the interface in Java or Java reflex mechanism, make the target .class file that external environment condition can normally use easyStartClassLoader to load, thus realize at run mode, the target .class file of the up-to-date loading of Automatically invoked runs, and obtains instant result.
Be eclipse for code editor, after developer revises partial code, eclipse can be compiled into new .class file the code file of amendment part, i.e. target .class file; Owing to being compiling Single document, therefore speed is exceedingly fast, and can ignore compilation time; Then, by using by the framework (framework namely redefined) of the jvmti interface process of JVM, regularly carry out file scan, when determining that the target .class file generated is recompilated in the interior existence of file of specifying in eclipse, just in the file that this is specified, newly-generated target .class file is obtained, this process speed is also very fast, can ignore the time.
Below in conjunction with accompanying drawing, the application is preferred embodiment described in detail.
Consult shown in Fig. 2, in the embodiment of the present application, comprise scanning element 10, acquiring unit 11 and processing unit 12 for the device (e.g., WEB server) upgraded java application, wherein
Scanning element 10, for scanning in designated storage location, determines the target class file generating recompility, i.e. target .class file;
In the embodiment of the present invention, owing to obtaining target .class file in code editor, therefore, need to adopt scanning element 10 regularly to carry out file scan, to determine there is target .class file, in practical application, if generate target .class file according to Jvm order direct compilation, or according to instruction from other positions copy targeting .class file, then also can not adopt scanning element 10, not repeat them here;
Acquiring unit 11, for obtaining at least one target class file, i.e. target .class file;
In the present embodiment, acquiring unit 11 obtains target .class file in designated storage location, and its reason is the Jvmti interface that framework that Jvm adopts uses redesign, and framework behavior there occurs change.
Processing unit 12, for the corresponding class loading procedure of at least one target class file set up for acquisition, i.e. easyStartClassLoader, and adopt such loading procedure by least one target class files loading of acquisition in the java application of running status; Wherein, class loading procedure inherits current environment loading procedure, and namely easyStartClassLoader inherits current environment classloder.
In this example, scanning element 10 acquiring unit 11 and processing unit 12 are Jvmti interfaces of the redesign by Jvm, when not changing former skeleton code, embed original frame logic, and the operation that comes into force.
Need in above-mentioned WEB server to support Jvm, preferably, above-mentioned WEB server is Jboss, or is tomcat.
Based on said system framework, consult shown in Fig. 3, in the embodiment of the present application, to compile target .class file in eclipse, introduce the detailed process that the java application of WEB server to running status upgrade as follows:
Step 300: determine the target class file that there is at least one compiling generation in code editor (e.g., eclipse), i.e. target .class file.
Step 310: the designated storage location in code editor obtains at least one target class file above-mentioned.
In the embodiment of the present application, when performing step 310, the Jvm of WEB server support changes the behavior of the original framework run in Jvm by the Jvmti interface of new definition, order change after framework can the designated storage location of eclipse (as, under target .class file is compiled into file target/classes/ catalogue by eclipse acquiescence), obtain the target .class file that developer newly compiles, the number of target .class file can be one, also can be multiple.
Under prior art, Jvm is after configuration uses jvmti interface, and Jvm, when loading each .class file, all can pass through Jvmti interface interchange, and can be modified by the bytecode of Jvmti interface to .class file, the code of existing Jvmti interface is as follows:
byte[]
transform(ClassLoader loader,
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer)
throws IllegalClassFormatException;
Obtain from the code of framework by Jvmti interface interchange .class file under prior art, in above-mentioned code, loader is the classloader loading invoked .class file, className is the title of invoked .class file, classBeingRedfined is the type of invoked .class file, protectionDomain is the action scope of invoked .class file, and classfileBuffer is the bytecode that Jvm reads.Under normal circumstances, the bytecode that can read according to classfileBuffer is analyzed, then the content of bytecode is changed, and returning to Jvm, Jvm will run the bytecode after changing, thus reaches the object changing framework behavior, and in fact original code used does not change, so not changing original code used, namely when without when invading, change original method of operation of framework.But analyze and change bytecode, need developer to understand very much the mechanism that Java compiles class file, the mechanism of .class file is understood very much, therefore, change even if reach in the manner described above the object that Jvm calls original mode of .class file, also need suitable workload.
In the embodiment of the present application, in order to reduce the workload realizing above-mentioned purpose, by need change .class file import code editor (as, eclipse) in, according to the method for operation of the self-defined change class of actual demand, after preservation, code editor automatic compiling generates target .class file, correspondingly, Jvm is by jvmti interface, only need check the className in code editor, when determining to be the .class file needing to replace, just directly obtain the bytecode of the target .class file compiled, and do not spend and analyze and the bytecode revised in classfileBuffer, like this, just the workload needed for use-pattern adopting original Jvmti interface is greatly reduced.
In the embodiment of the present application, the run time version realizing Jvmti interface interchange is as follows:
String targetName=“targetClass”;
if(className.equals(targetName)){
return Transformer.getBytesFromFile(targetName);
}
return null;
Wherein, getBytesFromFile (method that targetName defines just returns the document flow of target .class,
Step 320: for the corresponding easyStartClassLoader of at least one .class file set up obtained, adopt this easyStartClassLoader by least one .class files loading of acquisition in the java application of running status, wherein, above-mentioned easyStartClassLoader inherits current environment classLoader.
In the embodiment of the present application, the function of above-mentioned easyStartClassLoader is the target .class file of specifying that in loading code editing machine, coding generates, preferably, at least one easyStartClassLoader can be set up for recompilating the target .class file generated, as, an easyStartClassLoader is set up respectively for each target .class file, also can for multiple target .class file set up easyStartClassLoader, and the target .class file of loading to be returned to the java application of the running status in Jvm, make java application that the new target .class file loaded can be adopted to operate.
In the embodiment of the present application, above-mentioned functions be realized, there is following difficult point:
First, after a classLoader is loaded with certain .class file, just can not reload this .class file again, a classLoader must be re-established and just can reload this .class file;
Secondly, the .class file that different classLoader loads can not use mutually, even if newly-built easyStartClassLoader, be loaded with target .class file, the classLoader that this .class file has been set up before also cannot allowing uses;
Again, the .class file that easyStartClassLoader loads relies on current environmental classes and class libraries in a large number, and these needs are loaded by environment classLoader, and can not be loaded by easyStartClassLoader.
For the problems referred to above, have employed in the embodiment of the present application and solve with under type:
All create new easyStartClassLoader, the new easyStartClassLoader created inherits current environment classLoader (namely as the father classLoader of easyStartLoader) at every turn; And the mechanism that the parents having put upside down ClassLoader appoint, namely first by easyStartClassLoader loaded targets .class file, then the environment classLoader process transferring to it to inherit; Simultaneously by limiting the way of add-in, ensureing safety, namely limiting the target .class file that easyStartClassLoader can only load designated storage location, the environment classLoader that other relevant .class file all transfers to it to inherit loads.Wherein, namely so-called environment classLoader is the founder of current environment, and namely so-called environment refers to current running status, i.e. the state of one group of code operation, namely the classLoader loading this group code is current environment classLoader.
Be specially:
Under prior art, the code of classLoader is exemplified below:
protected synchronized Class<?>loadClass(String name,boolean resolve)
throws ClassNotFoundException
{
//First,check if the class has already been loaded
Class c=findLoadedClass(name);
if (c==null){
try{
if(parent!=null){
c=parent.loadClass(name,false);
}else{
c=findBootstrapClass0(name);
}
}catch(ClassNotFoundException e){
//If still not found,then invoke findClass in order
//to find the class.
c=findClass(name);
}
}
if(resolve){
resolveClass(c);
}
return c;
}
As can be seen from above-mentioned code, there are two characteristics in classloader:
First characteristic is: once be loaded with a .class file (being called class A), just no longer goes to read its bytecode.
Therefore, in the present embodiment, after carrying out recompility generation class A ' for class A, must go to read and loading classes A ' by a newly-built easyStartClassLoader.
Second characteristic is: preferentially allow father classLoader load .class file, if father classLoader can load this .class file, just no longer loads this .class file by sub-classLoader.
Therefore, in the present embodiment, need to put upside down parents and appoint mechanism, for the class A ' that recompile generates, first loaded by newly-built easyStartClassLoader, then load other relevant .class files by his father classLoader (i.e. the environment classLoader of easyStartClassLoader succession).
Unlike the prior art, in the embodiment of the present application, easyStartLoader code is exemplified below:
public synchronized Class<?>loadClass(String name)throws
ClassNotFoundException{
Class<?>c=findLoadedClass(name);
if (c!=null){
return c;
}
try {
if(name.indexOf(targetClass)==-1){
throw new Exception(″easyStartClassLoader escaped:″+
name);
}
c=this.findClass(name);
System.out.println(″easyStartClassLoader loaded:″+name);
}catch(Exception e){
c=super.loadClass(name);
}
return c;
}
As can be seen from above-mentioned code, easyStartClassLoader only needs to inherit current environment classLoader, become the sub-classLoader of current environment classLoader, like this, other relevant .class files that target .class file (at least one the .class file after namely recompilating) relies on then all can be loaded by environment classLoader, and environment classLoader cannot loaded targets .class file, namely under the prerequisite limiting add-in (i.e. target .class file), put upside down the mechanism that parents appoint, sub-classLoader (i.e. easyStartLoader) is allowed first to load, loaded by environment classLoader again, but easyStartLoader loaded targets .class file, other relevant .class files are still loaded by environment classLoader.
Based on above-described embodiment, by target .class files loading in the process of the java application of running status, the general mode by the interface in java or Java reflex mechanism, makes external environment condition can call the new target .class file loaded.
Interface in so-called Java is the statement of serial of methods, it is the set of certain methods feature, interface in a Java only methodical feature does not have methodical realization, therefore these methods can be realized by different classes in different places, and these realizations can have different behaviors (i.e. function).Interface in Java is in fact loaded by environment classLoader, but easyStartClassLoader is because inherit environment classLoader so also can have access to, one that loads due to easyStartClassLoader or one group of target .class file are also interfaces in inheriting Java, so in external environment condition, one that is loaded or one group of target .class file, after being instantiated, are used by the interface changed into by force in java.
In the present embodiment, in external environment condition, the code of one or the one group .class file loaded by easyStartClassLoader is used to be exemplified below:
ClassLoader classloader=new
EasyStartClassLoader(new URL[]{url},moduleClassName);
moduleClass=
classloader.loadClass(moduleClassName);
module=(Module)moduleClass.newInstance();
Can be found out by above-mentioned code, in the present embodiment, one that is loaded by easyStartLoader or one group of target .class file (module hereinafter referred to as being loaded) achieve the interface used in Java, simultaneously, also assures that the interface in Java is loaded by the environment classLoader of the father classLoader as easyStartClassLoader, but not easyStartClassLoader loads, this is the module loaded to allow environment classLoader can use easyStartClassLoader, because generally, the module that different classLaoder loads can not be general.Like this, easyStartClassLoader inherits above-mentioned environment classLoader, interface in the Java that the module accesses that self loads just can be made to load to environment classLoader, thus the module making external environment condition can be called easyStartClassLoader by the interface in above-mentioned Java loading.Wherein, so-called external environment condition, namely refers to the environment loaded relative to easyStartClassLoader, and the environment calling the environment that easyStartClassLoader loads is referred to as external environment condition.
On the other hand, so-called Java reflex mechanism (being called Reflection), namely be when java application runs, allow the .class file loading, find out, use compile duration completely unknown, in other words, just learn the .class file of title when java application can load an operation, learn its complete construction, and generate its object entity.Such as, Java reflex mechanism is Class.getMethod () .invoke (), adopts Java reflex mechanism, for any one .class file, can both know its all properties and method; For any one object, its any one method can both be called; Therefore, adopt Java reflex mechanism, can, after java application loaded targets .class file, make external environment condition also can call this target .class file.
Finally, Jvm performs java application according to the .class file reloaded, and just can use the function that the new .class file loaded has.
In the embodiment of the present application, develop new hot deployment tool, by the easyStartClassLoader of newly-built succession current environment classloader, at designated storage location loaded targets class file, and be loaded in the java application of running status, thus completed the renewal of java application, like this, only need load the target class file of recompility, the heat just achieving java application is disposed, and improves the renewal efficiency of java application; And the theory structure of easyStartClassLoader is simple, has very high stability, also can not increase memory consumption and extra system consumption, unlimited quick realization heat free of charge can disposes, there is very high practicality; Further, the core code of new hot deployment tool according to Java application framework and application state, can make expansion with few exploitation amount, can accomplish that the heat of full code full operation is disposed, be with a wide range of applications.
Obviously, those skilled in the art can carry out various change and modification to the application and not depart from the spirit and scope of the present invention.Like this, if these amendments of the application and modification belong within the scope of the application's claim and equivalent technologies thereof, then the application is also intended to comprise these change and modification.
Claims (10)
1. a update method for java application, is characterized in that, comprising:
By the title of the target class file generated of encoding in Java Virtual Machine Jvmti interface checking code editor, when determining that the title of described target class file is consistent with needing the title of the class file replaced, obtain the target class file that at least one compiling generates;
For the corresponding class loading procedure of at least one target class file set up obtained, adopt described class loading procedure only by least one target class files loading described in the java application of running status, wherein, described class loading procedure inherits current environment loading procedure;
Adopt other relevant class files that described environment loading procedure loading at least one target class file described relies on.
2. the method for claim 1, is characterized in that, for the corresponding class loading procedure of at least one target class file set up obtained, comprising:
If the number of target class file obtained is one, then to should the corresponding class loading procedure of target class file set up;
If the number of the target class file obtained is more than one, then corresponding at least one class loading procedure of each target class file set up.
3. method as claimed in claim 1 or 2, is characterized in that, adopt described class loading procedure only by least one target class files loading described in the java application of running status, comprising:
Described class loading procedure is first adopted to load at least one target class file described;
Described environment loading procedure pair is adopted to load to other relevant class files that at least one target class file described relies on again.
4. method as claimed in claim 3, is characterized in that, adopt described class loading procedure only by least one target class files loading described in the java application of running status, further, comprising:
Adopt described class loading procedure to inherit described environment loading procedure, and load the interface in whole Java by described environment loading procedure, make external environment condition can by least one target class file described in the interface interchange in described Java.
5. method as claimed in claim 3, is characterized in that, adopt described class loading procedure only by least one target class files loading described in the java application of running status, further, comprising:
Adopt Java reflex mechanism, make external environment condition can call at least one target class file described.
6. a updating device for java application, is characterized in that, comprising:
Acquiring unit, for the title by the target class file generated of encoding in Java Virtual Machine Jvmti interface checking code editor, when determining that the title of described target class file is consistent with needing the title of the class file replaced, obtain the target class file that at least one compiling generates;
Processing unit, for the corresponding class loading procedure of at least one target class file set up for acquisition, adopt described class loading procedure only by least one target class files loading described in the java application of running status, wherein, described class loading procedure inherits current environment loading procedure, and adopts other relevant class files that described environment loading procedure loading at least one target class file described relies on.
7. device as claimed in claim 6, is characterized in that, during class loading procedure corresponding at least one the target class file set up obtained, described processing unit specifically for:
If the number of target class file obtained is one, then to should the corresponding class loading procedure of target class file set up;
If the number of the target class file obtained is more than one, then corresponding at least one class loading procedure of each target class file set up.
8. device as claimed in claims 6 or 7, is characterized in that, described processing unit adopt described class loading procedure only by least one target class files loading described in the java application of running status, comprising:
Described class loading procedure is first adopted to load at least one target class file described;
Described environment loading procedure pair is adopted to load to other relevant class files that at least one target class file described relies on again.
9. device as claimed in claim 7, is characterized in that, adopt described class loading procedure only by described at least one target class files loading to the java application of running status time, described processing unit is further used for:
Adopt described class loading procedure to inherit described environment loading procedure, and load the interface in whole Java by described environment loading procedure, make external environment condition can by least one target class file described in the interface interchange in described Java.
10. device as claimed in claim 6, is characterized in that, adopt described class loading procedure only by described at least one target class files loading to the java application of running status time, described processing unit is further used for:
Adopt Java reflex mechanism, make external environment condition can call at least one target class file described.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010279955.7A CN102402427B (en) | 2010-09-09 | 2010-09-09 | A kind of update method of java application and device |
HK12107008.1A HK1166396B (en) | 2012-07-18 | Method and apparatus for updating a java application |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010279955.7A CN102402427B (en) | 2010-09-09 | 2010-09-09 | A kind of update method of java application and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102402427A CN102402427A (en) | 2012-04-04 |
CN102402427B true CN102402427B (en) | 2015-09-02 |
Family
ID=45884662
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010279955.7A Active CN102402427B (en) | 2010-09-09 | 2010-09-09 | A kind of update method of java application and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102402427B (en) |
Families Citing this family (26)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103823658A (en) * | 2012-11-19 | 2014-05-28 | 苏州博远容天信息科技有限公司 | Bridge architecture based coordinative dynamic reflection technology |
CN103812946B (en) * | 2014-02-27 | 2017-12-26 | 广州梦能动漫科技有限公司 | Method and system for online cloud updating of AR application program |
WO2016000126A1 (en) * | 2014-06-30 | 2016-01-07 | 北京新媒传信科技有限公司 | Automatic deployment method and terminal |
CN105589701B (en) * | 2014-10-21 | 2019-03-08 | 阿里巴巴集团控股有限公司 | A kind of client application local updating method and device |
TWI584654B (en) * | 2015-03-27 | 2017-05-21 | 林勝雄 | Method and system for optimization service |
CN105068837A (en) * | 2015-08-07 | 2015-11-18 | Tcl集团股份有限公司 | Web application updating method and apparatus |
CN105242948B (en) * | 2015-10-27 | 2018-06-19 | 江苏电力信息技术有限公司 | Heat deployment implementation method based on Java web projects |
CN106990975B (en) * | 2016-01-21 | 2021-07-23 | 斑马智行网络(香港)有限公司 | An application hot deployment method, device and system |
CN107346252B (en) * | 2016-05-07 | 2021-05-25 | 腾讯科技(深圳)有限公司 | Application updating method and device |
CN107463391B (en) * | 2016-06-03 | 2020-11-10 | 阿里巴巴集团控股有限公司 | Task processing method, device and equipment |
CN107508846B (en) * | 2016-06-14 | 2021-02-26 | 北京京东尚科信息技术有限公司 | Updating method and system of application client and terminal equipment |
CN106325970A (en) * | 2016-10-17 | 2017-01-11 | 宁德时代新能源科技股份有限公司 | Compiling method and compiling system |
CN107943543B (en) * | 2017-11-29 | 2022-01-14 | 优速云(福建)科技有限公司 | WEB application hot deployment method and computer equipment |
CN108491216B (en) * | 2018-03-05 | 2021-07-13 | 北京指掌易科技有限公司 | Method for installing and upgrading non-sensory application of Android system |
CN110716720A (en) * | 2018-07-12 | 2020-01-21 | 北京京东尚科信息技术有限公司 | A method and apparatus for implementing application hot deployment |
CN111435312B (en) * | 2019-01-15 | 2023-09-29 | 北京嘀嘀无限科技发展有限公司 | Application program management method and device and electronic equipment |
CN114153521B (en) | 2019-03-25 | 2024-10-29 | 华为技术有限公司 | Class loading method and device |
CN111866047B (en) * | 2019-04-30 | 2023-07-07 | 北京达佳互联信息技术有限公司 | Data decoding method, device, computer equipment and storage medium |
CN110262818A (en) * | 2019-05-29 | 2019-09-20 | 北京达佳互联信息技术有限公司 | The hot update method of Java code, device, electronic equipment and storage medium |
CN111625256B (en) * | 2020-05-15 | 2024-02-09 | 广东浪潮大数据研究有限公司 | Application program upgrading method, system, equipment and computer storage medium |
CN112363707B (en) * | 2020-11-25 | 2022-09-09 | 国电南瑞科技股份有限公司 | Control layer general scheduling method based on JAVA reflection technology |
CN112379973B (en) * | 2020-12-01 | 2023-10-24 | 腾讯科技(深圳)有限公司 | Heavy load method and device |
CN113138787A (en) * | 2021-04-28 | 2021-07-20 | 中消云(北京)物联网科技研究院有限公司 | Program updating method and device |
CN114675834A (en) * | 2022-03-25 | 2022-06-28 | 苏州浪潮智能科技有限公司 | Service implementation method, system, electronic device and storage medium |
CN115129348A (en) * | 2022-07-04 | 2022-09-30 | 腾讯科技(深圳)有限公司 | Resource updating method, device and equipment of application program and readable storage medium |
CN115576589A (en) * | 2022-12-08 | 2023-01-06 | 平安银行股份有限公司 | Program hot updating method, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1195677A1 (en) * | 2000-10-06 | 2002-04-10 | Abb Research Ltd. | Dynamic class loading |
CN101236503A (en) * | 2008-02-27 | 2008-08-06 | 鞠京佳 | Hot-deployment entity component |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2341461B (en) * | 1998-09-10 | 2003-03-12 | Ibm | Program component distribution |
-
2010
- 2010-09-09 CN CN201010279955.7A patent/CN102402427B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1195677A1 (en) * | 2000-10-06 | 2002-04-10 | Abb Research Ltd. | Dynamic class loading |
CN101236503A (en) * | 2008-02-27 | 2008-08-06 | 鞠京佳 | Hot-deployment entity component |
Non-Patent Citations (1)
Title |
---|
任哲.Java的反射机制.《JAVA技术应用基础——对象•模式•虚拟机》.2009,(第1版),第90-93页. * |
Also Published As
Publication number | Publication date |
---|---|
CN102402427A (en) | 2012-04-04 |
HK1166396A1 (en) | 2012-10-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102402427B (en) | A kind of update method of java application and device | |
US12159146B2 (en) | Dynamically loaded plugin architecture | |
CN108027722B (en) | Dynamically updating applications in compilation and deployment | |
US10795660B1 (en) | Live code updates | |
US11385993B2 (en) | Dynamic integration of command line utilities | |
US10489274B2 (en) | Using emulation to disassociate verification from stimulus in functional test | |
US20160232017A1 (en) | System and Method for Reloading Constructors | |
CN101771762A (en) | Method and system for dynamically loading services in service system | |
WO2015117434A1 (en) | Method and device for manufacturing patch, and method and device for activating patch | |
CN113312046B (en) | Sub-application page processing method, device and computer equipment | |
WO2019005228A1 (en) | Automated source code adaption to inject features between platform versions | |
US9459986B2 (en) | Automatic generation of analysis-equivalent application constructs | |
US10083029B2 (en) | Detect application defects by correlating contracts in application dependencies | |
US10275236B2 (en) | Generating related templated files | |
GB2616340A (en) | Methods, systems, and computer readable media for customizing data plane pipeline processing using Berkeley packet filter (BPF) hook entry points | |
CN113454606A (en) | Software checkpoint-recovery between different compiled executables | |
Mukherjee et al. | Weaves: A framework for reconfigurable programming | |
Aranega et al. | Tool demo: fine-grained run-time reflection in Python with Reflectivipy | |
Starkman | The robot operating system in transition: experiments and tutorials | |
HK1166396B (en) | Method and apparatus for updating a java application | |
CN118210845A (en) | Spark computing engine-based environment isolation method, device and equipment | |
van Breugel | Java PathFinder: a tool to detect bugs in Java code | |
Petasis | TileQt and TileGtk: current status |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 1166396 Country of ref document: HK |
|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: GR Ref document number: 1166396 Country of ref document: HK |