Remote Method Invocation (RMI) Flashcards

1
Q

What are the imports for the RMI interface?

A

import java.rmi.Remote;

import java.rmi.RemoteException;

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

Give the interface signature

A

public interface RemoteEcho extends Remote {

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

What exception is thrown by the interface stub

A

RemoteException

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

What are the imports for the RMI implementation class?

A

import java.rmi.RemoteException;

import java.rmi.server.UnicastRemoteObject;

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

Give the RMI implementation class signature

A

class RemoteEchoServant extends UnicastRemoteObject implements RemoteEcho {

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

What is the comment / annotation on RMI implementation methods

A

@Override

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

What are the imports for the main class on the server side?

A

import java.rmi.registry.Registry;

import java.rmi.registry.LocateRegistry;

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

Give the first line of the try block on the server

A

RemoteEcho rei = new RemoteEchoServant();

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

What are the imports for the main class on the client side?

A

import java.rmi.registry.LocateRegistry;

import java.rmi.registry.Registry;

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

Give the statement to create the registry on the client

A

Registry reg = LocateRegistry.getRegistry(“localhost”, 1099);

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

Give the statement to create the service on the server

A

Registry reg = LocateRegistry.getRegistry(“localhost”, 1099);

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

Give the statement to find the service on the registry from the client

A

Registry reg = LocateRegistry.getRegistry(“localhost”, 1099);

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

Give the statement to bind the registry on the server

A

reg.rebind(“echoServer”, rei);

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

Give the statement to lookup the registry in the client

A

Object o = reg.lookup(“echoServer”);

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

Give the first line of the main class in the client

A

RemoteEcho rei = null;

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

Give the statement to invoke the remote method from the client (reflect)

A

String s = rei.reflect(buf);

17
Q

What is a callback?

A

Callback refers to the server’s action of notifying clients about an event

18
Q

How can Callbacks can be implemented in Java RMI?

A

♦ Client creates a remote object that implements an interface containing a method for the server to call (callback object)
♦ Server provides an operation allowing clients to inform it of the remote object references of their callback objects. It records these in a list
♦ Whenever an event of interest occurs, server calls the interested clients

19
Q

Advantages of Callbacks are :

A

♦ Server performance does not degrade due to constant polling
♦ Clients can be notified of updates in a timely manner

20
Q

Disadvantages of Callbacks are :

A

♦ Server needs up-to-date list of clients’ callback objects; clients do not inform the server when they exit; leasing can be used to overcome this problem