aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Two-way RMI communication required? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Two-way RMI communication required?" Watch "Two-way RMI communication required?" New topic
Author

Two-way RMI communication required?

Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Hi, I have a question regarding to the exam.
Is two-way RMI communication required for the exam? Do I need to make the server send data back to the client?
When I ran Denny's DVD project, I observe this scenario:
1. Start server using RMI
2. Start client 1
3. Start client 2
4. Client 1 rent Army of Darkness. The number of copies is decreased from 7 to 6.
5. But Client 2 's window still shows 7 copies of Army of Darkness.

The reason is because the server does not send updated data back to Client 2.
So, in the real-exam, are we required to make client server talk in 2 ways?
If that is not required, I think I don't need to make the RMI application complicated.
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Howdy, Helen!

So, in the real-exam, are we required to make client server talk in 2 ways?


No. This is not required. I myself implemented the client's updating in a piggyback style. So, for instance, let's say that client 1 is looking at the window, and all records are available. Client 2 updates record 2 and client 3 updates record 3. Client's 1 window is not updated. Then, client 1 updates record 1. When he does so, then his window is updated, showing that records 1, 2 and 3 where udpated. So the client's window is only updated when he/she sends some data to the server.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Hi, Roberto.
To make sure I understand the exam requirement, this scenario :
1. Client 1 rents Army of Darkness, which has 7 copies originally. It locks the record, decrease the number of copies by 1 and unlocks it.
2. During the same time, Client 2 , Client 3, Client 4 all see 7 copies even after Client 1 rents one copy of Army of Darkness.
For the exam, the scenario is still fine.
(Even though in real-life applications, we hope client 2 , 3, 4 should see 6 copies of Army of Darkness after client 1 rents it.)

Thanks in advance.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5406
    
  13

Yes, that's fine.

When client 4 refreshes the view (by similar search for example), he/she 'll see the 6 remaining copies of the Army of Darkness dvd.

off-topic: I don't know if you want that behavior in a real-life application. Because that will cause a lot of network traffic to push all these updates. And why would a client be interested in how many copies there are left? When a rent is made the only thing that matters is if the item is available. If it is, it's rented; otherwise an exception is thrown.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
 
subject: Two-way RMI communication required?