RMI specification - second - five chapters

xiaoxiao2021-03-06  143

RMI Specification - Chapter 2 Java Distributed Object Model. .

RMI Specification - Chapter 3 Topic: Stub and Skeleton ;; Thread Use in Remote Method Call ;; Waste Collection of Remote Objects; Dynamic Class Delivery ;; RMI; .

RMI specification - Chapter 4

Client interface; .

RMI Specification - Chapter 5 Server Interface ;; Java.rmi.Server package Contains interfaces and classes that are usually used to implement remote objects.

Theme: RemoteObject class ;; RemoteServer class ;; UnicastRemoteObject class ;; Unreferenced Interface ;; RMISecurityManager class ;; RMIClassLoader class ;; LoaderHandler interfaces ;; RMI socket factory ;; RMIFailureHandler interfaces ;; LogStream class ;; stub and skeleton compiler ;

?

?

RMI Specification - Chapter 2

Java Distributed Object Model

2.1 Distributed Objects Applications RMI applications typically include two separate programs: server programs and client programs. A typical server application will create multiple remote objects that allow these remote objects to be referenced, and then wait for client calling those on remote objects. Typical client programs get a reference to one or more remote objects from the server, and then call the way to remote objects. RMI provides a mechanism for servers and clients. Such applications are sometimes referred to as distributed object applications.

Distributed object applications require:

Positioning Remote Objects Applications can use one of two mechanisms to get references to remote objects. It can register its remote objects with the simple nimell tool RMireGistry of RMI; you can also deliver a remote object reference as part of a regular operation. Details of inter-remote object communication remote objects are handled by RMI; for programmers, remote communication looks on the Java method of the icon. The object loaded by the parameter or returned value is loaded by the RMI allows the caller to pass the pure Java object to the remote object, so the RMI will provide the necessary mechanism, which can load the object's code and data of the object. The server calls the registration service program to associate the name with the remote object. The client uses the remote object in the server registration service program to find the remote object, and then call it. RMI can load the class bytecode with any URL protocol supported by the Java system (such as HTTP, FTP, File, etc.).

2.2 Definition of the term In the Java distributed object model, Remote Object is an object: its method can be called from other Java virtual machines (possibly on different hosts). This type of object is described by one or more Remote Interfaces (which is a Java interface of the declaration remote object method). Remote Method Call (RMI) is the action of calling the remote interface on the remote object. More importantly, the method of the remote object calls the same as the method of calling the local object.

2.3 Comparison Java Distributed Object Model of Distributed and Non-Distributed Models Similar to the Java Object Model: Remote Objects In any method call (local or remote) can be passed in parameters or return. Remote objects can be forced to convert to any remote interface as long as the interface is supported using a built-in Java syntax for enforcement type conversion. Built-in Java Operator InstanceOf can be used to test remote interfaces supported by the remote object. The Java Distributed Object Model is different from the Java object model: the client's client interacts with the remote interface, and never interact with these interfaces. The non-remote parameters of the remote method and the return result are passed by copying instead of reference. This is because the reference is only useful in a single virtual machine.

Remote objects are passed in a reference manner instead of copying the actual remote implementation. Semanti-specific semantics for some Java.lang.Object class definitions are dedicated to remote objects. Because the failure mode of calling the remote object is complicated than the failure mode of the calling local object, the client must handle the extra exception that occurred during the remote method call.

2.4 RMI Interface and Class Overview 2.4.1 Java.rmi.Remote Interface In RMI, remote interface is a method set that can be called from remote Java virtual machines. Remote interfaces must meet the following requirements:

The remote interface must extends the java.rmi.Remote interface directly or indirectly. The method declaration in the remote interface must meet the requirements of the following remote method declaration: Remote method declarations In addition to the exception related to the application in its throws clause (note that the application related to the application does not need to expand java.rmi.RemoteException) In addition, Java.Rmi.RemoteException is exception (or its superclass, such as java.ioException or java.lang.exception). Remote method declarations, as parameters or return values ​​declared (directly declared or embedded to parameters in the parameter table)

Non-remote objects) The remote object must be declared as a remote interface, not the implementation class of the interface. The java.rmi.Remote interface is a tag interface that does not define methods:

Public Interface Remote

The remote interface must extend at least the java.rmi.Remote interface (or other remote interface of the Java.rmi.Remote). However, remote interfaces can extend non-remote interfaces in the following situations:

Remote interfaces can also extend other non-remote interfaces, as long as all methods of extended interfaces (if any) meet the requirements of the remote method declaration. For example, the following interface BankAccount defines a remote interface for the access bank account. It contains a remote way to account deposits to account deposits, balance account balance and from account withdrawal:

public interface BankAccount extends java.rmi.Remote {public void deposit (float amount) throws java.rmi.RemoteException; public void withdraw (float amount) throws OverdrawnException, java.rmi.RemoteException; public float getBalance () throws java.rmi. RemoteException;}

The following example illustrates a valid remote interface Beta. It expands non-remote interface alpha (have remote methods) and

Interface Java.rmi.Remote:

public interface Alpha {public final String okay = "constants are okay too"; public Object foo (Object obj) throws java.rmi.RemoteException; public void bar () throws java.io.IOException; public int baz () throws java. Lang.exception;} public interface beta extends alpha, java.rmi.remote {public void ping () throws java.rmi.remoteException;}

2.4.2 RemoteException class Java.rmi.RemoteException class is an exception that is thrown by the RMI runtime during the remote method call. To ensure the robustness of the application of the RMI system, the remote approach declared in the remote interface must specify java.rmi.RemoteException (or its superclars, such as java.io ioException or java.lang. " Exception.

When the remote method calls failure for some reason, it will throw java.rmi.RemoteException. Remaining Remote Method Calling Failure Includes:

Communication failure (remote server is unreachable or rejected; connection is closed, etc.) Parameter or return value transmission or reading failure protocol error RemoteException class is a tested exception (must be processed by the calling program of the remote method and compile Abnormally instead of the instead of RuntimeException.

2.4.3 RemoteObject class and its subclass RMI server function are provided by java.rmi.server.RemoteObject and its subclass java.rmi.server.RemoteServer, java.rmi.server.unicastRemoteObject and java.rmi.activation.activatable.

Java.rmi.Server.RemoteObject provides implementation of the Java.lang.Object method that is sensitive to remote objects, Hashcode, Equals, and Tostring. Create a remote object and export it (allowing them to utilize remote clients) by classes UnicastRemoteObject and Activatable. Subclasses can identify the semantics of remote references,

For example, the server is a simple remote object or an activable remote object (remote object that will be performed). The java.rmi.server.unicastRemoteObject class defines a single (single transmission) remote object, which is only valid when the server process is alive. Class java.rmi.activation.activatable is an abstract class, which defines the Activatable Remote object to start executing while its remote method is called and is shut down if necessary.

2.5 General rules for implementing the remote interface to implement the remote interface are as follows:

This class usually expands java.rmi.server.unicastRemoteObject, thus the remote behavior provided by the inherited java.rmi.server.RemoteObject and Java.rmi.server.Remotserver. This class can achieve any more remote interface. This class can expand other remote implementations. This class can define methods that do not appear in remote interfaces, but these methods can only be used locally and cannot be remote.

use. For example, the following class BankAcctimpl implements the BankAccount remote interface and expands java.rmi.server.unicastRemoteObject class: package mypackage;

Import java.rmi.remoteException; import java.rmi.server.UnicastRemoteObject;

Public Class BankAccountImpl Extends UnicastRemoteObject IMPLEments BankAccount

{private float balance = 0.0;

Public BankAccountImpl (Float InitialBalance) throws RemoteException {Balance = InitialBalance;

Public void deposit (float amount) throws remoteexception {...}

Public void withdraw (float amount) throws overdrawnexception, remoteexception {...}

Public float getBalance () THROWS RemoteException {...}}

Note: If necessary, the class that implements the remote interface can extends some other classes other than the Java.rmi.Server.UnicastRemoteObject class. However, it is necessary to assume a certain responsibility when the class is achieved, that is, the export object (responsible by the UnicastRemoteObject constructor) and implements the correct remote semantic (if needed) from the Java.LANG.Object class.

2.6 Remote Method Call Parameters Pass Parameters Passing to Remote Objects or returned values ​​from it can be arbitrary sequentially sequenceful Java objects. This package

Including Java basic types, remote? Java objects and non-remote Java objects for implementing java.io.serializable interfaces. See Java Object Series for How to make the class sequence

Specification. The class that is not available as a parameter or returned value can be dynamically downloaded via the RMI system.

How to download the parameters and return values ​​when the RMI read parameters, return values, and exceptions

See "Dynamic Class Load" (3.4) section.

2.6.1 Transfer Non-Remote Object Non-Remote Objects Transfer or as the result of the remote method call or as a result of the remote method call, is passed by copying; that is, serializing the object using the Java object serialization mechanism. Therefore, during the remote object call, when the non-remote object is passed as a parameter or return value, the content of the non-remote object will be copied before calling the remote object. When you return to a non-remote object from a remote method, you will create a new object in the called virtual machine.

2.6.2 Transfer Remote Object When the remote object is passed as a parameter or return value called by a remote method, the STUB program of the remote object is passed out. Remote objects that are passed as parameters can only implement remote interfaces.

2.6.3 Reference Integrity If one object's two references are passed from a virtual machine to another in a single remote method call (or return value) from a virtual machine to another, and they point to the same in the sending virtual machine. Objects, two references will point to the same copy of the object in the receiving virtual machine. To be further stated: In a single remote approach, the RMI system will maintain reference integrity in an object that calls parameters or returns.

2.6.4 Class Note When the object is sent from a virtual machine to another in the remote call, the RMI system is invisible to the class descriptor in the call stream in the call stream so that the class can be The receiver is loaded. During the remote method call, calls can be downloaded at any time. 2.6.5 Parameter Transfer To serialize the parameters called the RMI to the destination file of the remote call, you need to write this parameter into the stream of subclasses as the Java.io.ObjectOutstream class. The ObjectOutputStream subclass will override the ReplaceObject method, with its corresponding STUB class to replace each remote object. The object parameters will be written in the stream via the ObjectOputStream WriteObject method. ObjectOutputStream calls the ReplaceObject method for each write stream (the object included in the object) through the WriteObject method. RMIOBJECTOUTSTREAM subclass's replaceObject method returns the following value: If the object transmitted to ReplaceObject is a Java.rmi.Remote instance, return the Stub program of the remote object. The Stub program of the remote object is obtained by calling the java.rmi.server.RemoteObject.Tostub method. If the object that is transmitted to ReplaceObject is not a Java.rmi.Remote instance, only the object is returned. The ObjectOutputStream subclass of RMI also implements an AnnotateClass method, which uses a stream with a class of the class to download the class in the receiver. See "Dynamic Class Load" section for more information on how to use AnnotateClass. Because the parameters are only written to an ObjectOutputStream, the reference to the same object to the calling program will point to the same copy of the object there. On the receiver, the parameters will be read by a single ObjectInputStream.

All other default behaviors used to write objectOutputStream (similar to ObjectInputStream for reading objects) will remain in parameter delivery. For example, when writing to WriteReplace calls and read objects, the call to ReadResolve is completed by the parameter grouping and interdictility of the RMI.

Similar to the above RMI parameter transmission mode, return value (or abnormal) will be the same as the subclass of ObjectOutputStream and the alternative behavior of parameter transmission.

2.7 Location Remote Objects We specially provide a simple boot name server for storing a named reference to the remote object. The URL-based method using class java.rmi.naming can store remote object references. The client must call the remote object, you must first get the reference to the object. The reference to the remote object is usually obtained in the form of a return value in the method call. The RMI system provides a simple boot name server that obtains a remote object on a given host. Java.rmi.naming class provides methods based on a single resource locator (URL), used to bind, rebound, unlock and list names located on a host and port - object pairs.

?

?

?

RMI specification - Chapter 3

Topic: Stub and Skeleton Remote Method Calling Threads Using Remote Objects Garbage Collection Dynamic class loading through the proxy server through the firewall RMI

3.1 STUB and Skeleton In the communication process of remote objects, RMI will use standard mechanisms (for RPC systems): Stub and Skeleton. The Stub of the remote object acts as a client representative or agent role of a remote object.

The calling program will call the local STUB method, and the local Stub will be responsible for performing a square method for the remote object. In RMI, the STUB of the remote object is the same as the remote interface set implemented by the remote object. When you call the STUB method, the following will be performed:

Initialize the connection to a remote virtual machine containing a remote object. Multiple call results to solve the result method to solve the result of the returned value or the returned exception to the call to the call to the calling program to display the call to the calling program to the calling program to display a relatively simple call mechanism to the calling program. Serialization and network-level communications have hidden.

In a remote virtual machine, each remote object can have the corresponding SKELETON (Skeleton in a pure JDK1.2 environment). Skeleton is responsible for assigning calls to actual remote objects. It performs the following operations when the access method is received:

Decoding (read) The parameter of the remote method calls the actual remote object implementation method to group the result (return value or exception) group (write and transfer) to the calling program due to the JDK1.2 and the additional Stub protocol, make it There is no need to use Skeleton in pure JDK1.2 environments. Instead, you should use the general code instead of Skeleton in JDK1.1 to fulfill its duties. Stub and Skeleton are generated by the RMIC compiler.

3.2 Remote Method Calling The method of using the RMI runtime assignment to a remote object-implemented method may not be executed in a separate thread. The RMI runtime will not guarantee the mapping relationship of the remote object and the thread. Because the remote method call of the same remote object may be executed at the same time, the remote object implementation needs to make sure that its implementation is a thread.

3.3 Waste collection of remote objects is the same in the local system, and automatically deletes those remote objects that are no longer referenced by any client in the distributed system are satisfactory. This can free the programmer from tracking the remote object client in order to terminate. RMI uses a garbage collection algorithm similar to the Modula-3 network object (see May 1994 Digital Equipment Co., Ltd. System Research Center Technical Report 115 Birrell, Nelson and Owicki "Network Object").

To implement a reference count garbage collection, RMI is running to track all live references in each Java virtual machine. When an activity reference enters a Java virtual machine, its reference count will add 1. The "Reference" message will be sent to the server's server for the first time. This number will be reduced when the discovery activity reference is not referenced in the local virtual machine. When the last reference is given, the message that is not referenced will be sent to the server. There are many subtle things in the agreement, most of which are related to the order of maintenance references or uncolved messages, ensuring that objects are not prematurely collected.

When a remote object is not referenced by any client, the RMI is running a weak reference. If there is no other local reference to the object, the weak reference will allow the java virtual machine's garbage collector to abandon the object. The distributed garbage collection algorithm can be interactively interact with the local Java virtual machine's garbage collector with the local Java virtual machine.

As long as there is a local reference to the remote object, you cannot collect remote objects as garbage, and the remote object can also be transferred or returned in remote calls. Passing a remote object will also add the target virtual identifier to the referenced set. Remote objects that need not reference notifications must implement java.rmi.server.unreferenced interface. The unreferenced method will be called when these references no longer exist. When the reference set is discovered, unreferenced will also be called. Therefore, UNREFERENCED methods may be called multiple times. Remote objects can only be collected only if there is no local and remote references.

Note that if there is a network partition between the client and the remote server object, you may be collected, the remote object (because the transfer may be considered to be invalid). The remote reference will not guarantee the integrity of the reference because there may be premature collection. In other words, the remote reference can actually point to the object that does not exist. The RemoteExcepti ON that must be processed by the application will be thrown when using this class. 3.4 Dynamic Class Loading RMI Allows Parameters, Return Values, and Anomusions in the RMI call to any sequentialized object. RMI uses an object serial mechanism to transfer data from a virtual machine to another while calling the stream with the corresponding location information notes to load the class definition file on the receiving end. When the parameters and return values ​​called by the remote method are solved, all types of objects in the stream require class definitions when they become a valid object in the virtual machine. The solving process will first try to parse the name in the name of the context (current thread). RMI also provides a means of dynamically loaded as a class definition of a class definition of the actual object type transmitted by the parameter and the return value (the parameters of the remote method call and the return value come from the network location specified by the transfer end). This includes dynamic downloads of remote STUB classes - this class corresponds to any other type of other types transmitted by a specific remote object implementation class (for remote reference) and RMI calls, such as in the decoder's class loading context is not available. , A subclass of a declared parameter type.

To support dynamic class loading, the RMI runs should be used for grouping, solving RMI parameters, and returning groups, a specific java.io.ObjectOutputStream and Java.io.ObjectInputStream subclasses. These subclasses cover the AnnotateClass method of ObjectOutputStream and the RESOLVECLASS method of ObjectInputStream so that you can locate the class file exchange information that contains class definitions corresponding to the class descriptor.

For each class descriptor that writes the RMI group stream, the AnnotateClass method will call the class object to call Java.rmi.Server.rmiclassLoader.getClassanNotation to the stream. This result may be empty, or it may be a String object indicating the CodeBase URL path (separated by a space). With this CodeBase URL path, the remote endpoint can download the definition files given.

For each class descriptor read from the RMI group stream, the ResolVeclass method reads a single object from the stream. If the object is string (and the java.rmi.server.usecodebaseonly property is not true), resolveclass will return the result of calling the RMICLASSLOADER.LOADClass, and as the first parameter of the annotated String object, in the descriptor Class name as the second parameter. Otherwise, ResolVeclass will return the result of calling RMiclassLoader.LoadClass, and as a unique parameter with the desired class name.

See "RMICLASSLOADER Class" (5.6) section for more information on RMI.

3.5 RMI RMI transport layers through the proxy server through the firewall usually attempt to open the direct socket on the interface of the Internet. However, many intranet firewalls are not allowed to do so. Therefore, the default RMI transmission provides two HTTP-based mechanisms that make the clients after the firewall have a remote object method that resides outside the firewall.

3.5.1 How to Pack the RMI Call in the HTTP protocol through the firewall, the transport layer can embed RMI calls within the HTTP protocol of the firewall. When the RMI call data is sent as the main body of the HTTP POST request, the feedback information will return to the HTTP response main body. The transport layer can construct a POST request with the following two methods: 1. If the firewall proxy server can direct the HTTP request to the host's arbitrary port, the HTTP request will be forwarded directly to the port on which the RMI server is listening. The default RMI transport layer on the target computer can be listened by identifying and decoding the server socket called RMI calls within the POST request.

2. If the firewall proxy server can only direct the HTTP request to a known HTTP port, the call will be forwarded to the HTTP server that is listening over the host port 80, and will execute the CGI script to forward the target on the same computer. The call to the RMI server port.

3.5.2 Default Socket Factory RMI Transport Extension Java.rmi.Server.RmisocketFactory class to provide the default implementation of a socket plant as a client and server socket source provider. The default socket factory creates a socket to transparently providing a firewall channel mechanism, as shown below: The client sleeve text will automatically try to HTTP connection with the host that cannot contact the direct socket. The server socket will automatically detect if the newly received connection is HTTP POST request. If so, only the requested body is sent to the transport layer while the output format is converted to an HTTP response. The factory's java.rmi.server.rmisocketFactory.createsocket method will provide client-side sockets with this default behavior. The factory's java.rmi.server.rmisocketFactory.CreateSerVersocket method will provide server-side sockets with this default behavior.

3.5.3 Configuring the client does not require a special configuration, allow the client to send RMI calls through the firewall.

However, if the boolean value of java.rmi.server.disablehttp attribute is set to "True", the customer can disable the RMI call to the HTTP request.

3.5.4 Configuring Server

-------------------------------------------------- ---------------- Note - The host name should not be the host's IP address, because some firewall proxy servers do not transmit this host name. -------------------------------------------------- ------------

1. The server must be found in the server's client's approach to the client's remote object. Therefore, the remote reference of the server must contain the full name of the server host. This information can be used to run the server's Java virtual machine, depending on the server platform and network environment. If you are not available, you must specify the full name of the host through the java.rmi.rver.hostname property when starting the server. For example, you can start the RMI Server Class ServerImpl on chatsubo.javasoft.com:

Java -djava.rmi.server.hostname = chatsubo.javasoft.com serverImpl

2. If the server does not support the firewall, the RMI client can be transferred to the free port, you can use the following configuration: a. HTTP server listens on port 80. b. The location of the CGI script is the alias URL path

/ci-bin/java-rmi.cgi

This script: - Call the local Java interpretation program to perform the internal class of the transmitting layer that can be transmitted to the appropriate RMI server port. - In the Java virtual machine, the properties are defined in the same name and value as the CGI 1.0 environment variable. A sample script is provided in the RMI distribution version of Solaris and Windows 32 operating systems. Note that the script must specify the full path to the Java interpreter on the server. 3.5.5 Performance issues and limitations In the case where the proxy server is not considered, the transfer call from the HTTP request is at least a number of orders that are slower than the direct sleeve. Because the HTTP request can be initialized in one direction through the firewall, the host outside the firewall cannot call the client's method call, so the client cannot guide its own remote object to the firewall.

?

?

?

RMI specification - Chapter 4

The client interface programmer requires a visual interface available in the Java.rmi package when writing an Applet or application using a remote object.

4.1 Remote Interface

Package Java.rmi; Public Interface Remote {}

Java.rmi.Remote interface is used to identify all remote interfaces; all remote objects must implement this interface directly or indirectly.

Implementation class can achieve any number of remote interfaces and extend other remote implementations. RMI provides some remote object implementation that can be extended, which helps to create a remote object. These classes are java.rmi.server.unicastRemoteObject and java.rmi.activation.activatable.

For more information on how to define the remote interface, see the "Java.rmi.Remote Interface" (2.4.1) section.

4.2 RemoteException Class Java.rmi.RemoteException is many universal supercles related to communication when performing remote method calls. Each method in the remote interface (also an interface) must list RemoteException (or its superclars, such as java.ioException or java.lang.ioException) in its throws clause.

package java.rmi; public class RemoteException extends java.io.IOException {public Throwable detail; public RemoteException (); public RemoteException (String s); public RemoteException (String s, Throwable ex); public String getMessage (); public void printStackTrace (); public void printstacktrace (java.io.printStream PS); Public void PrintStackTrace (Java.io.PrintWriter PW);}

RemoteException can be constructed with detailed messages (ie s) and a nested exception (ie, ex, throwable). Nested exception EX is designated as a parameter in the third form of constructor, usually the basic I / O exception that occurs during the RMI call.

GetMessage method Returns an exception's detailed message, including the message in nesting exception (if any). The PrintStackTrace method will be overwritten in class java.lang.Throwable to print the neatly frequent stack tracking.

4.3 Naming class java.rmi.naming class provides storage and obtaining methods for reference to remote objects in the Remote Object Registration Server. The method in the Naming class is in the following form, Java.lang.String in the URL format as one of the parameters:

// Host: port / name where Host is the host (remote or local) of the registered service program, Port is the port number that the registration service is received, and the Name is a simple string that the registry is not explained. Host and Port are optional. If HOST is omitted, the host default is the local host. If you have omitted Port,

The port default value is 1099, that is, the "All" of the "Komelli" port used by the RMI system registration service RMIREGISTRY. The remote object binding name is a remote object associated or registered with a later use, which can be used to query the remote object. The remote object can be associated with the name using the BIND or Rebind method of the Naming class.

When the remote object has been registered (bind) on the local host with the RMI Registration Server, the caller on the remote (or local) host can query the remote object by name, then get a reference, and then call remotely on the object. method. When necessary, the server running on a host can share a registered service program. The servers can also create and use their own registered service (detailed, see the java.rmi.registry.locateRegistry.createRegistry method).

package java.rmi; public final class Naming {public static Remote lookup (String url) throws NotBoundException, java.net.MalformedURLException, RemoteExceptio n; public static void bind (String url, Remote obj) throws AlreadyBoundException, java.net.MalformedURLException, RemoteExce ption; public static void rebind (String url, Remote obj) throws RemoteException, java.net.MalformedURLException; public static void unbind (String url) throws RemoteException, NotBoundException, java.net.MalformedURLExce ptio n; public static String [] list (String URL) THROWS RemoteException, java.net.malformedurlexception;}} The Lookup method returns a remote object associated with the file part of the name. If the name is not bound to the object, throws notboundexception. The Bind method will bind the specified name to the remote object. If the name is bound to a certain object,

Then throw AlreadyBoundException.

The Rebind method always binds the name to the object, regardless of whether the name is bound. The original binding will be lost.

UNBIND methods will cancel the binding between names and remote objects. If there is no bind, throw the Notbound Exception.

The List method returns an array of String objects that contain snapshots that bind URLs in the registration service. In order to query its content list to the registration service program, only the hostname and port information on the URL; therefore, the "file" section of the URL will be ignored.

-------------------------------------------------- ---------------------------- Note - these methods may also throw java.rmi.accessException. AcceptException table shows privileges for specific operations. For example, only a local client on the host running a registration service program allows Bind, Rebind, and UNBIND operations. However, any non-local clients can be called to operate.

?

?

?

RMI specification - Chapter 5

The server interface java.rmi.server package contains interfaces and classes commonly used to implement remote objects.

Topic: RemoteObject Class RemoteServer Class UNICASTREMOTEOBJECT class unreferenced interface RMISecurityManager class RMICLASLOADER TOADERHANDLER interface RMI socket factory RMIFAILUREHANDLER interface logStream class stub and skeleton compiler

5.1 RemoteObject Class Java.rmi.Server.RemoteObject implements the java.lang.object behavior in the remote object. Implementation Methods HashCode and Equals will allow remote object references to store remote objects in the hash table. If the two Remote objects reference the same remote object, the return value of the method Equals is True. It is responsible for comparing remote object references for remote objects.

Method toString returns a string that describes the remote object. The content and syntax of the string are related to implementation and variable.

Other methods in java.lang.object retain their original implementation.

package java.rmi.server; public abstract class RemoteObject implements java.rmi.Remote, java.io.Serializable {protected transient RemoteRef ref; protected RemoteObject (); protected RemoteObject (RemoteRef ref); public RemoteRef getRef (); public static Remote Tostub (java.rmi.remote obj) throws java.rmi.nosuchobjectException; public int hashcode (); public boolean equals (object obj); public string toString ();

Because RemoteObject is an abstract class, it cannot be instantiated. Therefore, the constructor of RemoteObject must be called from the subclass implementation. The first RemoteObject constructor will create RemoteObject with an empty remote reference. The second RemoteObject constructor will create RemoteObject that belts REF with a deficity of the definition.

Method GetRef returns a remote reference of the remote object.

Method TOSTUB returns a STUB of remote object OBJ and transmits it as a parameter. This operation is only valid only after it has exported the remote object implementation. If you can't find Stub's stub, this method throws NosuchObjectException.

5.1.1 RemoteObject Class Object Method Java.lang.Object Class For Method Equals, HashCode, and Tostring's default implementation is not available for remote objects. Therefore, the RemoteObject class provides these methods more suitable for remote objects in semantics.

Equals and HashCode methods To use the primary key in the hash table, we must override the Equals and HashCode methods in the remote object implementation, which is overwritten by class java.rmi.server.RemoteObject: java.rmi.server. The RemoteObject class implements the equals method determines whether the references of the two objects are equal, rather than whether the contents of the two objects are equal. This is because it is necessary to determine if the content is equal.

Remote method calls, and Equals' signing does not allow throwing distant exceptions. For all remote references for all references to the same bottom remote object, the HashCode method implemented by the java.rmi.server.RemoteObject class returns the same value (because reference to the same object is considered equal

of).

The toString method The toString method is defined as a string that returns a remote reference to the object. The content of the content of the string is specified. The currently implemented an object identifier (such as a host name and port number) of the object identifier (such as host name and port number) related to the single object identifier (such as host name and port number) related to the transport layer.

The Clone method can only be replicated with the default mechanism of Java language when the object supports java.lang.cloneable interface. The stub of the remote object generated by the RMIC compiler will be declared as the final, and the cloneable interface is not implemented, so the Stub cannot be copied.

5.1.2 Serialized Form RemoteObject Class implements a special (private) method WriteObject and method ReadObject, which are serially serialized by the object serialization mechanism to process serialized data from java.io.objectOutputStream. RemoteObject serialized form written by the following methods: private void writeObject (java.io.ObjectOutputStream out) throws java.io.IOException, java.lang.ClassNotFoundException; RemoteObject if the remote reference field ref is null, then the method throws Java.rmi.marshalexception. If the remote reference REF is non-empty: REF class is obtained by calling its getRefClass method, the method usually returns a non-package full name of the remote reference class. If the returned class name is non-empty: REF's class name will be written in the UTF format.

Method WriteExternal, the passing parameter is the stream OUT, so that the REF can write its external representation to the stream.

If the class name returned by Ref.getRefClass is empty: write a UTF format in the stream OUT.

The REF is serialized to the stream OUT (ie using WriteObject). When serialization recovery, the status of RemoteObject will be reconstructed by the ObjectInputStream calling this method to use its serialization:

Private void readObject (java.io.objectInputstream in) throws java.io.ioException, java.lang.classNotFoundException

First, the REF's class name (UTF string) is read from the stream in. If the class name is empty string: The object is read from the stream, and then the REF is initialized to this object (ie, by calling in.readObject) if the class name is non-empty: REF's full class name is string Java.rmi The value of .server.Remoteref.PackagePrefix is ​​connected to the class name read from the stream. Create an instance of the REF class (using the above full class name). This new instance (becoming a REF field) reads its external form from the stream in. 2 RemoteServer class java.rmi.server.RemoteServer class is the server implementation class java.rmi.server.UnicastRemoteObject and java.rmi.activation.actiVatable general superclars.

Package java.rmi.server; Public Abstract Class RemoteServer Extends RemoteObject {

protected remoteserver (); protected remote (RemoteRef Ref);

Public static string getClientHost () throws serverNotactiveException; public static void setlog (java.io.outputstream out); public static java.io.PrintStream getLog ();

Because RemoteServer is an abstract class, it will not be instantiated. Therefore, the constructor of a RemoteServer must be called from the subclass implementation. The first RemoteServer constructor will create RemoteServer with an empty remote reference. The second RemoteServer constructor will create RemoteServer with a de-reference refer to REF.

The GetClientHost method allows an activity method to determine which host is initialized by the remote method of the current thread. If there is no remote method in the current thread, throw an exception serverNot ActiveException. SetLog Method records the RMI call to the specified output stream. If the output stream is empty, close the call log. The getLog method returns the RMI call log stream so that the application-specific information is written in the call log.

5.3 UnicastRemoteObject Class Class Java.rmi.Server.UnicastRemoteObject supports creation and exporting a remote object. The remote server objects implemented by this class have the following features:

References to this object are valid only within the process of creating the remote object. Communication with remote objects via TCP. Call, parameters, and results communicate between clients and servers using flow protocols. Package Java.rmi.server; Public Class UnicastRemoteObject Extends RemoteServer {

protected UnicastRemoteObject () throws java.rmi.RemoteException; protected UnicastRemoteObject (int port) throws java.rmi.RemoteException; protected UnicastRemoteObject (int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws java.rmi.RemoteException; public Object clone () throws java .lang.CloneNotSupportedException; public static RemoteStub exportObject (java.rmi.Remote obj) throws java.rmi.RemoteException; public static Remote exportObject (java.rmi.Remote obj, int port) throws java.rmi.RemoteException; public static Remote exportObject (remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws java.rmi.RemoteException; public static boolean unexportObject (java.rmi.Remote obj, boolean force) throws java.rmi.NoSuchObjectException;} 5.3.1 configured new remote object Remote object implementation (implementation of one or more remote interfaces) must be created and exported. Export a remote object allows objects to accept calls from the client. As a remote object exported by UnicastRemoteObject, its export involves listening to the TCP port (note that multiple remote objects can accept the arrival of the same port, so there is no need to listen over the new port). Remote object implementation can extend class UnicastRemoteObject to export the constructor of the object, or extend other classes (or do not expand) and export objects through the unicastRemoteObject method.

The parametric constructor will create a remote object and export on an anonymous (or arbitrary) port, and this will be selected during operation. The second form of constructor belt a single parameter (ie Port), which specifies the port number of the call to the call to accept. The remote object created by the third constructor accepted the call accepted by RMISERVERSOCKETFACTORY; the client established a connection with the remote object by the Socket provided by RMICLIENTSOCKETFACTORY.

5.3.2 Export is not intended to be extended by RemoteObject (any form) available to export simple peer remote objects that are not implemented by extended UnicastREMoteObject classes. The first form of ExportObject method with a single parameter (ie OBJ), which is a remote object that is accepted by the RMI call; the ExportObject method exports the remote object on anonymous (or arbitrary) port, which will be selected at runtime. The second form of ExportObject method is two parameters, which are remote objects OBJ and Port. Port is the port number that the remote object accepts the call. The third ExportObject method uses the specified RMICLIENTSOCKETFACTORY, CSF, and RMISERVERSOCKETFACTORY, SSF exports object OBJ on the specified port. Before passing the RMI call as a parameter or return value, the object must be exported, otherwise it will throw java.rmi.server.stubNotFoundException when trying to pass the "unidentified" object as a parameter or return value to a remote call. After the export, the object can be incorporated into the RMI call as a parameter, or the result of the RMI call is returned. EXPORTOBJECT method Returns Remote STUB. It is the Stub object of the remote object, which will replace the remote object into the RMI call. 5.3.3 Deliver UnicastRemoteObject in the RMI Call As described above, the object will be replaced by the STUB of the remote object when the object of the type UnicastRemoteObject is incoming the RMI call as a parameter or return value. Remote object implementation is reserved in a virtual machine that creates it and does not remove (including its value). In other words, the remote object is incorporated into the RMI call by reference; the remote object implementation cannot be passed through the value.

5.3.4 Serialization UNICASTREMOTEOBJECT If the object of the UnicastRemoteObject type is written to the user-defined ObjectOutputStream For example, the object is written to the serialized file), then the information contained therein will be transient and not saved. However, if the object is a UNICASTREMOTEOBJECT subclass example, it can save non-transitory data and can be saved when serialized.

When UNICASTREMOTEOBJECT is read from ObjectInputStream, it will automatically export to RMI runtime to receive RMI calls. If the export fails due to some reason, the serialized recovery object process will be terminated while throwing an exception.

5.3.5 Reverse UnicastRemoteObject UNEXPORTOBJECT method makes the remote object OBJ unacceptable calls. If the forced parameter is true, the remote object will still be enforced out even if there is a tolerance call or the current call to the remote object. If the forced parameter is false, the object is only reversed only when there is no pending call to the object and the current call. If the object is successfully directed, the object will be removed from the internal table. Reverse objects in this mandatory manner may result in an expiration remote reference of the client holds the remote object. If the remote object is not exported to the RMI runtime, the method will throw an exception java.rmi.nosuchobjectException.

5.3.6 Clone methods Only objects that support the Java.lang.cloneable interface can be replicated using the default mechanism for Java language. Class Java.rmi.Server.UnicastRemoteObject does not implement the interface, but it implements the Clone method to make the remote object can be customized correctly when the subclass needs to implement Cloneable. The Clone method can be used by subclasses to create remote objects of the same copy of the initial content. However, it can be derived to receive remote calls and vary from the original object. 5.4 unreferenced interface package java.rmi.server; public interface unreferenced {public void unreference ();

Java.rmi.server.unReferenced Interface Allows the server object notification, telling it that there is no client to remotely reference it. Distributed garbage collection mechanism will maintain a holder for each remote object

Customer virtual machine collection of procedures. As long as a client holds a remote reference of the remote object, the RMI is saved to save the local reference of the remote object. When the "reference" collection is empty,

UNREFERENCED.UNREFERENCED method (if the server implements the unreferenced interface). Remote objects do not need to support unreferenced interfaces. As long as there is a local reference to the remote object, it can pass or return to the client in the remote call. Receiving the reference process will be added to the reference collection of the remote object. When the reference collection is empty, the unreferenced method of the remote object is called. In this way, the unreferenced method can make multiple calls (each time the collection is empty). The remote object is collected when there is no longer a reference (a reference to the client holding).

5.5 RMISecurityManager class package java.rmi;

Public class rmisecuritymanager extends java.lang.securityManager {public rmisecurityManager (); public synchronized void checkckageAccess (String Pkg) THROWS RMISECURITYXCEPTION;}

RMISecurityManager provides the same security features as Java.lang.securityManager, but it covers the CheckPackageApass method.

In the RMI application, if the security manager is not set, STUB and classes can only be loaded from the local path. This ensures that the application is not infringed by the code downloaded by the remote method.

5.6 RMICLASSLOADER Java.rmi.Server.miclassLoader class provides a common static method for supporting network-based type load based on network-based classes in RMI. These methods are called by the internal grouping stream of RMI to implement dynamic classes of RMI parameters and return value types. However, in order to simulate the RMI's class loading behavior, it can also be called directly by the application. The RMICLASSLOADER class does not have a construction function that can be accessed, so it is not instantiated.

Package java.rmi.server;

public class RMIClassLoader {public static String getClassAnnotation (Class cl); public static Object getSecurityContext (ClassLoader loader); public static Class loadClass (String name) throws java.net.MalformedURLException, ClassNotFoundException; public static Class loadClass (String codebase, String name) throws java.net.MalformedURLException, ClassNotFoundException; public static Class loadClass (URL codebase, String name) throws java.net.MalformedURLException, ClassNotFoundException;} getClassAnnotation method will return a String, String that represents the network codebase path, this path download remote endpoints Specify the definition of the class. The String object returned by the method is used as an annotation of the type descriptor using the String object returned by the method when the RMI is running. The format of the CodeBase string is the CodeBase URL string path defined by the space. The returned CodeBase string will depend on the class loader that provides the class:

If the class loader is one of the following: "System Class Loader" (used to load the class specified in the application "Class Path" and returned from the method ClassLoader.getsystemClassLoader), the parent of the "System Class Loader" Class, such as class loaders for installation methods, null values ​​(used to load "self-intended loaders") of the virtual machine class), and return the value of the java.rmi.server.codebase property. The return value is NULL if the property is not set. Otherwise, if the class loader is an instance of class java.net.urlclassLoader, the returned CodeBase string is a list of URLs in an external form of space, which is loaded by the call class.

The getURLS method on the device returns. If the URLClassLoader creates a call to serve a RMICLASSLOADER.LOADCLASS method when running by the RMI, you can get the relevant CodeBase string without any license. If it is an arbitrary URLClassLoader instance, the calling program must have permissions to connect all the URLs in the CodeBase path, call OpenConnection () on each URL instance returned by the getURLS method. GetPermission () to determine the permission. Finally, if the class loader is not an instance of the URLClassLoader, the java.rmi.server.codebase property value is returned, and NULL is returned if the attribute value is not set. Because the GetSecurityContext method is no longer applicable to the JDK1.2 security model, it is not encouraged to use it; it is used for JDK1.1, used to implement a security check based on class loader. If specified

The class loader is created by the RMI runtime to serve the call to serve a RMICLASSLOADER.LOADCLASS method, then return the first URL in the class loader CodeBase path; otherwise returns NULL.

All three loadClass methods are attempted to load the internal URLClassLoader using the specified name to load classes and load internal URLClassLoader with a specified name and load internal to a specific CodeBase path when feature security manager: LoadClass with a parameter (class name). Method implicitly uses the java.rmi.server.codebase property value as the CodeBase path. We do not encourage the use of the LoadClass method because we no longer encourage the use of java.rmi.server.codebase properties. Users should use the following more versions. LoadClass method with string codebase parameters uses it as a CodeBase path; the CodeBase string must be the same URL list in which the space interval and the getClassanNotation method returned. LoadClass method with java.net.url codebase parameters uses a single URL as CodeBase. For all LoadClass methods, the CodeBase path will be used with the context-based loader of the current thread (by calling getContextClassLoader on the current thread) to determine the internal class loader instance of the class. The RMI runtime will maintain an internal class loader instance table, as the CodeBase path of the parent class loader and the loader (a ordered URL list) as the key value. The LoadClass method queries the URLClassLoader instance in the table with the desired CodeBase path and the context loader of the current thread. If there is no this loader, you will create one and add it to the table. Finally, the loadClass method will be called with the specified class Name on the selected class loader.

If you have a security manager (System.GetSecurityManager does not return null), the loadclass call program must have permissions to connect to all URLs in the CodeBase path. Otherwise it will throw an exception ClassNotFoundException. To prevent untrusted code from being loaded into a Java virtual machine without a security manager, all loadClass methods should ignore specific CodeBase paths without setting the security manager, and only load the current thread context-based loader Specify the class of Name in the middle.

5.7 LoaderHandler interface package java.rmi.server;

Public interface loaderhandler {

Class loadClass (String name) throws MalformedURLException, ClassNotFoundException; Class loadClass (URL codebase, String name) throws MalformedURLException, ClassNotFoundException; Object getSecurityContext (ClassLoader loader);}

-------------------------------------------------- ------------ Note - JDK1.2 does not encourage the loaderhandler interface. -------------------------------------------------- ------------ The LoaderHandler interface is implemented only by the internal RMI of JDK1.1.

5.8 RMI Socket Factory When the RMI runtime requires an instance of java.net.socket and java.net.Net.Net.Net.Serversocket to connect, it is not directly instantigating the objects of these classes, but is in the current RMisocketFactory object (this object) The Createsocket and CreateServersocket methods are returned by static methods RMISOCKETFACTORY.GETSOCKETFACTORY. This will enable the application to define the socket type used by the RMI transmission, such as the subclass of Java.Net.Socket and Java.Net.Serversocket classes. The RMISOCKETFACTORY examples used can be set once by trusted system code. In JDK 1.1, this customization is limited to a relatively global decision of the socket type because the parameters supplied to the factory method are only hosts and ports (for createSocket) and port numbers (for CREATSERVERSOCKET). In JDK 1.2, we introduced new interface RMISERVERSOCKETFAACTORY and RMICLIENTSocketFactory, which can be more flexible to customize protocols used with remote object communication.

To make the application using RMI can use these new socket factory interfaces, we add several new constructors and ExportObject methods in UnicastRemoteObject and Java.rmi.ActiVation.Activatable, which uses clients and server sockets. The factory is an additional parameter.

Remote objects exported by new constructors or ExportObject methods (with RMICLIENTSOCKETFACTORY and RMITSOCKETFACTFACTORY) will be taken by RMI runtime. During this life period of this remote object, running RMISERVERSOCKETFAACTORY to accept calls to accept calls to remote objects, simultaneous use of custom RMICLIENTSocketFactory to connect to clients and remote objects.

RemoteRef and ServerRef implemented by remote objects exported by custom socket factories are UnicastRef2 and UnicastServerRef2. The UnicastRef2 type line representation contains a representation of contact "endpoint" different from the UnicastRef type (only a hostname string in a UTF format, and is represented by a integer port number). For UnicastRef2, the line represents the line representation of a format byte to specify the remainder of the endpoint (allowed future expansion), followed by the specified format. Currently, these data can include host names, port numbers, and optional (specified by endpoint format bytes) RMICLIENTSOCKETFACTORY object serialization representation. It can be used by a client to generate a socket connection to a remote object at that endpoint. The endpoint represents the RMISerVersocketFactory object specified when the remote object is exported.

When the CreateSocket method is used, the CreateSocket method of the RMICLIENTSOCKETFAACTORY object is used when creating a socket connection through the UnicastRef2 type. Similarly, when the DGC "Dirty" and "Clean" calls are performed at runtime, it must call the DGC on the remote virtual machine, and the method is generated using the same RMICLIENTSOCKETFACTORY object specified in the remote reference. The server-side DGC implementation should be responsible for the verification result. If the remote object is exported by the old constructor or UnicastRemoteObject, the remote set factory is exported as a parameter, and it has the previously unicastref and unicastserverref type Remoteref and ServerRef, and its endpoint will also use the vintage line. That is, a host string in a UTF format follows an integer of a specified port number. Such a RMI server that does not use JDK 1.2 new features can interoperate with the old RMI client.

5.8.1 RMisocketFactory class java.rmi.server.rmisocketFactory Abstract class provides an interface to specify how to get a socket in the transfer. Note, the following class uses the Socket and Serversocket in the java.net package.

Package Java.rmi.Server; Public Abstract Class RmisocketFactory Implements RpacelientSocketFactory, RMISERVERSOCKETFAACTORY {

public abstract Socket createSocket (String host, int port) throws IOException; public abstract ServerSocket createServerSocket (int port) throws IOException; public static void setSocketFactory (RMISocketFactory fac) throws IOException; public static RMISocketFactory getSocketFactory (); public static void setFailureHandler (RMIFailureHandler fh Public static rmifailurehandler getfailurehandler ();

Static Method SetsocketFactory can be used to set up a socket factory, while RMI will get a socket from it. The application can only call this method once with its own instance RMisocketFactory. For example, the application-defined RMisocketFactory implements some basic filtration and throw an exception on the required connection, or returns its extension to java.net.socket or java.net.serversocket classes (for example, providing expansion of security channels) . Note that RMisocketFactory can only be set when the current security manager allows the setup factory to be set. If this setting is not allowed, SECURITY Exception will be thrown.

Static method GetSocketFactory returns a socket factory used by RMI. If the socket factory is not set, the return value is NULL.

When the transmission needs to create a socket, the transport layer will call the Createsocket and CreateServersocket methods to RMISOCK ETFActory returned by the GetSocketFactory method. E.g:

RmisocketFactory.getsocketFactory (). CreateSocket (MyHost, myport) method createSocket should create a client set to the specified Host and Port. The C ReateServersocket method should create a server socket on the specified port.

The default RMisocketFactory Transfer implementation uses HTTP to provide transparent RMI through the firewall, as described below:

In Createsocket, the factory will automatically attempt to establish an HTTP connection with a host that cannot contact with a socket. In CreateSerVersocket, the factory will return server sockets for automatically detecting whether the newly accepted connection is an HTT P POST request. If so, returns only a socket that is only transparently displayed to the transfer to the transmission, and the output is formatted as an HTTP response. Method SetFailureHandler Sets the failure handle. When creating a server socket failure, the handle will be called by the RMI runtime. This handle returns a Boolean value for indicating whether it should be retryed. The default failure handle return value is false, which means that you will no longer try to create a socket when it is runtime.

Method GetFailureHandler returns the current handle when the socket creation fails. The failure handle will be NULL when it is not set.

5.8.2 The RMISERVERSOCKETFACTORY interface provides a RMISE RVERSOCKETFACTORY instance to support custom communications with remote objects. This can be done by the corresponding UnicastRemoteObject constructor or the ExportObject method, or by the corresponding java.rmi.activation.activat Aable constructor or the exportObject method. If the server socket is associated with it when exporting a remote object, the RMI runs the server socket factory using the remote object to create a SE RVERSERSERSERSERVERSOTFAACTORY.CREATSERVERSERVERSOCKET method to connect to a remote client.

Package java.rmi.server; public interface rmiserversocketfactory {

Public Java.Net.Serversocket CreateServersocket (INT Port) THROWS IOException;

5.8.3 RMICLIENTSOCKETFACTORY Interface To customize communication with the remote object, the remote object can specify an instance of RMICLIENTSOCK ETFACTORY when exporting. This can be done both through the corresponding UNICASTREMOTEOBJECT constructor or the ExportObject method, or through the corresponding java.rmi.activation.activatable constructor or the ExportObject method. If the client sleeve texture is associated with the remote object, the client sets will be downloaded to a remote virtual machine with a reference to the remote object. Subsequently, the RMI running will use the RMICLIENTSOCKETFACTORY.CREATESOCKET method to establish a connection from the client to the remote object.

Package java.rmi.server; public interface rmiclientsocketFactory {public java.net.socket createsocket (String host, int port) throws ooException

5.9 RMIFAILUREHANDLER Interface Java.rmi.Server.RmifailureHandler interface provides a way to specify how the server socket is specified when the RMI runtime responds (unless the object is exporting). Package java.rmi.server;

Public interface rmifailurehandler {public boolean failure (Exception ex);

The Failure method will be called when an exception is created when the RMI is created. If you try to try again, the method returns value true; otherwise it will return false.

Before calling this method, you need to register the failure segment by calling the RMisocketFactory.setFailureHandler. If the handle is not set, the RMI is waiting for a while to try again after trying to create a ServerSock ET.

Note that if the ServerSocket fails when the SERVERSOCKET fails, RMIFAILUREHANDAL will not be called. When Serversocket accepts the request to fail, Create the Serve RSocket, then call RMIFAILUREHANDALER.

5.10 Logstream class logStream provides a mechanism for recording errors. People who monitor the system may be interested in these errors. This class is used inside for log server calls.

Package java.rmi.server;

public class LogStream extends java.io.PrintStream {public static LogStream log (String name); public static synchronized PrintStream getDefaultStream (); public static synchronized void setDefaultStream (PrintStream newDefault); public synchronized OutputStream getOutputStream (); public synchronized void setOutputStream (OutputStream OUT; Public Void Write (INT B); Public Void Write (Byte B [], INT OFF, INT LEN; public string toString (); public static int parselavel (string s); // log level constant public static final INT Silent = 0; public static final int brief = 10; public static final int verbose = 20;}

-------------------------------------------------- ---------------------------- Note -JDK1.2 does not encourage logstream class --------- -------------------------------------------------- ----------------------

The method log returns the logStream that is identified by a given name. If the log corresponding to a name does not exist, create a log that uses the default stream.

Methods GetDefaultStream returns the current default stream for the new log.

Method SetDefaultStream Sets the default stream for the new log.

Method GetputStream returns the stream output to the current log.

Method SetOutputStream Sets the output stream of the log.

The first form of method WRITE will write one byte data. If it is not a new line, the byte will be added to the internal buffer. If it is a new row, the rows in the current buffer will be sent to the log's output stream in the corresponding log prefix. The second form of method WRITE will write a write anniode array. Method TOSTRING returns a log name in a string.

Method Parsevel converts the character string name of the log level to internal integer representation.

5.11 Stub and Skeleton Compiler RMIC's Stub and Skeleton compilers are used to compile the corresponding Stub and Skeleton for specific remote objects. The compiler will call a full name of the class of the remote object class. This class must be compiled successfully before.

The location of the introduction class is specified by the environment variable classpath or parameter -classpath. Compiling class files will be placed in the current directory unless specified parameter -D, otherwise compiling class files will be placed in the current directory. Parameters - KeepGenerated (or -keep) Reserves the generated Java source file for Stub and Skeleton. You can also specify the version of the Stub Protocol: - -v1.1 Create a STUB / SKELETON--VCompat (JDK 1.2 is default) Create a STUB / SKELETON that is compatible with the JDK 1.1 and 1.2 Stub Protocol version. - -v1.2 Create stub (note, no SKELETON) only in accordance with JDK 1.2 Stub Protocol version

-show option Displays a graphical user interface. Most javac command line parameters can be used (except) and can be used with RMIC: - -g Generate debugging information - -depend repeated compile expired file - -NowarNo does not generate a warning message - -verbose outputs the compiler Action message - -classpath Specifies the location of the search input source and class files - -d specifies the location of the generated class file - -j Passage to the Java interpreter

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

New Post(0)