[go: up one dir, main page]

CN111538545A - Java application running method, device, medium and electronic equipment - Google Patents

Java application running method, device, medium and electronic equipment Download PDF

Info

Publication number
CN111538545A
CN111538545A CN202010328110.6A CN202010328110A CN111538545A CN 111538545 A CN111538545 A CN 111538545A CN 202010328110 A CN202010328110 A CN 202010328110A CN 111538545 A CN111538545 A CN 111538545A
Authority
CN
China
Prior art keywords
application
virtual machine
java
machine cluster
java virtual
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.)
Granted
Application number
CN202010328110.6A
Other languages
Chinese (zh)
Other versions
CN111538545B (en
Inventor
谌瑞祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BOE Technology Group Co Ltd
Original Assignee
BOE Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BOE Technology Group Co Ltd filed Critical BOE Technology Group Co Ltd
Priority to CN202010328110.6A priority Critical patent/CN111538545B/en
Publication of CN111538545A publication Critical patent/CN111538545A/en
Application granted granted Critical
Publication of CN111538545B publication Critical patent/CN111538545B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

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

Abstract

The disclosed embodiment provides a Java application running method, a Java application running device, a computer readable medium and an electronic device, relating to the technical field of software development; the Java application running method comprises the following steps: establishing a Java virtual machine cluster at a cloud server side, deploying Java application in the Java virtual machine cluster, and registering a custom class loader corresponding to the Java application in the Java virtual machine cluster; receiving an application loading instruction through the Java virtual machine cluster, and acquiring routing information of an application to be loaded according to the loading instruction; determining a target loader corresponding to the application to be loaded from the custom class loaders of the Java virtual machine cluster through the routing information, and generating a class object of the application to be loaded through the target loader so as to run the application to be loaded. The technical scheme of the embodiment of the disclosure can overcome the problem that the application is started too slowly, and further improve the starting rate of the application.

Description

Java application running method, device, medium and electronic equipment
Technical Field
The present disclosure relates to the field of software development technologies, and in particular, to a Java application running method, a Java application running apparatus, a computer-readable medium, and an electronic device.
Background
The JVM defines a bytecode loading mode, and shields information related to a specific platform, so that a Java language compiler can run on various platforms without modification by generating a bytecode running on the Java Virtual Machine, thereby realizing one-time compilation and running everywhere.
When a Java application is started, every time a JVM needs to load all Java classes, for a micro service, one micro service only implements some simple functions, provides simple services, does not need to use all Java class libraries, and the loading of all Java class libraries during starting can result in an excessively long starting time.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
An object of the embodiments of the present disclosure is to provide a Java application running method, a Java application running apparatus, a computer-readable medium, and an electronic device, so as to overcome the problem that the application is started too slowly at least to a certain extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the embodiments of the present disclosure, there is provided a Java application execution method, including:
establishing a Java virtual machine cluster at a cloud server side, deploying Java application in the Java virtual machine cluster, and registering a custom class loader corresponding to the Java application in the Java virtual machine cluster;
receiving an application loading instruction through the Java virtual machine cluster, and acquiring routing information of an application to be loaded according to the loading instruction;
determining a target loader corresponding to the application to be loaded from the custom class loaders of the Java virtual machine cluster through the routing information, and generating a class object of the application to be loaded through the target loader so as to run the application to be loaded.
In an exemplary embodiment of the disclosure, the deploying the Java application in the Java virtual machine cluster includes:
calculating the performance indexes of all nodes in the Java virtual machine cluster so as to determine a target node from all the nodes through the performance indexes;
and deploying the Java application on a target node in the Java virtual machine cluster.
In an exemplary embodiment of the present disclosure, the routing information includes a node identification, a class loader identification, and a full path name of a class.
In an exemplary embodiment of the present disclosure, the determining, from the custom class loaders of the Java virtual machine cluster through the routing information, an object loader corresponding to the application to be loaded includes:
determining a first node corresponding to the application to be loaded in the Java virtual machine cluster through the node identifier;
and determining a target loader corresponding to the loader identifier through the registration record information stored by the first node.
In an exemplary embodiment of the present disclosure, the generating, by the target loader, the class object of the application to be loaded includes:
and obtaining the class object corresponding to the full path name of the class through the target loader.
In an exemplary embodiment of the disclosure, after registering the custom class loader in the Java virtual machine cluster, the method further includes:
and generating registration record information in a second node of the Java virtual machine cluster so as to record the registered custom class loader through the registration record information.
In an exemplary embodiment of the present disclosure, after generating the registration record information in the second node of the Java virtual machine cluster, the method further includes:
and in the Java virtual machine cluster, synchronizing the registration record information to each node according to the heartbeat information among the nodes.
In an exemplary embodiment of the present disclosure, the building a Java virtual machine cluster at a cloud server includes:
and loading the Java basic class library into a memory through a common class loader to obtain the Java virtual machine cluster.
According to a second aspect of the embodiments of the present disclosure, there is provided a Java application execution apparatus including: the system comprises a cluster acquisition module, an application deployment module and an application loading module, wherein:
the system comprises a cluster acquisition module, a Java virtual machine cluster and a self-defined class loader, wherein the cluster acquisition module is used for constructing the Java virtual machine cluster at a cloud server end, deploying Java applications in the Java virtual machine cluster and registering the self-defined class loader corresponding to the Java applications in the Java virtual machine cluster;
the application deployment module is used for receiving an application loading instruction through the Java virtual machine cluster and acquiring routing information of an application to be loaded according to the loading instruction;
and the application loading module is used for determining a target loader corresponding to the application to be loaded from the custom class loaders of the Java virtual machine cluster through the routing information, and generating a class object of the application to be loaded through the target loader so as to run the application to be loaded.
In an exemplary embodiment of the present disclosure, the application deployment module may specifically include an index calculation unit and a node selection unit, where:
the index calculation unit is used for calculating the performance index of each node in the Java virtual machine cluster so as to determine a target node from each node through the performance index;
and the node selection unit is used for deploying the Java application on a target node in the Java virtual machine cluster.
In an exemplary embodiment of the present disclosure, the routing information includes a node identification, a class loader identification, and a full path name of a class.
In an exemplary embodiment of the present disclosure, the application loading module may specifically include a node determining unit and a loader determining unit, where:
and the node determining unit is used for determining a first node corresponding to the application to be loaded in the Java virtual machine cluster through the node identifier.
And the loader determining unit is used for determining a target loader corresponding to the loader identifier through the registration record information stored in the first node.
In an exemplary embodiment of the disclosure, the Java application execution apparatus may further include a registration recording module, configured to generate registration recording information in the second node of the Java virtual machine cluster, so as to record the registered custom class loader through the registration recording information.
In an exemplary embodiment of the present disclosure, the application loading module may be specifically configured to obtain, by the target loader, a class object corresponding to the full path name of the class.
In an exemplary embodiment of the disclosure, the Java application execution apparatus may further include a node synchronization module, configured to synchronize the registration record information to each node according to heartbeat information between each node in the Java virtual machine cluster.
In an exemplary embodiment of the present disclosure, the cluster obtaining module may be specifically configured to load a Java base class library to a memory through a common class loader, so as to obtain the Java virtual machine cluster.
According to a third aspect of embodiments of the present disclosure, there is provided a computer-readable medium, on which a computer program is stored, which when executed by a processor, implements the Java application execution method as described in the first aspect of the embodiments above.
According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the Java application execution method as described in the first aspect of the embodiments above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the technical solutions provided by some embodiments of the present disclosure, on one hand, computing resources can be increased through a Java virtual machine cluster, so as to improve scalability of the Java virtual machine, and the Java virtual machine cluster can provide services through a plurality of nodes, so as to avoid service interruption, thereby improving usability; on the other hand, the Java application is deployed in the cluster, and when the Java application is loaded and started, only the Java class corresponding to the Java application can be loaded through the target loader corresponding to the Java application, so that the Java application is quickly started, and the starting speed is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
FIG. 1 schematically shows a flowchart of a Java application execution method according to one embodiment of the present disclosure;
FIG. 2 schematically shows a block diagram of a Java application execution apparatus according to one embodiment of the present disclosure;
FIG. 3 illustrates a schematic structural diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The technical solution of the embodiment of the present disclosure is explained in detail below:
an exemplary embodiment of the present disclosure first provides a Java application execution method. Referring to fig. 1, the Java application execution method may include step S110, step S120, and step S130, where:
step S110: the method comprises the steps of constructing a Java virtual machine cluster at a cloud server side, deploying Java applications in the Java virtual machine cluster, and registering a custom class loader corresponding to the Java applications in the Java virtual machine cluster.
Step S120: and receiving an application loading instruction through the Java virtual machine cluster, and acquiring the routing information of the application to be loaded according to the loading instruction.
Step S130: determining a target loader corresponding to the application to be loaded from the custom class loaders of the Java virtual machine cluster through the routing information, and generating a class object of the application to be loaded through the target loader so as to run the application to be loaded.
In the method for running the Java application provided by an exemplary embodiment of the present disclosure, on one hand, computing resources can be increased by the Java virtual machine cluster, so as to improve scalability of the Java virtual machine, and the Java virtual machine cluster can provide services through a plurality of nodes, so as to avoid service interruption, thereby improving usability; on the other hand, the Java application is deployed in the cluster, and only the Java class of the Java application is loaded when the Java application is started through the custom loader, so that the Java application is quickly started, and the starting speed is improved.
Next, the above steps of the present exemplary embodiment will be described in more detail.
In step S110, a Java virtual machine cluster is established at the cloud server, a Java application is deployed in the Java virtual machine cluster, and a custom class loader corresponding to the Java application is registered in the Java virtual machine cluster.
The class loader may read the binary byte code of a class into the Java virtual machine and then convert it to a class object instance corresponding to the class. The Java virtual machine itself may include some class loader, for example, a boot class loader, which is responsible for loading the core class library into memory. When a Java virtual machine cluster is constructed, a common class loader can be defined firstly, and the common class loader can load a Java basic class library into a memory of the Java virtual machine, so that all classes in the basic class library can be called, and an operating environment is provided for a Java application program. And then, a cluster is built on a cloud server side through the obtained Java virtual machine, and a multi-node distributed cluster environment is built, so that a Java virtual machine cluster is obtained. The Java virtual machine cluster can comprise a plurality of Java virtual machine nodes, a unique identification code of the cluster can be generated when a first node is deployed, other nodes can be added into the cluster through the unique identification code, each node can be coded to generate an identification code corresponding to each node, and communication can be carried out among the nodes through the identification codes.
The Java application can comprise Java micro-services, and can be deployed to any node in a Java virtual machine cluster in a container mode. In an optional embodiment, the method may include calculating a performance index of each node in the Java virtual machine cluster, so as to determine a target node from the nodes through the performance index; and then deploying the Java application on a target node in the Java virtual machine cluster.
The performance indexes of each node in the Java virtual machine cluster can be calculated through indexes such as data packet response time and delay, and therefore the node with the highest performance index is used as a target node. For example, a data packet may be broadcast to each node first, the response time of each node to the data packet may be determined, the node with the shortest response time may be used as a target node, the delay of each node may be calculated by the time when each node receives the data packet, and the node with the smallest delay may be used as a target node; the final performance index may also be calculated by using a plurality of indexes, for example, response time, delay, and cpu occupancy of each node are determined, a weighting coefficient is determined for each node, and finally the performance index is obtained by weighting and summing, so that the node with the maximum or minimum performance index is used as the target node. In other embodiments of the present disclosure, the target node may be selected in other manners, for example, a node with the largest memory is used as the target node, and a node with the smallest cpu occupancy rate is used as the target node.
When a Java application is deployed, the Java application may create a corresponding custom class loader. The custom class loader is realized by a developer through Java language and can be used for loading class libraries in a specified path. Illustratively, a Java application developer can write a custom class loader in advance by inheriting the Java.
A plurality of Java applications can be deployed in the Java virtual machine cluster, and each Java application can correspond to different custom class loaders. Then, each custom class loader can be registered in different Java virtual machine nodes, optionally, registration record information can be generated in a specific node of the Java virtual machine cluster, so as to record the registered custom class loader through the registration record information. The specific node may refer to a designated node in the cluster, such as a master node, or may be another node in the cluster. And generating registration record information in the specific node, wherein the custom class loader corresponding to each application can be registered in the registration record information each time the Java application is deployed. The registration record information may be files in various forms, such as lists, texts, and the like; the file may be used to add or delete custom class loaders; moreover, the registration record information may specifically include information of a custom class loader registered in the node, for example, an identification code of a class, a full path name of a class, and the like, which is not particularly limited in this embodiment.
The Java virtual machine cluster can load all byte codes into the memory according to all the class loaders in the registration record information, different classes can be loaded in different containers by different class loaders, and communication can be carried out between the classes. The stored registration record information can be synchronized through communication among the nodes, so that the registration record information in each node is kept consistent, and a corresponding custom class loader can be correctly found and loaded no matter which node the load is loaded to. For example, when a Java application is deployed, the Java application may register with a master node in a cluster, register a custom class loader corresponding to the Java application into registration record information on the master node, and the master node may synchronize the registration record information to all nodes in the cluster.
The heartbeat can be kept among all nodes in the Java virtual machine cluster, so that the registration record information is synchronized through the heartbeat information among all the nodes. First, a time period can be set, and each node can send heartbeat information by other nodes in each time period, so that the nodes are kept connected. For each node in the cluster, the information of other nodes which are connected with the node can be determined through the heartbeat information received by the node, so that the registration record information is sent to other nodes, and the consistency of the registration record information on each node is ensured.
In step S120, an application loading instruction is received by the Java virtual machine cluster, and routing information of an application to be loaded is obtained according to the loading instruction.
If the Java virtual machine cluster receives an application loading instruction, the routing information contained in the loading instruction can be acquired by analyzing the loading instruction. The routing information may be identification information of a class to be loaded in the application to be loaded, and may specifically include an identification code of the class, a class name, an access path of the class, and the like, and may also include other information, for example, a node identification of a Java virtual machine node, and the like. Optionally, the routing information may be composed of a node identifier, a class loader identifier, and a full path name of the class. The class loader identification refers to identification information generated when the custom class loader is developed, and is used for identifying each custom class loader, for example, the name of the custom class loader, or the code ID, etc.; the node identification can be the only identification of the Java virtual machine node in the cluster; the full path name of a class may be composed of a package name and a class name corresponding to the class.
With reference to fig. 1, in step S130, a target loader corresponding to the application to be loaded is determined from the custom class loaders of the Java virtual machine cluster through the routing information, and a class object of the application to be loaded is generated by the target loader, so as to run the application to be loaded.
First, a first node corresponding to an application to be loaded in a Java virtual machine cluster is determined through a node identifier included in routing information, registration record information can be stored on the first node, each custom class loader can be obtained through the registration record information, and then a corresponding custom loader is retrieved from the registration record information of the first node through a loader identifier included in the routing information to serve as a target loader. The target loader may be responsible for loading a class object corresponding to a class to be loaded in the application to be loaded into a container memory where the application to be loaded is located, so as to start a virtual machine corresponding to the application to be loaded, thereby generating the class object in the application. The class to be loaded may be looked up by the full path name of the class included in the routing information. After the class object corresponding to the class to be loaded is loaded into the memory of the virtual machine, binary data in the class object can be read, so that the Java virtual machine can initialize the class and generate a corresponding class object. Through the embodiment, the target loader corresponding to the application to be loaded when the application needs to be loaded and run is only responsible for loading the class object corresponding to the application, and each class does not need to be loaded, so that the virtual machine node corresponding to the application can be quickly started, the starting speed can be increased, and the effect of quickly starting the application is realized.
In an exemplary embodiment, different classes can be loaded in different containers by different class loaders, and asynchronous communication can be performed between classes to call each other. For example, a queue may be respectively set for each class, where the queue is configured to receive messages sent by other classes, and if class a needs to call class B, a node where class B is located and a corresponding class loader may be determined by registering record information, so as to obtain an instance of class B, and then a call message may be sent to class B, and after receiving the call message, the queue of class B may determine, according to the call message, a method that class a needs to call, so as to execute the method and return an execution result to class a. Moreover, if the number of times of calling a class in the same time period is too many, the instances of the class can be dynamically increased, or the calling is reduced, for example, the maximum number of received messages in a queue in a period of time is set, and if the number exceeds the maximum number, the receiving is rejected, so that the problem of concurrent errors can be avoided.
Next, an embodiment of the present disclosure further provides a Java application running apparatus, which can be used to execute the Java application running method described above in the present disclosure.
As shown in fig. 2, the Java application execution apparatus 200 may include a cluster acquisition module 210, an application deployment module 220, and an application loading module 230, wherein:
the cluster acquisition module 210 is configured to construct a Java virtual machine cluster at a cloud server, deploy a Java application in the Java virtual machine cluster, and register a custom class loader corresponding to the Java application in the Java virtual machine cluster.
The application deployment module 220 is configured to receive an application loading instruction through the Java virtual machine cluster, and obtain routing information of an application to be loaded according to the loading instruction.
An application loading module 230, configured to determine, from the custom class loaders of the Java virtual machine cluster, a target loader corresponding to the application to be loaded through the routing information, and generate, by using the target loader, a class object of the application to be loaded, so as to run the application to be loaded.
In an exemplary embodiment of the present disclosure, the application deployment module 220 may specifically include an index calculation unit and a node selection unit, where:
the index calculation unit is used for calculating the performance index of each node in the Java virtual machine cluster so as to determine a target node from each node through the performance index;
and the node selection unit is used for deploying the Java application on a target node in the Java virtual machine cluster.
In an exemplary embodiment of the present disclosure, the routing information includes a node identification, a class loader identification, and a full path name of a class.
In an exemplary embodiment of the present disclosure, the application loading module 230 may specifically include a node determining unit and a loader determining unit, where:
and the node determining unit is used for determining a first node corresponding to the application to be loaded in the Java virtual machine cluster through the node identifier.
And the loader determining unit is used for determining a target loader corresponding to the loader identifier through the registration record information stored in the first node.
In an exemplary embodiment of the disclosure, the Java application execution apparatus may further include a registration recording module, configured to generate registration recording information in the second node of the Java virtual machine cluster, so as to record the registered custom class loader through the registration recording information.
In an exemplary embodiment of the disclosure, the application loading module 230 may be specifically configured to obtain, by the target loader, a class object corresponding to the full path name of the class.
In an exemplary embodiment of the disclosure, the Java application execution apparatus may further include a node synchronization module, configured to synchronize the registration record information to each node according to heartbeat information between each node in the Java virtual machine cluster.
In an exemplary embodiment of the present disclosure, the cluster obtaining module may be specifically configured to load a Java base class library to a memory through a common class loader, so as to obtain the Java virtual machine cluster.
For details that are not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the Java application execution method of the present disclosure for the details that are not disclosed in the embodiments of the apparatus of the present disclosure.
Referring now to FIG. 3, shown is a schematic block diagram of a computer system 300 suitable for use in implementing the electronic device of an embodiment of the present disclosure. The computer system 300 of the electronic device shown in fig. 3 is only an example, and should not bring any limitations to the function and scope of the embodiments of the present disclosure.
As shown in fig. 3, the computer system 300 includes a Central Processing Unit (CPU)301 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage section 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for system operation are also stored. The CPU301, ROM 302, and RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
The following components are connected to the I/O interface 305: an input portion 306 including a keyboard, a mouse, and the like; an output section 307 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 308 including a hard disk and the like; and a communication section 309 including a network interface card such as a LAN card, a modem, or the like. The communication section 309 performs communication processing via a network such as the internet. A drive 310 is also connected to the I/O interface 305 as needed. A removable medium 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 310 as necessary, so that a computer program read out therefrom is mounted into the storage section 308 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 309, and/or installed from the removable medium 311. The above-described functions defined in the system of the present application are executed when the computer program is executed by the Central Processing Unit (CPU) 301.
It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device realizes the Java application execution method in the embodiment.
For example, the electronic device may implement the following as shown in fig. 1: step S110, constructing a plurality of Java virtual machine nodes at a cloud server side, and registering a custom class loader in the Java virtual machine nodes to obtain a service cluster; step S120, deploying a Java application in the service cluster, receiving a loading instruction of the Java application through the service cluster, and acquiring routing information of the Java application according to the loading instruction; step S130, determining a target loader corresponding to the Java application from the custom class loaders in the service cluster through the routing information, and generating a class object of the Java application through the target loader to run the Java application.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (11)

1. A Java application running method is characterized by comprising the following steps:
establishing a Java virtual machine cluster at a cloud server side, deploying Java application in the Java virtual machine cluster, and registering a custom class loader corresponding to the Java application in the Java virtual machine cluster;
receiving an application loading instruction through the Java virtual machine cluster, and acquiring routing information of an application to be loaded according to the loading instruction;
determining a target loader corresponding to the application to be loaded from the custom class loaders of the Java virtual machine cluster through the routing information, and generating a class object of the application to be loaded through the target loader so as to run the application to be loaded.
2. The method of claim 1, wherein deploying the Java application in the Java virtual machine cluster comprises:
calculating the performance indexes of all nodes in the Java virtual machine cluster so as to determine a target node from all the nodes through the performance indexes;
and deploying the Java application on a target node in the Java virtual machine cluster.
3. The method of claim 1, wherein the routing information comprises a node identification, a class loader identification, and a full path name for a class.
4. The method according to claim 3, wherein the determining, from the custom class loaders of the Java virtual machine cluster through the routing information, an object loader corresponding to the application to be loaded comprises:
determining a first node corresponding to the application to be loaded in the Java virtual machine cluster through the node identifier;
and determining a target loader corresponding to the loader identifier through the registration record information stored by the first node.
5. The method according to claim 3, wherein the generating, by the target loader, the class object of the application to be loaded comprises:
and obtaining the class object corresponding to the full path name of the class through the target loader.
6. The method of claim 4, wherein after registering a custom class loader in the Java virtual machine cluster, further comprising:
and generating registration record information in a second node of the Java virtual machine cluster so as to record the registered custom class loader through the registration record information.
7. The method according to claim 6, after generating the registration record information in the second node of the Java virtual machine cluster, further comprising:
and in the Java virtual machine cluster, synchronizing the registration record information to each node according to the heartbeat information among the nodes.
8. The method according to claim 1, wherein the building of the Java virtual machine cluster at the cloud server side comprises:
and loading the Java basic class library into a memory through a common class loader to obtain the Java virtual machine cluster.
9. A Java application execution apparatus, comprising:
the system comprises a cluster acquisition module, a Java virtual machine cluster and a self-defined class loader, wherein the cluster acquisition module is used for constructing the Java virtual machine cluster at a cloud server end, deploying Java applications in the Java virtual machine cluster and registering the self-defined class loader corresponding to the Java applications in the Java virtual machine cluster;
the application deployment module is used for receiving an application loading instruction through the Java virtual machine cluster and acquiring routing information of an application to be loaded according to the loading instruction;
and the application loading module is used for determining a target loader corresponding to the application to be loaded from the custom class loaders of the Java virtual machine cluster through the routing information, and generating a class object of the application to be loaded through the target loader so as to run the application to be loaded.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out a Java application execution method according to any one of claims 1 to 8.
11. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a Java application execution method as claimed in any one of claims 1 to 8.
CN202010328110.6A 2020-04-23 2020-04-23 Java application running method, java application running device, java application running medium and electronic equipment Active CN111538545B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010328110.6A CN111538545B (en) 2020-04-23 2020-04-23 Java application running method, java application running device, java application running medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010328110.6A CN111538545B (en) 2020-04-23 2020-04-23 Java application running method, java application running device, java application running medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111538545A true CN111538545A (en) 2020-08-14
CN111538545B CN111538545B (en) 2024-07-12

Family

ID=71977133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010328110.6A Active CN111538545B (en) 2020-04-23 2020-04-23 Java application running method, java application running device, java application running medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111538545B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269638A (en) * 2020-10-29 2021-01-26 苏州浪潮智能科技有限公司 Virtual machine loading device, method and system for realizing interaction between server applications
CN112463303A (en) * 2020-12-01 2021-03-09 中国工商银行股份有限公司 JAVA virtual machine class loading method and system
CN112631685A (en) * 2020-12-30 2021-04-09 中国农业银行股份有限公司 Class loading method and device
CN114281352A (en) * 2020-09-28 2022-04-05 京东方科技集团股份有限公司 Service deployment method and related equipment
CN114443013A (en) * 2021-12-28 2022-05-06 天翼云科技有限公司 Implementation method, apparatus, electronic device and readable medium for JAVA service application
CN115061748A (en) * 2022-06-21 2022-09-16 点都互联科技有限公司 A Method of Automatically Switching Implementation Classes Based on Strategy Pattern

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101763271A (en) * 2008-12-26 2010-06-30 爱思开电讯投资(中国)有限公司 Method and device for loading classes and creating and accessing class objects
US20100235821A1 (en) * 2008-08-22 2010-09-16 Timothy John Baldwin Storing and loading server-side application extensions in a cluster environment
CN105068852A (en) * 2015-09-22 2015-11-18 普元信息技术股份有限公司 System and method for realizing Java class on-line hot updating in cloud computing environment
CN105100180A (en) * 2014-11-25 2015-11-25 航天恒星科技有限公司 Cluster node dynamic loading method, device and system
CN107222320A (en) * 2016-03-22 2017-09-29 中兴通讯股份有限公司 The method and apparatus that Cloud Server cluster sets up High Availabitity connection
CN109032760A (en) * 2018-08-01 2018-12-18 北京百度网讯科技有限公司 Method and apparatus for application deployment
CN109933405A (en) * 2019-01-09 2019-06-25 平安科技(深圳)有限公司 Virtual machine creation method and device, electronic equipment, storage medium
CN110716720A (en) * 2018-07-12 2020-01-21 北京京东尚科信息技术有限公司 A method and apparatus for implementing application hot deployment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100235821A1 (en) * 2008-08-22 2010-09-16 Timothy John Baldwin Storing and loading server-side application extensions in a cluster environment
CN101763271A (en) * 2008-12-26 2010-06-30 爱思开电讯投资(中国)有限公司 Method and device for loading classes and creating and accessing class objects
CN105100180A (en) * 2014-11-25 2015-11-25 航天恒星科技有限公司 Cluster node dynamic loading method, device and system
CN105068852A (en) * 2015-09-22 2015-11-18 普元信息技术股份有限公司 System and method for realizing Java class on-line hot updating in cloud computing environment
CN107222320A (en) * 2016-03-22 2017-09-29 中兴通讯股份有限公司 The method and apparatus that Cloud Server cluster sets up High Availabitity connection
CN110716720A (en) * 2018-07-12 2020-01-21 北京京东尚科信息技术有限公司 A method and apparatus for implementing application hot deployment
CN109032760A (en) * 2018-08-01 2018-12-18 北京百度网讯科技有限公司 Method and apparatus for application deployment
CN109933405A (en) * 2019-01-09 2019-06-25 平安科技(深圳)有限公司 Virtual machine creation method and device, electronic equipment, storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
孙彬;: "Java动态类加载机制应用研究", 科技创新与应用, no. 23 *
陈芝荣;蒋建峰;姚树春;: "Java类加载器机制与模型", 软件导刊, no. 08 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114281352A (en) * 2020-09-28 2022-04-05 京东方科技集团股份有限公司 Service deployment method and related equipment
US12155661B2 (en) 2020-09-28 2024-11-26 Beijing Boe Technology Development Co., Ltd. Service deployment method, device, system, and computer-readable storage medium
CN112269638A (en) * 2020-10-29 2021-01-26 苏州浪潮智能科技有限公司 Virtual machine loading device, method and system for realizing interaction between server applications
CN112269638B (en) * 2020-10-29 2022-06-03 苏州浪潮智能科技有限公司 Virtual machine loading device, method and system for realizing interaction between server applications
CN112463303A (en) * 2020-12-01 2021-03-09 中国工商银行股份有限公司 JAVA virtual machine class loading method and system
CN112463303B (en) * 2020-12-01 2023-11-24 中国工商银行股份有限公司 JAVA virtual machine class loading method and system
CN112631685A (en) * 2020-12-30 2021-04-09 中国农业银行股份有限公司 Class loading method and device
CN112631685B (en) * 2020-12-30 2024-04-12 中国农业银行股份有限公司 Class loading method and device
CN114443013A (en) * 2021-12-28 2022-05-06 天翼云科技有限公司 Implementation method, apparatus, electronic device and readable medium for JAVA service application
CN115061748A (en) * 2022-06-21 2022-09-16 点都互联科技有限公司 A Method of Automatically Switching Implementation Classes Based on Strategy Pattern
CN115061748B (en) * 2022-06-21 2025-05-13 点都互联科技有限公司 A method for automatically switching implementation classes based on strategy mode

Also Published As

Publication number Publication date
CN111538545B (en) 2024-07-12

Similar Documents

Publication Publication Date Title
CN111538545B (en) Java application running method, java application running device, java application running medium and electronic equipment
CN110505162B (en) Message transmission method and device and electronic equipment
CN110391938B (en) Method and apparatus for deploying services
AU2018310287A1 (en) Smart contract processing method and apparatus
CN113407165B (en) SDK generation and self-upgrade method, device, readable medium and equipment
US8938712B2 (en) Cross-platform virtual machine and method
CN109104368B (en) A method, device, server and computer-readable storage medium for requesting connection
CN106713469B (en) Dynamic loading method, device and system for distributed container
CN112286622B (en) Virtual machine migration processing and strategy generation method, device, equipment and storage medium
US20180143823A1 (en) Method, apparatus, and programmable apparatus for incremental update
CN109753300B (en) Algorithm upgrading method, calculation task sending method and related device
CN111813407B (en) Game development method, game running device and electronic equipment
CN113127430A (en) Mirror image information processing method and device, computer readable medium and electronic equipment
CN111176641B (en) Flow node execution method, device, medium and electronic equipment
US10031764B2 (en) Managing executable files
US11249760B2 (en) Parameter management between programs
CN114840310A (en) Container creation method, device, electronic equipment and computer-readable storage medium
CN113407309A (en) Virtual machine memory application method and device, storage medium and electronic equipment
US11200070B2 (en) Dynamic-link library usage based on memory size
CN117389567A (en) Multi-terminal application development method, device, medium and equipment
CN116684494A (en) Resource processing method, device and storage medium based on distributed cloud platform
CN110968334B (en) Application resource updating method, resource package manufacturing method, device, medium and equipment
CN109871226B (en) Configuration method, device and medium of downloader and electronic equipment
CN113391882A (en) Virtual machine memory management method and device, storage medium and electronic equipment
CN112041817B (en) Method and node for managing requests for hardware acceleration by means of an accelerator device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant