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”.
You might also like to view...
The main difference between the functions atof, atoi and atol is:
a. Their return types. b. Their arguments. c. Their header files. d. Their efficiency.
What is the function of the ODMG Object Query Language?
What will be an ideal response?
A(n) _____ is a graphical model of an information system that depicts the logical relationships and interaction among system entities.
A. entity-relationship diagram (ERD) B. illustration flow chart C. query relationship diagram (QRD) D. data chart
?Identify a method that is used to create a subarray.
A. ?concat() B. ?slice() C. ?assert() D. ?sort()