CN104111843A - Sandbox based script updating method and system - Google Patents
Sandbox based script updating method and system Download PDFInfo
- Publication number
- CN104111843A CN104111843A CN201310135064.8A CN201310135064A CN104111843A CN 104111843 A CN104111843 A CN 104111843A CN 201310135064 A CN201310135064 A CN 201310135064A CN 104111843 A CN104111843 A CN 104111843A
- Authority
- CN
- China
- Prior art keywords
- script
- virtual machine
- module
- sandbox
- unit
- 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
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses a sandbox based script updating method and system. The sandbox based script updating method includes steps of storing data structures generated during script loading into a sandbox; storing running data by citing the data structures in the sandbox during running of scripts; judging whether the scripts need to be updated or not to obtain judgment results; when the judgment results indicate that the scripts need to be updated, unloading the scripts in a virtual machine; rewriting the updated scripts into the virtual machine; citing the running data from the sandbox as local variables for returning to serve. By the sandbox based script updating method and system, program running is not interrupted while the programs can be updated, updating cost of the programs is reduced, and user experience is improved.
Description
Technical field
The present invention relates to program development field, particularly relate to a kind of script update method and system based on sandbox.
Background technology
Along with the development of informationization technology, increasing user realizes the operation of business by computer program.When user's demand changes, for the function of program, also need to adjust accordingly.This adjustment for program function can be called the renewal to program.
In prior art, the method that program is upgraded is mainly first to recompilate whole program, after long compiling, tests again, guarantees to test the program that issue is upgraded again after errorless, in whole process, to user's service, need to stagnate.
But common many clients' business all requires run without interruption for 24 hours, when program is upgraded, once stop user that service is provided, can bring time and loss economically to user.
Summary of the invention
The object of this invention is to provide a kind of script update method and system based on sandbox, can reduce program updates cost not realizing the renewal to program in interrupt routine operation, and then improve user and experience.
For achieving the above object, the invention provides following scheme:
A script update method based on sandbox, comprising:
The data structure generating during by loading scripts is kept in sandbox;
In the process of the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Judge whether described script needs to upgrade, and obtains judged result;
When described judged result represents that described script need to upgrade, the described script in unloading virtual machine;
Script after upgrading is write to described virtual machine again;
Described service data being cited as to local variable from described sandbox recovers to use.
Optionally, describedly judge whether described script needs to upgrade, and comprising:
Judge whether described script occurs logic fault;
And/or, judge whether described script has new version.
Optionally, the described script in described unloading virtual machine, also comprises:
By script manager, the module name of the first module in the described script of described virtual machine is put to sky, the module of described the first module for needing to upgrade;
Accordingly, described script after upgrading is write to described virtual machine again, also comprises:
In the described script of described virtual machine, again write the module name of described the first module.
Optionally, also comprise:
Before the described script of operation, by script described in script manager dynamic load;
By described virtual machine, link and explain described script;
The first module to the described script in described virtual machine is named.
Optionally, described script is java script, and described virtual machine is java virtual machine.
Script based on sandbox upgrades a system, comprising:
Data structure storage unit, the data structure generating when by loading scripts is kept at sandbox;
Service data storage unit, for the process at the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Judging unit, for judging whether described script needs to upgrade, and obtains judged result;
Script unloading unit, for when described judged result represents that described script need to upgrade, the described script in unloading virtual machine;
Script writing unit, for again writing described virtual machine by the script after upgrading;
Service data precedents, recovers to use for described service data being cited as to local variable from described sandbox.
Optionally, described judging unit, comprising:
The first judgment sub-unit, for judging whether described script occurs logic fault;
And/or the second judgment sub-unit, for judging whether described script has new version.
Optionally, described script unloading unit, comprising:
Module name is put gap unit, for by script manager, the module name of the first module of the described script of described virtual machine being put to sky, and the module of described the first module for needing to upgrade;
Accordingly, described script writing unit, comprising:
Module name writes subelement, for again write the module name of described the first module at the described script of described virtual machine.
Optionally, also comprise:
Script loading unit, for before the described script of operation, by script described in script manager dynamic load;
Script url and Interpretation unit, for linking and explain described script by described virtual machine;
Name unit, names for the first module to the described script of described virtual machine.
Optionally, described script is java script, and described virtual machine is java virtual machine.
According to specific embodiment provided by the invention, the invention discloses following technique effect:
Script update method and system based on sandbox of the present invention, by the service data generating in the process of the described script of operation is left in sandbox, when having script to upgrade, described script in unloading virtual machine, script after upgrading is write to described virtual machine again, more described service data is cited as to local variable recovery use from described sandbox, can in interrupt routine operation, not realize the renewal to program, reduce program updates cost, and then improve user and experience.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, to the accompanying drawing of required use in embodiment be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skills, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the process flow diagram of the script update method embodiment 1 based on sandbox of the present invention;
Fig. 2 is the process flow diagram of the script update method embodiment 2 based on sandbox of the present invention;
Fig. 3 is the process flow diagram of the script update method embodiment 3 based on sandbox of the present invention;
Fig. 4 is the structural drawing that the script based on sandbox of the present invention upgrades system embodiment.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
Inventor finds through research, for example, in most of programs (java program), embeds and has script manager and virtual machine.The process of program operation is also the process of carrying out script.In a script, can have a plurality of modules, different modules can realize different functions.For the renewal of program, most applications is the renewal for a certain module in script.Therefore, in the solution of the present invention, by the module for procedure script, upgrade, and then realize the renewal for program.
Fig. 1 is the process flow diagram of the script update method embodiment 1 based on sandbox of the present invention.As shown in Figure 1, described method can comprise:
Step 101: the data structure generating during by loading scripts is kept in sandbox;
The data structure needing when data structure can be loading scripts, realizes the data that need in the corresponding specific operation flow of this script, then initialization being kept in sandbox.
Sandbox (SandBox) refers to a kind of according to the execution environment of security strategy limiting program behavior in network technology.
SUN company, in design Java, has designed the security model of a set of precision: security manager (Security Manager) is by the inspection all system resources used of having the right.The in the situation that of acquiescence, only allow those harmless operations, want to allow to carry out other operations, code need obtain digital signature, and user must obtain digital authenticating.This restricted execution environment is called sandbox.
Step 102: in the process of the described script of operation, the data structure of quoting in described sandbox is deposited service data;
The attribute having due to sandbox itself can form the running environment of an isolation, so the service data leaving in sandbox is equivalent to leave in independent storage space.
Step 103: judge whether described script needs to upgrade, and obtains judged result;
Script needs more news to mainly contain two kinds.A kind of situation is, in carrying out the process of script, logic fault to have occurred; Another kind of situation is that program development personnel change for script, write out the script with new version.
Judge whether script needs to upgrade, and specifically can whether be absorbed in endless loop according to program and judge whether occurrence logic fault, according to whether receiving, represent that the instruction that script has a redaction judges whether this script has new version.
Step 104: when described judged result represents that described script need to upgrade, the described script in unloading virtual machine;
Virtual machine (Virtual Machine) refer to by software simulation have complete hardware system function, operate in a complete computer in complete isolation environment.
In the embodiment of the present invention, script can be carried out in the environment of virtual machine.
Step 105: the script after upgrading is write to described virtual machine again;
Step 106: described service data is cited as to local variable from described sandbox and recovers to use.
Owing to storing service data in sandbox, when described script in virtual machine is unloaded, carry out the service data that described script generates not deleted, be also kept in sandbox, so can described service data be cited as to local variable from described sandbox, recover to use.And, can also prevent that valid data from being reinitialized.
In the present embodiment, by the service data generating in the process of the described script of operation is left in sandbox, when having script to upgrade, described script in unloading virtual machine, script after upgrading is write to described virtual machine again, more described service data is cited as to local variable recovery use from described sandbox, can in interrupt routine operation, not realize the renewal to program, reduce program updates cost, and then improve user and experience.
Fig. 2 is the process flow diagram of the script update method embodiment 2 based on sandbox of the present invention.As shown in Figure 2, described method can comprise:
Step 201: the data structure generating during by loading scripts is kept in sandbox;
Step 202: in the process of the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Step 203: judge whether described script needs to upgrade, and obtains judged result;
Step 204: when described judged result represents that described script need to upgrade, by script manager, the module name of the first module in the described script of described virtual machine is put to sky, the module of described the first module for needing to upgrade;
Due to when the refresh routine, virtual machine can stop and reloads the module that module name is identical, so need the first loaded module to delete before being again written into, this module is invalid at present with this, to indicate virtual machine, and virtual machine just can again link and explain amended module (being equivalent to the part in whole script) like this.
Step 205: the script after upgrading is write to described virtual machine again;
It should be noted that, the script after upgrading is write again to the process of described virtual machine, can comprise first original script is deleted, then the process that the script of redaction is write; Also can only include the process that the script of redaction is write.This depends in step 204 whether carried out the operation of deleting original script.
Step 206: the module name that again writes described the first module in the described script of described virtual machine.
Step 207: described service data is cited as to local variable from described sandbox and recovers to use.
Fig. 3 is the process flow diagram of the script update method embodiment 3 based on sandbox of the present invention.As shown in Figure 3, described method can comprise:
Step 301: before the described script of operation, by script described in script manager dynamic load;
Step 302: link and explain described script by described virtual machine;
Step 303: the first module to the described script in described virtual machine is named.
Step 304: the data structure generating during by loading scripts is kept in sandbox;
Step 305: in the process of the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Step 306: judge whether described script needs to upgrade, and obtains judged result;
Step 307: when described judged result represents that described script need to upgrade, by script manager, the module name of the first module in the described script of described virtual machine is put to sky, the module of described the first module for needing to upgrade;
Due to when the refresh routine, virtual machine can stop and reloads the module that module name is identical, so need the first loaded module to delete before being again written into, this module is invalid at present with this, to indicate virtual machine, and virtual machine just can again link and explain amended module (being equivalent to the part in whole script) like this.
Step 308: the script after upgrading is write to described virtual machine again;
It should be noted that, the script after upgrading is write again to the process of described virtual machine, can comprise first original script is deleted, then the process that the script of redaction is write; Also can only include the process that the script of redaction is write.This depends in step 204 whether carried out the operation of deleting original script.
Step 309: the module name that again writes described the first module in the described script of described virtual machine.
Step 310: described service data is cited as to local variable from described sandbox and recovers to use.
It should be noted that, in the embodiment of the present invention, described script can be java script, and described virtual machine can be java virtual machine.
The present invention also provides a kind of script based on sandbox to upgrade system.
Fig. 4 is the structural drawing that the script based on sandbox of the present invention upgrades system embodiment.As shown in Figure 4, described system can comprise:
Data structure storage unit 401, the data structure generating when by loading scripts is kept at sandbox;
Service data storage unit 402, for the process at the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Judging unit 403, for judging whether described script needs to upgrade, and obtains judged result;
Script unloading unit 404, for when described judged result represents that described script need to upgrade, the described script in unloading virtual machine;
Script writing unit 405, for again writing described virtual machine by the script after upgrading;
Service data precedents 406, recovers to use for described service data being cited as to local variable from described sandbox.
In the present embodiment, by the service data generating in the process of the described script of operation is left in sandbox, when having script to upgrade, described script in unloading virtual machine, script after upgrading is write to described virtual machine again, more described service data is cited as to local variable recovery use from described sandbox, can in interrupt routine operation, not realize the renewal to program, reduce program updates cost, and then improve user and experience.
Script based on sandbox of the present invention upgrades in the embodiment of system, and described judging unit 403, can comprise:
The first judgment sub-unit, for judging whether described script occurs logic fault;
And/or the second judgment sub-unit, for judging whether described script has new version.
Described script unloading unit 404, can comprise:
Module name is put gap unit, for by script manager, the module name of the first module of the described script of described virtual machine being put to sky, and the module of described the first module for needing to upgrade;
Accordingly, described script writing unit 405, can comprise:
Module name writes subelement, for again write the module name of described the first module at the described script of described virtual machine.
It should be noted that, described system can also comprise:
Script loading unit, for before the described script of operation, by script described in script manager dynamic load;
Script url and Interpretation unit, for linking and explain described script by described virtual machine;
Name unit, names for the first module to the described script of described virtual machine.
In said system, described script can be java script, and described virtual machine can be java virtual machine.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and each embodiment stresses is the difference with other embodiment, between each embodiment identical similar part mutually referring to.For the disclosed system of embodiment, because it corresponds to the method disclosed in Example, so description is fairly simple, relevant part partly illustrates referring to method.
Applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications.In sum, this description should not be construed as limitation of the present invention.
Claims (10)
1. the script update method based on sandbox, is characterized in that, comprising:
The data structure generating during by loading scripts is kept in sandbox;
In the process of the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Judge whether described script needs to upgrade, and obtains judged result;
When described judged result represents that described script need to upgrade, the described script in unloading virtual machine;
Script after upgrading is write to described virtual machine again;
Described service data being cited as to local variable from described sandbox recovers to use.
2. method according to claim 1, is characterized in that, describedly judges whether described script needs to upgrade, and comprising:
Judge whether described script occurs logic fault;
And/or, judge whether described script has new version.
3. method according to claim 1, is characterized in that, the described script in described unloading virtual machine, also comprises:
By script manager, the module name of the first module in the described script of described virtual machine is put to sky, the module of described the first module for needing to upgrade;
Accordingly, described script after upgrading is write to described virtual machine again, also comprises:
In the described script of described virtual machine, again write the module name of described the first module.
4. according to the method described in claim 1-3 any one, it is characterized in that, also comprise:
Before the described script of operation, by script described in script manager dynamic load;
By described virtual machine, link and explain described script;
The first module to the described script in described virtual machine is named.
5. according to the method described in claim 1-3 any one, it is characterized in that, described script is java script, and described virtual machine is java virtual machine.
6. the script based on sandbox upgrades a system, it is characterized in that, comprising:
Data structure storage unit, the data structure generating when by loading scripts is kept at sandbox;
Service data storage unit, for the process at the described script of operation, the data structure of quoting in described sandbox is deposited service data;
Judging unit, for judging whether described script needs to upgrade, and obtains judged result;
Script unloading unit, for when described judged result represents that described script need to upgrade, the described script in unloading virtual machine;
Script writing unit, for again writing described virtual machine by the script after upgrading;
Service data precedents, recovers to use for described service data being cited as to local variable from described sandbox.
7. system according to claim 6, is characterized in that, described judging unit, comprising:
The first judgment sub-unit, for judging whether described script occurs logic fault;
And/or the second judgment sub-unit, for judging whether described script has new version.
8. system according to claim 6, is characterized in that, described script unloading unit, comprising:
Module name is put gap unit, for by script manager, the module name of the first module of the described script of described virtual machine being put to sky, and the module of described the first module for needing to upgrade;
Accordingly, described script writing unit, comprising:
Module name writes subelement, for again write the module name of described the first module at the described script of described virtual machine.
9. according to the system described in claim 6-8 any one, it is characterized in that, also comprise:
Script loading unit, for before the described script of operation, by script described in script manager dynamic load;
Script url and Interpretation unit, for linking and explain described script by described virtual machine;
Name unit, names for the first module to the described script of described virtual machine.
10. according to the system described in right 6-8 any one, it is characterized in that, described script is java script, and described virtual machine is java virtual machine.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310135064.8A CN104111843A (en) | 2013-04-17 | 2013-04-17 | Sandbox based script updating method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310135064.8A CN104111843A (en) | 2013-04-17 | 2013-04-17 | Sandbox based script updating method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104111843A true CN104111843A (en) | 2014-10-22 |
Family
ID=51708643
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310135064.8A Pending CN104111843A (en) | 2013-04-17 | 2013-04-17 | Sandbox based script updating method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104111843A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107204052A (en) * | 2016-03-18 | 2017-09-26 | 福特全球技术公司 | Script on Telematics control units |
CN108108181A (en) * | 2017-12-14 | 2018-06-01 | 深圳市雷鸟信息科技有限公司 | The function renewal method, apparatus and computer readable storage medium of application program |
CN108595262A (en) * | 2018-03-29 | 2018-09-28 | 北京奇艺世纪科技有限公司 | Data processing method and device |
CN109558217A (en) * | 2018-12-19 | 2019-04-02 | 北京恒泰实达科技股份有限公司 | Data processing script program operation method and data processing container |
CN109710381A (en) * | 2018-12-27 | 2019-05-03 | 北京联创信安科技股份有限公司 | High-performance calculation, big data, virtualization special container management system and method |
CN111522575A (en) * | 2020-04-15 | 2020-08-11 | 维沃移动通信有限公司 | Application program upgrading method and electronic equipment |
-
2013
- 2013-04-17 CN CN201310135064.8A patent/CN104111843A/en active Pending
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107204052A (en) * | 2016-03-18 | 2017-09-26 | 福特全球技术公司 | Script on Telematics control units |
CN108108181A (en) * | 2017-12-14 | 2018-06-01 | 深圳市雷鸟信息科技有限公司 | The function renewal method, apparatus and computer readable storage medium of application program |
CN108108181B (en) * | 2017-12-14 | 2022-03-01 | 深圳市雷鸟网络传媒有限公司 | Function updating method and device of application program and computer readable storage medium |
CN108595262A (en) * | 2018-03-29 | 2018-09-28 | 北京奇艺世纪科技有限公司 | Data processing method and device |
CN108595262B (en) * | 2018-03-29 | 2021-06-22 | 北京奇艺世纪科技有限公司 | Data processing method and device |
CN109558217A (en) * | 2018-12-19 | 2019-04-02 | 北京恒泰实达科技股份有限公司 | Data processing script program operation method and data processing container |
CN109710381A (en) * | 2018-12-27 | 2019-05-03 | 北京联创信安科技股份有限公司 | High-performance calculation, big data, virtualization special container management system and method |
CN111522575A (en) * | 2020-04-15 | 2020-08-11 | 维沃移动通信有限公司 | Application program upgrading method and electronic equipment |
CN111522575B (en) * | 2020-04-15 | 2023-11-24 | 维沃移动通信有限公司 | Application program upgrading method and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9075688B2 (en) | Enhanced upgrade path | |
CN102147747B (en) | The system and method for the upgrading path strengthened | |
CN102622298B (en) | Software testing system and method | |
CN102609328B (en) | System difference upgrade method and device and mobile terminal | |
CN104111843A (en) | Sandbox based script updating method and system | |
CN103019941B (en) | program debugging method and device | |
CN106648724B (en) | Application program hot repair method and terminal | |
CN101645020A (en) | Virtual operating system creation method | |
CN104834555A (en) | Method for invoking functional module, related device and device repairing method | |
CN114077423A (en) | Airport APP development container architecture based on mobile cross-platform | |
US20080307393A1 (en) | Synchronizing codes from multiple software configuration management systems | |
JP6198229B2 (en) | Installation engine and package format for parallelizable and reliable installation | |
CN106502713A (en) | A kind of method for upgrading software and system | |
CN105224422A (en) | A kind of data back up method and equipment | |
CN104360952A (en) | Software test system and software test method | |
CN111857765A (en) | Plug-in system for drug design system, and generation method and updating method thereof | |
CN103176838A (en) | Method and system compatible with Android native program | |
CN103514004A (en) | Method and device for managing system environment under Windows system | |
CN103559059A (en) | Quick medium-free upgrading method for Linux system | |
KR101599471B1 (en) | Apparatus, system, method and readable recording medium of managing a project file | |
CN104298618A (en) | Instruction processing method and device for intelligent terminal | |
CN105718262A (en) | Deployment method of LNMP architecture | |
CN106843952B (en) | Method and device for updating function module in application | |
US20130081007A1 (en) | Providing continuous application availability during application update | |
CN116360800B (en) | Deployment method and device of code branching environment and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20141022 |
|
WD01 | Invention patent application deemed withdrawn after publication |