CN105631330A - Customized virtual machine method for limiting socket quantity of JAVA programs - Google Patents
Customized virtual machine method for limiting socket quantity of JAVA programs Download PDFInfo
- Publication number
- CN105631330A CN105631330A CN201510982777.7A CN201510982777A CN105631330A CN 105631330 A CN105631330 A CN 105631330A CN 201510982777 A CN201510982777 A CN 201510982777A CN 105631330 A CN105631330 A CN 105631330A
- Authority
- CN
- China
- Prior art keywords
- socket
- java
- virtual machine
- amount threshold
- created
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/55—Detecting local intrusion or implementing counter-measures
- G06F21/56—Computer malware detection or handling, e.g. anti-virus arrangements
- G06F21/566—Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/03—Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
- G06F2221/034—Test or assess a computer or a system
Abstract
The invention relates to a customized virtual machine method for limiting the socket quantity of JAVA programs. The method comprises the following steps: setting a socket limiting quantity threshold value in a JAVA virtual machine source program; obtaining the socket limiting quantity threshold value in a JAVA basic library source program; obtaining a socket quantity during the creation of a JAVA program of a customized virtual machine; if the socket quantity is greater than or equal to the socket limiting quantity threshold value, prompting that the socket quantity reaches the upper limit; and if the socket quantity is less than the socket limiting quantity threshold value, ending and quitting. By adopting the customized virtual machine method for limiting the socket quantity of JAVA programs, on the embedded systems with limited resources, the developers that are low in level are prevented from forgetting releasing the socket resources after using the socket resource or the developers can be prevented from deliberately developing malicious programs to occupy the socket resources of the systems so as to cause the condition that the other programs cannot apply for the socket resources or the systems cannot be operated normally.
Description
Technical field
The present invention relates to operating system field, particularly relate to the administrative mechanism of application A PP, specifically refer to a kind of customizing virtual machine method limiting JAVA Programm ocket quantity.
Background technology
Smart mobile phone, Intelligent routing, gateway allows third party APP or developing plug all to issue the application of oneself, privacy of user data the person of being developed in the unwitting situation of user collect, and at present intelligence machine operating system IOS or android provides sandbox mechanism, authority management user can be allowed to know APP accesses the personal information of user such as contact people, photo, bluetooth equipment, location-based service, and determining power gives user absolutely access.
This patent is obtained through refining to a kind of new protection mechanism of user, if APP or third party's plug-in unit application system resource are too much, other program is had an impact so that it is application, less than system resource, seriously can cause system to run.
Require that plug-in unit is used socket to carry out limiting the demanding criteria of Ye Shi China Telecom by intelligent gateway product simultaneously.
Summary of the invention
It is an object of the invention to overcome the shortcoming of above-mentioned prior art, it provides a kind of can be realized by amendment JAVA virtual machine source routine and JAVA base library source routine JAVA program being applied for the customizing virtual machine method of restriction JAVA Programm ocket quantity that limits of socket resource quantity.
In order to realize above-mentioned purpose, the customizing virtual machine method of the restriction JAVA Programm ocket quantity of the present invention has following formation:
The customizing virtual machine method of this restriction JAVA Programm ocket quantity, its principal feature is, described method comprises:
(1) socket is set in JAVA virtual machine source routine and limits amount threshold;
(2) in JAVA base library source routine, obtain socket limit amount threshold;
(3) when customized virtual machine performs JAVA program, after JAVA program creation or release socket, upgrade the quantity of socket created, and customized virtual machine by the quantity of socket that created compared with described socket restriction amount threshold;
(4) if the quantity of the described socket created is more than or equal to described socket limits amount threshold, then socket quantity is pointed out to reach the upper limit;
(5) if the quantity of the described socket created is less than described socket limits amount threshold, then step (3) is continued.
Further, described step (1) specifically comprises the following steps:
(1.1) socket limits amount threshold to obtain to add the parameter code resolving appointment socket quantity in JAVA virtual machine source routine main;
(1.2) socket limits amount threshold to be stored in internal memory variable.
Further, described step (2) is specially:
Socket limits amount threshold to obtain to increase by a function in the JNIEnv structure that JAVA base library source routine and JAVA virtual machine source routine share.
Further, described step (3) specifically comprises the following steps:
(3.1) quantity of the socket created is upgraded according to Socket.java and ServerSocket.java;
(3.2) compared with the quantity of the socket created is limited amount threshold with described socket.
Have employed the customizing virtual machine method of the restriction JAVA Programm ocket quantity in this invention, compared with prior art, there is following useful technique effect:
The present invention is in the embedded system having resource-constrained, the developer preventing level poor forgets to discharge back after using socket resource and changes, or has developer deliberately to develop malice program to be used for taking system socket resource and cause other program cannot apply for socket resource or directly cause system normally to run; China Telecom's intelligent gateway project clearly proposes this demand simultaneously, and this method also perfect can solve this demand; It is simple to operate, and range of application is comparatively extensive.
Accompanying drawing explanation
Fig. 1 is the flow chart of steps of the customizing virtual machine method of the restriction JAVA Programm ocket quantity of the present invention.
Embodiment
In order to more clearly describe the technology contents of the present invention, conduct further description below in conjunction with specific embodiment.
Referring to shown in Fig. 1, the customizing virtual machine method of the restriction JAVA Programm ocket quantity of the present invention comprises:
(1) socket is set in JAVA virtual machine source routine and limits amount threshold;
(2) in JAVA base library source routine, obtain socket limit amount threshold;
(3) when customized virtual machine performs JAVA program, after JAVA program creation or release socket, upgrade the quantity of socket created, and customized virtual machine by the quantity of socket that created compared with described socket restriction amount threshold;
(4) if the quantity of the described socket created is more than or equal to described socket limits amount threshold, then socket quantity is pointed out to reach the upper limit;
(5) if the quantity of the described socket created is less than described socket limits amount threshold, then step (3) is continued.
In a preferred embodiment, described step (1) specifically comprises the following steps:
(1.1) socket limits amount threshold to obtain to add the parameter code resolving appointment socket quantity in JAVA virtual machine source routine main;
(1.2) socket limits amount threshold to be stored in internal memory variable.
In a preferred embodiment, described step (2) is specially:
Socket limits amount threshold to obtain to increase by a function in the JNIEnv structure that JAVA base library source routine and JAVA virtual machine source routine share.
In a preferred embodiment, described step (3) specifically comprises the following steps:
(3.1) quantity of the socket created is upgraded according to Socket.java and ServerSocket.java;
(3.2) compared with the quantity of the socket created is limited amount threshold with described socket.
In actual applications, the present invention realized by amendment JAVA virtual machine source routine or JAVA base library source routine JAVA program being applied for socket resource quantity limit. Its implementation is specific as follows:
(1) JAVA virtual machine source routine main adds the parameter code resolved and specify socket quantity, and the socket limit number value obtained is deposited in internal memory variable.
(2) only plaing a part to resolve due to JAVA virtual machine and perform code, developer needs the basic class storehouse using socket still to have invoked Java. So constrained code is necessarily added in base library, between JAVA virtual machine source routine and base library source routine, JNIEnv structure can be shared. It is used for obtaining socket restriction quantity so to be added function in JNIEnv structure. Namely after the JNI function set of standard, increase a function, desirable any function name, the jint function in following program.
(3) base library that Java program creation socket uses has two places, Socket.java and ServerSocket.java. Wherein in the connect method of Socket, the establishment of ServerSocket, accept method, the realization of these methods adds socket counting, and the socket limit number in socket counting and JNIEnv is compared. When current socket allotment is more than or equal to limit number, throw exception information alert socket quantity reaches the upper limit. Allow developer can know mistake reason, as follows:
(4) in the close method of Socket and ServerSocket realizes, add socket distribution and count the action subtracting 1, specific as follows:
Have employed the customizing virtual machine method of the restriction JAVA Programm ocket quantity in this invention, compared with prior art, there is following useful technique effect:
The present invention is in the embedded system having resource-constrained, the developer preventing level poor forgets to discharge back after using socket resource and changes, or has developer deliberately to develop malice program to be used for taking system socket resource and cause other program cannot apply for socket resource or directly cause system normally to run; China Telecom's intelligent gateway project clearly proposes this demand simultaneously, and this method also perfect can solve this demand; It is simple to operate, and range of application is comparatively extensive.
In this description, the present invention is described with reference to its specific embodiment. But, it is clear that still can make various amendment and conversion and not deviate from the spirit and scope of the present invention. Therefore, specification sheets and accompanying drawing are regarded in an illustrative, rather than a restrictive.
Claims (4)
1. one kind limits the customizing virtual machine method of JAVA Programm ocket quantity, it is characterised in that, described method comprises:
(1) socket is set in JAVA virtual machine source routine and limits amount threshold;
(2) in JAVA base library source routine, obtain socket limit amount threshold;
(3) when customized virtual machine performs JAVA program, after JAVA program creation or release socket, upgrade the quantity of socket created, and customized virtual machine by the quantity of socket that created compared with described socket restriction amount threshold;
(4) if the quantity of the described socket created is more than or equal to described socket limits amount threshold, then socket quantity is pointed out to reach the upper limit;
(5) if the quantity of the described socket created is less than described socket limits amount threshold, then step (3) is continued.
2. the customizing virtual machine method of restriction JAVA Programm ocket quantity according to claim 1, it is characterised in that, described step (1) specifically comprises the following steps:
(1.1) socket limits amount threshold to obtain to add the parameter code resolving appointment socket quantity in JAVA virtual machine source routine main;
(1.2) socket limits amount threshold to be stored in internal memory variable.
3. the customizing virtual machine method of restriction JAVA Programm ocket quantity according to claim 1, it is characterised in that, described step (2) is specially:
Socket limits amount threshold to obtain to increase by a function in the JNIEnv structure that JAVA base library source routine and JAVA virtual machine source routine share.
4. the customizing virtual machine method of restriction JAVA Programm ocket quantity according to claim 1, it is characterised in that, described step (3) specifically comprises the following steps:
(3.1) quantity of the socket created is upgraded according to Socket.java and ServerSocket.java;
(3.2) compared with the quantity of the socket created is limited amount threshold with described socket.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510982777.7A CN105631330A (en) | 2015-12-24 | 2015-12-24 | Customized virtual machine method for limiting socket quantity of JAVA programs |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510982777.7A CN105631330A (en) | 2015-12-24 | 2015-12-24 | Customized virtual machine method for limiting socket quantity of JAVA programs |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105631330A true CN105631330A (en) | 2016-06-01 |
Family
ID=56046254
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510982777.7A Pending CN105631330A (en) | 2015-12-24 | 2015-12-24 | Customized virtual machine method for limiting socket quantity of JAVA programs |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105631330A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7237012B1 (en) * | 2000-12-29 | 2007-06-26 | Nortel Networks Limited | Method and apparatus for classifying Java remote method invocation transport traffic |
CN102710528A (en) * | 2012-06-25 | 2012-10-03 | 宇龙计算机通信科技(深圳)有限公司 | Terminal and method for adjusting sockets in terminal |
CN103475540A (en) * | 2013-09-04 | 2013-12-25 | 厦门亿联网络技术股份有限公司 | Method for detecting whether IP ports between PCs in same local area network are connected |
-
2015
- 2015-12-24 CN CN201510982777.7A patent/CN105631330A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7237012B1 (en) * | 2000-12-29 | 2007-06-26 | Nortel Networks Limited | Method and apparatus for classifying Java remote method invocation transport traffic |
CN102710528A (en) * | 2012-06-25 | 2012-10-03 | 宇龙计算机通信科技(深圳)有限公司 | Terminal and method for adjusting sockets in terminal |
CN103475540A (en) * | 2013-09-04 | 2013-12-25 | 厦门亿联网络技术股份有限公司 | Method for detecting whether IP ports between PCs in same local area network are connected |
Non-Patent Citations (1)
Title |
---|
陈国君等: "《JAVA程序设计基础(第5版)》", 31 May 2015 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10412575B2 (en) | System and method for virtual SIM card | |
US10374869B2 (en) | Containerized architecture to manage internet-connected devices | |
RU2307390C2 (en) | Method for using privileges for distributing resources of device for the application | |
US9609458B2 (en) | Mobile radio communication devices, servers, methods for controlling a mobile radio communication device, and methods for controlling a server | |
CN107528976B (en) | Resource allocation method and related product | |
WO2019061362A1 (en) | Method and device for accessing device identifiers | |
ITUB20151246A1 (en) | PROCEDURE FOR MANAGING A PLURALITY OF PROFILES IN THE SIM MODULE, AND THE CORRESPONDING SIM MODULE AND IT PRODUCT | |
CN107894920A (en) | Resource allocation method and Related product | |
EP2708069A1 (en) | Sim lock for multi-sim environment | |
JP5631940B2 (en) | Information processing apparatus, method, and program | |
WO2022179379A1 (en) | Access control method, electronic device and system | |
TW201635139A (en) | Application permission management system, management device and method thereof | |
CN107621981A (en) | Resource allocation method and Related product | |
US8667512B2 (en) | Flexible hierarchical settings registry for operating systems | |
CN106231579A (en) | The acquisition methods of Internet resources, the acquisition device of Internet resources and terminal | |
EP2028827A2 (en) | Application generation system and method | |
KR20190086325A (en) | Electronic device for managing embedded subscriber identity module and method for the same | |
CN103729176A (en) | Application program integration method and device | |
KR101952053B1 (en) | Scalable charging system based on service-oriented architecture(soa) | |
CN105631330A (en) | Customized virtual machine method for limiting socket quantity of JAVA programs | |
WO2022199499A1 (en) | Access control method, electronic device, and system | |
KR20210007262A (en) | Apparatus and method for manageing application | |
CN102547661B (en) | Method and device for establishing communication between Android system and telecommunications smart card | |
KR101295508B1 (en) | Method and Apparatus for operating an application in smart device | |
CN105706472A (en) | Subscription management |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160601 |