• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two-way RMI communication required?

 
Helen Ma
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Helen Ma
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10232
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic