RMI Interview Questions And Answers
Download RMI Interview Questions and Answers PDF
Enhance your RMI interview preparation with our set of 21 carefully chosen questions. Our questions cover a wide range of topics in RMI to ensure you're well-prepared. Whether you're new to the field or have years of experience, these questions are designed to help you succeed. Download the free PDF to have all 21 questions at your fingertips. This resource is designed to boost your confidence and ensure you're interview-ready.
21 RMI Questions and Answers:
RMI Job Interview Questions Table of Contents:
1 :: What is Java RMI?
Remote Method Invocation (RMI) is the process of activating a method on a remotely running object. RMI offers location transparency in the sense that it gives the feel that a method is executed on a locally running object.
Read More2 :: What are the layers of RMI Architecture?
The RMI is built on three layers.
a. Stub and Skeleton layer
This layer lies just beneath the view of the developer. This layer intercepts method calls made by the client to the interface reference variable and redirects these calls to a remote RMI service.
b. Remote Reference Layer.
This layer understands how to interpret and manage references made from clients to the remote service objects. The connection is a one-to-one (unicast) link.
c. Transport layer
This layer is based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.
Read Morea. Stub and Skeleton layer
This layer lies just beneath the view of the developer. This layer intercepts method calls made by the client to the interface reference variable and redirects these calls to a remote RMI service.
b. Remote Reference Layer.
This layer understands how to interpret and manage references made from clients to the remote service objects. The connection is a one-to-one (unicast) link.
c. Transport layer
This layer is based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.
3 :: What is the basic principle of RMI architecture?
The RMI architecture is based on one important principle: the definition of behavior and the implementation of that behavior are separate concepts. RMI allows the code that defines the behavior and the code that implements the behavior to remain separate and to run on separate JVMs.
Read More4 :: How many types of protocol implementations does RMI have?
RMI has at least three protocol implementations:
Java Remote Method Protocol(JRMP), Internet Inter ORB Protocol(IIOP), and Jini Extensible Remote Invocation(JERI). These are alternatives, not part of the same thing, All three are indeed layer 6 protocols for those who are still speaking OSI reference model.
Read MoreJava Remote Method Protocol(JRMP), Internet Inter ORB Protocol(IIOP), and Jini Extensible Remote Invocation(JERI). These are alternatives, not part of the same thing, All three are indeed layer 6 protocols for those who are still speaking OSI reference model.
5 :: Does RMI-IIOP support dynamic downloading of classes?
No, RMI-IIOP doesn't support dynamic downloading of the classes as it is done with CORBA in DII (Dynamic Interface Invocation).Actually RMI-IIOP combines the usability of Java Remote Method Invocation (RMI) with the interoperability of the Internet Inter-ORB Protocol (IIOP).So in order to attain this interoperability between RMI and CORBA,some of the features that are supported by RMI but not CORBA and vice versa are eliminated from the RMI-IIOP specification.
Read More6 :: Does RMI-IIOP support code downloading for Java objects sent by value across an IIOP connection in the same way as RMI does across a JRMP connection?
Yes. The JDK 1.2 support the dynamic class loading.
Read More7 :: What is the role of Remote Interface in RMI?
The Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine. Any object that is a remote object must directly or indirectly implement this interface. Methods that are to be invoked remotely must be identified in Remote Interface. All Remote methods should throw RemoteException.
Read More8 :: What is the role java.rmi.Naming Class?
The Naming class provides methods for storing and obtaining references to remote objects in the remote object registry.
Read More10 :: What is meant by binding in RMI?
Binding is a process of associating or registering a name for a remote object that can be used at a later time to look up that remote object. A remote object can be associated with a name using the Naming class's bind or rebind methods.
Read More11 :: What is the difference between using bind() and rebind() methods of Naming Class?
bind method(String name) binds the specified name to a remote object while rebind(String name) method rebinds the specified name to a new remote object,any existing binding for the name is replaced.
Read More12 :: When is AlreadyBoundException thrown and by which method?
AlreadyBoundException is thrown by bind(String name) method when a remote object is already registered with the registry with the same name.
Note: rebind method doesn't throw AlreadyBoundException because it replaces the existing binding with same name.
Read MoreNote: rebind method doesn't throw AlreadyBoundException because it replaces the existing binding with same name.
13 :: How to get all the registered objects in a rmiregistry?
Using list method of Naming Class.
Read More14 :: Can a class implementing a Remote interface have non remote methods?
Yes. Those methods behave as normal java methods operating within the JVM.
Read More16 :: What is the use of UnicastRemoteObject in RMI?
The UnicastRemoteObject class provides support for point-to-point active object references using TCP streams. Objects that require remote behavior should extend UnicastRemoteObject.
Read More17 :: What does the exportObject of UnicastRemoteObject do?
Exports the remote object to make it available to receive incoming calls, using the particular supplied port. If port not specified receives calls from any anonymous port.
Read More18 :: What is PortableRemoteObject.narrow() method and what is used for?
Java RMI-IIOP provides a mechanism to narrow the the Object you have received from from your lookup, to the appropriate type. This is done through the javax.rmi.PortableRemoteObject class and, more specifically, using the narrow() method.
Read More19 :: In a RMI Client Program, what are the excpetions which might have to handled?
a. MalFormedURLException
b. NotBoundException
c. RemoteException
Read Moreb. NotBoundException
c. RemoteException
20 :: Explain RMI Architecture?
RMI uses a layered architecture, each of the layers could be enhanced or replaced without affecting the rest of the system. The details of layers can be summarised as follows:
1. Application Layer: The client and server program
2. Stub & Skeleton Layer: Intercepts method calls made by the client/redirects these calls to a remote RMI service.
3.Remote Reference Layer: Understands how to interpret and manage references made from clients to the remote service objects.
4.Transport layer: Based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.
Read More1. Application Layer: The client and server program
2. Stub & Skeleton Layer: Intercepts method calls made by the client/redirects these calls to a remote RMI service.
3.Remote Reference Layer: Understands how to interpret and manage references made from clients to the remote service objects.
4.Transport layer: Based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.
21 :: What are the services in RMI?
An RMI "service" could well be any Java method that can be invoked remotely. The other service is the JRMP RMI naming service which is a lookup service.
Read More