File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes some questions aboute Dennys's DVDs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "some questions aboute Dennys Watch "some questions aboute Dennys New topic
Author

some questions aboute Dennys's DVDs

Javier Corral
Greenhorn

Joined: May 23, 2007
Posts: 24
Hello,

I'm reading Denny's DVDs before downloading my assignment and I have some questions I would like someone reply me if possible.

In chapter 6 pg 181 the first paragraph says...

We now have a unique instance of the DvdDatabaseImpl class for each connected client. If each DvdDatabaseImpl has its own instance of DvdDatabase, then the instance of DvdDatabase can be used to identify the client to the reservation.

I don't understand why DvdDatabaseImpl constructor creates a new DvdDatabase;
- Don't DvdDatabaseImpl and DvdDatabase do the same?. (both implement DBCLIENT).
- If we work directly with DvdDatabaseImpl (I mean if DvdDatabaseImpl doesn't have a DvdDatabase reference variable) , doesn't the instance still match with only one client?


In page 157 I read what to do if the client connection crashes. Here explains that java.rmi.server.Unreferenced can be used when rmi client crashes. How can I use Unreferenced?


Thank you, very much.
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Javier,

==>I don't understand why DvdDatabaseImpl constructor creates a new DvdDatabase;

<==The application that you will write has to support locking of records, and also unlocking. A certain client can only unlock a record if it was locked by this client itself.
How can your application check this? There are at least 2 possiblities:

1. when a client locks a record, the application returns a random number (a "cookie"). The client has to supply this number when it want to unlock a record later on.
2. when a client locks a record, the application returns a unique instance of DvdDatabase. When the client wants to unlock a record, the application checks the instance (see the releaseDvd-method)

You can only use possibility 1. if the supplied interface in your assignment allows it.

==>Don't DvdDatabaseImpl and DvdDatabase do the same?. (both implement DBCLIENT).
<==No they don't:
1. DvdDatabase implements DBClient in the 'normal' way.
2. DvdDatabaseImpl does implement DBClient as well, but wraps it so that it can be called remotely. (I don't think the name 'DvdDatabaseImpl' makes this very clear.)

==>If we work directly with DvdDatabaseImpl (I mean if DvdDatabaseImpl doesn't have a DvdDatabase reference variable) , doesn't the instance still match with only one client?
<==I don't think so: at least not as long as the releaseDvd-method uses the DvdDatabase object to check the client.

==>About crashed clients: I'm not going to do anything about that. I'm implementing a 'thin client' (page 157, first bullet).
The server will do all the locking and unlocking, not the client.

Hope this helps,

Herman
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: some questions aboute Dennys's DVDs