Open a new folder. Copy all the source files of the Hello example to the folder. Add code in the sayHello method of HelloImpl.java so that there is a 5 second delay before the method returns. This has the effect of artificially lengthening the latency for each remote method call. Compile and start the server. In separate screens, start two or more clients. Object the sequence of events displayed on the screens. Can you tell if the method calls are executed by the object server concurrently or iteratively? Explain.

What will be an ideal response?

The code change made in HelloImpl:
```
public String sayHello( ) throws RemoteException {
try {
Thread.sleep(5000);
}
catch (Exception ex) { }
return "Hello, World!";
}
```
The two clients each suspends for approximately 5 seconds and then each displays the return string soon after; the display comes up almost simultaneously. This indicates that the methods calls are executed concurrently (in different threads). If they were executed iteratively, the second client would have to wait for the completion of the first client’s call before its call can be processed. Therefore, the second client would have to wait for 5 seconds for the first client’s call to complete, then another 5 seconds for its own call to complete, so that the display of the return value would occur only after at least 5 seconds since the first client displays its “HelloWorld”.

Computer Science & Information Technology

You might also like to view...

When you make a change to a library item, you must manually make the same change for all the pages where the library item is used.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

When the object indicated by the value Pine (or Oak or Cherry) in the accompanying figure is selected by the user, the ____ property changes from False to True.

A. Selected B. Value C. Checked D. Input

Computer Science & Information Technology