RMI Flashcards

1
Q

What does RMI mean?

A

Remote method invocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 3 basic layers of RMI architecture?

A
  • Proxy: Stubs (client) and skeletons (server) - generated by rmic
  • Transport layer (TCP/IP. Sockets)
  • Remote reference layer

Also Application Layer (client/ server)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the Proxy layer

A

Stubs and Skeletons.

Stub Layer:

  • Proxy representing interface to remote object for client
  • Defines complete interface of remote implementation
  • Appears to client app as local object
  • Communicates with skeleton via Remote Reference Layer

Skeleton layer

  • Local interface for remote object
  • Interface between remote implementation and Remote Reference Layer
  • Communicates with stub via remote reference layer
  • Marshall’s any return values or exceptions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the Remote Reference Layer

A
  • Responsible for management of remote objects
  • connects clients to remote objects
  • Responsible for invocation of remote object methods
  • An independent reference protocol
  • Provides a transport stream to Stub/Skeleton Layer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the Transport Layer

A

Responsible for creation and maintenance of connections

  • Runs connections over sockets by default
  • Can use custom sockets eg SSL.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a naming service?

A

A naming service associates names with objects

  • Important for distributed systems as it allows location of objects

A naming service is a dedicated piece of software

  • Controls a filespace - database, spreadsheet workbook etc
  • Allows association of name to data - binding (filename, column, cellname)
  • Name is meaningful within a given space (context: folder, table, sheet)
  • Allows lookup of name for data - resolution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How is the naming service provided in RMI?

A

Java RMI provides a bootstrap naming service called rmiregistry that allows the server side to register or name at least object (and its services) that it wants to expose to a client. The client is then able to look up the basic service and find out what methods have been exposed and then invoke them.

The RMI registry can be started in the command line with start rmiregistry.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Naming Services: Declare that an object is bound to a name

A

To declare an object is bound to a name:
bind(String name, Remote object)

ie bind("Hello", new Hello("Hello world");
The bind method binds a remote reference to a name in the registry. Similarly the rebind(String name, Remote obj) method can be used to bind an object with another name in the registry.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Naming Services: To retrieve a reference to a remote object with a given name

A

To retrieve a reference to a remote object
lookup(String name)
The lookup methods returns a reference to an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

naming Services: To retrieve a directory of available objects

A

To retrieve a directory of available objects:
list()
This method returns an array of the names bound in the registry.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is meant by Object Serialisation?

A

Object serialisation is the conversion of an object into bytecode so that it can be transferred in an object stream across a network and then deserialised at the other end. Object serialisation is therefore important to RMI where objects, arguments and parameters are transferred between clients and server implementations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How is an object serialised in RMI?

A

bind or rebind method

Naming.rebind(“Hey”, new Hello(“Hello, world!”));

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How is an object decerialised in RMI?

A

lookup method

HelloInterface hello = (HelloInterface) Naming.lookup(“computers_address/Hey”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are remote callbacks in RMI?

A

A remote call back is where a the server side object notifies the registered client of an event it has previously been asked to be notified of. An example of this is a Stocks and Shares app where a user registers their interest in the price of one stock and asks to be notified if the price falls below a certain value. When the event occurs the server then notifies the client.

Programmatically this occurs by the client, for example, registering as a listener of an event source on the server side. This request is passed as a parameter to the server stores this list as a vector which holds a list of registered listeners. When the event occurs the call back is made to the client.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the role of the remote interface?

A

The role of the remote interface is declare which methods can be called by a client remotely. A remote interface allows a remote Java virtual machine to call the declared methods of a remote object. Once a remote interface is implemented by extending java.rmi.Remote then the method can be called on a remote JVM in the stub layer which represents the remote object locally.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Give an example of code for the Remote Interface in RMI

A
public class RemoteInterface extends Remote{
//remote method helloWorld();
public String helloWorld() throws RemoteException;
}