What Is Unicast and Multicast Object?

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

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.

What are the layers of RMI Architecture?

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.

RMI  - Jan 30, 2009 at 18:10 pm by Vidya Sagar

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.

Explain the advantages and disadvantages of RMI.

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:

 Less efficient than Socket objects.


 Assuming the default threading will allow ignoring the coding, being the servers are thread- safe and robust.
 Cannot use the code out of the scope of java.
 Security issues need to be monitored more closely

Explain the architecture 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 vs. CORBA.

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:

 Portable across the platforms


 Code can execute on remote JVMs
 Existing systems can adapt RMI as this technology is available from JDK 1.02

RMI disadvantages:

 Can use only the java supported platforms


 Limited functionality because of security restrictions
 No support for legacy systems

CORBA advantages:

 The services are non-platform and non-language dependent


 Encourages various implementations based on the same interface.
 Supports for primitive data types and data structures as parameters
 Provides easy ways to link between objects and systems

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.

What is the role of Remote Interface in RMI?

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.

What is a skeleton in RMI?


Answer
Server side stub is refered to as a skeleton.

Explain the role of stub in RMI

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

Describe how the RMI mechanism works.

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 tasks of stub object (on machine A):

 Building a block of information which consists of 


- a remote object identifier that is to be used. 
- the method describing operation number is to be called 
the method parameters called marshaled parameters which are encoded into a specific format that is
apt for transporting on the network.
 Sending the above information to the server

The tasks of skeleton object ( on the machine B):

 Unmarshalling the parameters


 Invoking the real object’s required method which is on the server
 Capturing the value returned or exception returned by the invoked call on the server
 Marshaling this value
 Sending the package along with the value in the form of marshaled back to the stub on the client on
the machine A

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:

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 Remote Reference Layer:

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:

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>>

Explain how RMI clients contact remote RMI servers.

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.

Explain the diffference between RMI registry and OSAgent.

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 :

rebind(String name, Remote object)


bind(String name, Remote object)
unbind(String name, Remote object)
The OSagent is a process that allows CORBA servers to register their objects and assists client applications in the
location of objects. The OSagent is designed to be operated on more than one node.This is done to avoid a single
point of failure. OSagent processes follow a set of rules to discover each other and cooperate in the location of
registered objects.

Explain marshalling and demarshalling.

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.

What is Object Activation?

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.

You might also like