Compare two ways to call Java objects

zhaozj2021-02-17  51

The Java language is powerful, so it will be very useful in many cases to call Java in PHP. There are two ways to call the Java language in the PHP, one is the Java extension module in PHP, and the other is to implement the SJOP protocol provided using the MiniJ2ee application server. Let's compare the features of these two methods. 1.PHP's Java Module PHP release contains a Java extension module that can be used to call Java objects, such as: GetProperty ("java.version"). "
/ n";> The advantage of using this method is relatively convenient, just create a Java object with new java (), you can use the PHP class To call Java objects. However, this method also has the following significant shortcomings: 1. Since the PHP's Java module selects the most suitable Java method according to the PHP data type, the Java overload cannot be invoked. 2. PHP's Java module will load JVM (Java virtual machine) in the current Web Server, so the system overhead is extremely efficient, affecting the performance efficiency of the Web Server process. 3. In some operating systems and web server environments, PHP's Java modules will cause the web server process to die. See http://www.php.net/bugs.php?id=6122. For these reasons, PHP's Java modules have never been applied to actual software systems.

2. MINIJ2EE Application Server SJOP Protocol Realization Before introducing the MiniJ2EE application server SJOP protocol implementation, briefly introduce the MiniJ2EE application server. The MiniJ2EE application server is the first J2EE application server product that supports PHP, enabling PHPs to develop enterprise-level applications. SJOP is full name is Sample Java ORB Protocol (Simple Java Object Request Agent Protocol), is a simple and efficient object requesting agency protocol. For example: / n";> MINIJ2EE Application Server Implementing the SJOP Protocol to enable the PHP to access the EJB enterprise component, so MiniJ2ee provides an EJB-PHP compiler that can compile the EJB component into PHP Class, make the EJB component in the PHP program, for example:

$ home = new carthome (); file: // Create an EJB home interface. $ Objref = $ home-> create ($ cart_name); File: // Create Cart EJB. $ CART = New Cart ($ OBJREF);

转载请注明原文地址:https://www.9cbs.com/read-29252.html

New Post(0)