What Is Unicast and Multicast Object?
What Is Unicast and Multicast Object?
Answer:
The difference between unicast and multicast is that in unicast approach the sender sends the data stream to a single
receiver at a time. Thus there is one to one communication.
In a multicast the sender and the interested receivers communicate. This is one to many communication. This
communication can take place between data terminals spread across various LANs too.
Answer
The three layers are the Stub and Skeleton Layer, the Remote Reference Layer, and the Transport Layer
The stub and skeleton layer is responsible for marshaling and unmarshaling the data and transmitting and
receiving them to/from the Remote Reference Layer
The Remote reference layer is responsible for carrying out the invocation.
The Transport layer is responsible for setting up connections, managing requests, monitoring them and
listening for incoming calls
What is RMI?
Answer
Remote Method Invocation. It is an approach where a method on a remote machine invokes another method on
another machine to perform some computation and return the result to the calling method.
What is RMI?
To interact with the methods of objects in other / remote machines using JVM, RMI is used. This process allows the
information exchanging using multiple JVMs. It provides the location transparency by giving the sense that the
methods accessing locally.
Advantages of RMI:
Simple and clean to implement that leads to more robust, maintainable and flexible applications
Distributed systems creations are allowed while decoupling the client and server objects simultaneously
It is possible to create zero-install client for the users.
No client installation is needed except java capable browsers
At the time of changing the database, only the server objects are to be recompiled but not the server
interface and the client remain the same.
Disadvantages of RMI:
RMI is based on client-server architecture model. The stub plays the role of a proxy server for the remote objects.
The skeleton lives in the same JVM as the remote object and communication will be handled with the stub. The
remote references are managed by the registry. The binding of server with reference to itself will be on the registry.
The clients communicate with a registry which in turn obtains a remote reference to the server. This could be a
remote host. The remote reference could be obtained by the client from the registry in order to invoke the methods
from the remote object.
RMI and CORBA – one is not “better” than other. The comparisons between these two technologies reveals the
strengths and weaknesses. The applicability of these two technologies is purely depends on the application’s
demand, feasibility, performance.
The selection of RMI or CORBA depends on the following advantages of RMI and CORBA.
RMI Advantages:
RMI disadvantages:
CORBA advantages:
CORBA disadvantages:
Interface Definition Language mapping needs writing for one language may not support the another
language.
New changes in the existing system / code may not integrate with the IDL language tools.
Data transfer or objects is not supported by CORBA
If CORBA specifications fails for adoption by the industry, then it become legacy system.
Answer
Remote interfaces are defined by extending ,an interface called Remote provided in the java.rmi package. The
methods must throw RemoteException. But application specific exceptions may also be thrown.
Answer
The role of the stubs is to marshal and unmarshal the messages that are sent and received on the client or
the server side.
RMI stub and skeleton - Jan 30, 2009 at 18:10 pm by Vidya Sagar
RMI is a mechanism that is to communicate between two Java Virtual Machines. This just does like invoking
a method from local machine. The whole communication is called RMI mechanism.
RMI mechanism:
To communicate between two remote methods by two different JVMs, there is always two intermediatory
objects called stub and skeleton. The tasks that are performed by these two objects are as follows:
The return value or exception from the server is unmarshalled by the stub and becomes the return value of
the RMI. If the exception is thrown by the remote method then the stub object rethrows to the caller.
What are the layers on which RMI implementation is built? Explain them.
The stub/skeleton layer sits in between application layer and the rest of the RMI system and acts as an
interface. This layer transmits the information to remote layer. This transmission is done through the
marshalling of streams. These streams performs the object serialization.
A stub is a remote object at the client-side. This stub implements all the interfaces which remote object
implementation supports.
A skeleton is a remote object at the server-side. This stub consists of methods that invokes dispatch calls to
the remote implementation of objects.
The lower level transport interfaces is dealt by this layer. This layer carries a specific remote reference
protocol independent of stub and skeletons.
Every remote object is implemented by choosing their individual remote reference subclasses.
The transport layer sets up the connections to remote address spaces, manages them, monitors the
connection liveliness, and listens the incoming calls.
The transport layer maintains the remote object’s table available in the address space, in a table. For
incoming calls, the transport layer establishes a connection. It locates the target dispatcher of the remote
calls and passes the connection to the dispatcher.
NEXT>>
Answer
The client procedure calls the client stub in the normal way.
The client stub builds a message and traps to the kernel.
The kernel sends the message to the remote kernel.
The remote kernel gives the message to the server stub
The server stub unpacks the parameters and calls the server.
The server does the work and returns the result to the stub.
The server stub packs it in a message and traps to the kernel.
The remote kernel sends the message to the clients kernel.
The clients kernel gives the message to the client stub.
The stub unpacks the result and returns to the client.
What are the basic steps to write client-service application using RMI?
Assigning the security manager and then obtaining the reference to the service
Contacting the RMI registry to obtain the remote object’s reference and invoking its methods
Requesting the name for the service
Invoke the remote method.
Answer
RMI registry is the binder for Java RMI. An instance of RMI registry must run on every server computer that hosts
remote objects. It maintains table mapping textual, URL style names to refer remote objects hosted on that computer.
Naming class provides methods for RMI registry :
Answer
During communication between two machines through RPC or RMI, parameters are packed into a message and then
sent over the network. This packing of parameters into a message is called marshalling. On the other side these
packed parameters are unpacked from the message which is called unmarshalling.
Object Activation is a process of providing persistent references to the objects. It also includes the managing the
execution of implementing of objects. RMI activates the objects for the execution as and when needed. The
appropriate execution is initiated inside the appropriate JVM when the activatable remote object is accessed which is
not currently running.