1.What is the method that is used by the RMI client to connect to remote RMI servers?RMI is known as Remote method invocation and to for the RMI client to connect to remote RMI server first thing is to get hold on a reference of the server. 2.What is the function of java.net.UnknownHostException?The java.net.UnknownHostException method is used as remote calling and for callback routine fail. RMI uses default settings to resolve the server hostname like WINS names, DHCP names, etc. This happens due to which RMI client invokes the remote method using the reference that consists of unresolved server hostname and the client will produce UnknownHostException. RMI servers provide fully qualified hostname or IP address to resolve all RMI clients error reports. RMI provides an operation to remotely callback a program that serves RMI object and provide resolvable hostname to pass it to the RMI clients. UnkownHostException is thrown when an applet is failed to provide a useable server hostname. The property java.rmi.server.hostname can be set to get from the server the correct IP address or hostname. 3.What are the reasons of getting UnknownHostException error even if all the setting are properly configured?The UnkownHostException error can come for many reasons. To find out first there is a need to know the network's name service that is having a fully-qualified hostname recognized by RMI host. The possible problems that might come are: 4.What is the use of HTTP-tunneling in RMI?HTTP-Tunneling is a method that requires no setup and works within the firewall environment. It allows the handling of HTTP through proxy server and doesn't allow regular outbound TCP connections. If the RMI fails to make any connection specially SOCKS then connection is made through an intended server that allow the HTTP proxy server to be configured. This will allow the request to be passed through the proxy server one by one. The forms of HTTP-tunneling are http-to-port: where the RMI attempt to use HTTP POST request using a URL that will be directed at the hostname and port number of the server that is given. If the proxy accepts the URL it will forward a POST request to listen to RMI server that will remove the request of the name. There is an http-to-cgi tunneling that will consists of the requests and allow the proxy request to be binded to their defined port numbers. 5.How does distributed garbage collectior manges the disconnections detected on the client side?RMI uses a runtime client that a virtual machine detects of the remote object that is not referenced locally. It notify the server in came of any disconnections and this way the server can be updated by the object's set. The garbage collector that is distributed associate an address with each client remote object reference. It also renew the remote objects while the client still consists of the references. This mechanism will allow the abnormal termination of the clients so that server can hold the remote objects that are not referenced using the message that are stopped running. The function System.exit() can be invoked for abnormal termination, as it doesn't allow the RMI runtime to send a proper messages to the server. This function will terminate the client virtual machine and will keep the remote references that will be cleaned up before exiting. The other functions that are used for this are: System.gc();
System.runFinalization(); 6.What is the relationship between the RMI and CORBA?RMI is a distributed object system that provides and enable to easily develop the distributed Java applications. It is easier to develop applications using the RMI method then using the sockets. It doesn't require any protocol for design that makes it less prone to error for the tasks performed by it. RMI is allows the local method to be called from a local class file and the remote methods are interpreted and are sent back to the callers. The CORBA also having the same features that are seen in RMI. It is a platform and language independent architecture that can be run on any platform. It can be located from anywhere on the network and can be used in any language that has a mapping with IDL (Interface definition language). The objects of this are specified with interfaces that are specified in the interface language. 7.What are the different terms that are used in RMI?There are different terms that are used in RMI that helps in calling the remote servers and allow an easy to use terminology to be created: 8.What are the different types of classes that are used in RMI?The classes define the blueprint that consists of the methods and behavior of a particular structure. 9.What are the different conditions that has to be kept in mind when using serialization concept?The conditions that has to be kept in mind while using serialization is that:
10.What is the process of making a class serializable?To create a class serializable there is mechanism of serializing an object on the client code.
11.What is the procedure of implementation of the Serializable Interface?The implementation is the easy phase of the serializable class. At first this interface remains as an empty interface and it declares no methods or behavior at all. It has additing feature that is added to the implements serializable class to follow the class declarations. It is not required to make every object as serializable as there will also be some classes that might not be having any serialization required.
12.What is the main purpose of Distributed object applications in RMI?RMI consists of a server and a client program. The application in RMI creates a number of remote objects that makes the references to the objects that are to be accessible. This way when a client makes a call to the method on remote objects then the reference is passed to one or more remote objects in server. It then invokes certain methods on them to provide few functionalities. RMI provides the mechanism to communicate and pass the information from one part to another using the distributed object applications. It requires to locate the remote objects so that the registry can be maintained for the remote objects with RMI's naming facility, rmiregistry, and the application that can pass the remote object references and return it as a normal operation. 13.How does the communication with remote objects occur in RMI?RMI handles the remote objects that are being provided between the server and client computers. The difference between the objects are handled using RMI as well. RMI uses the standard method invocation to communicate between one object or another object. It loads the class byte-codes for objects that are passed using the defined parameters and return the values to the server in case of failure or success of it. RMI also allows the transmission to be done when passing the data as well. The string that is used by the RMI registry is “rmi://hostname:port/remoteObjectName", this allows the RMI registry to know the correct object and create a connection between different objects through this. If the hostname is not defined then local host can be used instead of it and this will also establish the connection 14.What are the steps that are involved in RMI distributed applications?RMI distributed applications uses certain steps that defines the path mentioned in the registry. It has the following steps: 15.What is the use of java.rmi.Remote Interface in RMI?RMI uses a remote interface declaring the methods that are invoked from a virtual machine and further forwarded to the server to take any request coming from the client. 16.Write a program to show the remote interface using RMI?Remote interface allows the extension of the interface of java.rmi.Remtoe. {
The class of this extends the java.rmi.Remote to inherit the behavior and properties used by this specified class.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; } This also uses several other class objects for example: java.rmi.server.RemoteObject and
java.rmi.server.RemoteServer. 17.Write a program to show the distributed object model using RMI.To implement the distributed object model a class is required that implements a remote interface extending the functionality of java.rmi.Remote and other classes such as java.rmi.server.UnicastRemoteObject.
// write your own statements
} public float getBalance() throws RemoteException { // write your own statements } 18.Why are stubs used in RMI?RMI uses a mechanism that is standard for all the system and it is used to communicate with all the remote objects that are available. So, stubs are used to store the objects in the database so that it can be used later on. A stub is used for remote objects that act as a client’s local proxy for the remote object. This way the caller of the object calls the method on the local stub that becomes responsible to carry out the method call on the remote objects. RMI uses stub for a remote object that implements the same set of remote interfaces that is implemented by remote object. The stub is used to initiate the connection between the object and the java virtual machine. It marshalls that includes write and transmit the parameters to the remote java virtual machine that includes the method invocation. It allows the unmarshalling of the object to return the true value or the exception to be returned to the caller. The stub is used to hide the serialization of the parameter at network-level for the communication to be proceeded without any disturbance. 19.Why is the function or role of skeleton in RMI?Every object that can be remotely accessed have a corresponding skeleton that functions like the original object. It is responsible for dispatching the call that is made to the actual remote object for the implementation and allow it to be implemented using the services provided by RMI. It allows the incoming method invocation to unmarshals i.e. only read the parameters used for the remote method. It invokes the method that is used by the actual remote object and after implementation marshals the result to the caller who is the original caller for the object. 20.How does dynamic class loading happens in RMI?RMI uses different parameters with values and exceptions and they all has to be passed for RMI calls. It creates the object that is serializable. |