Ramses Tutoli

Greenhorn
+ Follow
since Sep 05, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ramses Tutoli

I think the DBClient methods throw IOException, which is a parent of RemoteException.

Originally posted by Jmannu gundawar:
In the MAX's DVD project, the code listing is as follows:
public interface DBClient {
(methods decleared here do not throw RemoteExceptions)
}
Then there is another interface created for the RMI (remote) package:
public interface DVDDatabaseRemote extends Remote, DBClient {}
The class DVDDatabaseImpl in the remote package is decleared as:
public class DVDDatabaseImpl extends UnicastRemoteObject implements
DVDDatabaseRemote {

Now the DBClient methods implemented in this class throws the RemoteException, where as the methods decleared in the interface dont.
How is this possible?
Why does it not give a compile time error,as the overridden methods (methods decleared in the interface) do not throw this exception??
If I try to implement interface method in the class, I get compile time error if class's method's throw the RemoteException and Interface method is not decleared to throw that exception.
Please help.
Thanks,
Manoj
[ October 20, 2003: Message edited by: Jmannu gundawar ]

How long does it take for them to get back to you? I had that problem yesterday, and so far no word from them.
No, I just want to lock record numbers. I'm not even sure what you mean since the records are stored in a flat file.
But if you don't unlock it, then that record will still be considered "locked" by the application.
What if another thread runs create() and reuses that space? Then that record will be essentially deadlocked, right?
How am I to remove the lock in the first place if I never call unlock() on it?
The DB interface provided by Sun has unlock() throw a RecordNotFoundException.
I hadn't implemented this before and everything was fine.
Then I reread the requirements and it stated that "Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file."
So since Sun wants unlock() to throw this exception, which I think is wrong to begin with, I changed my code to check for a valid record before unlocking.
Now the problem is that this causes a runtime error if you lock before a delete() operation, since an attempt to unlock after that will of course throw the RecordNotFoundException because it was just deleted!
What's the best thing to do in this case? I would really just like to remove record validation from my unlock() method, but I don't want points removed or worse (automatic failure).
Right now in my code, I think deadlock can occur in LocalDataClient/RemoteDataClientImpl after a record is locked but before a record is unlocked if an exception is thrown in one of the methods. For example, take the following code in my LocalDataClient class:

if an exception is thrown in my call to db.delete(), the record never has a chance to unlock. Would it be ok to put my db.unlock() method in a finally{} clause to fix this?
Mark, when I search for "Connection" I get about 1000 hits of unrelated topics. It's too general. I'm only confused because I thought there was only one remote object, and all clients have to connect through it.
Max, I will try to do that, thanks. Do you have any specific threads you are referring to?
strictly following the guidelines, I guess they do..but what do you guys think?
no, I am not fast at all..actually I took some shortcuts like not worrying about exception handling or javadocs. that's going to cause me some headaches in the future when i have to address that fully.
I've read through some of the older topics and have a HUGE headache now. Can someone explain the best way to do this?
I don't understand completely how to use the Unreferenced interface. If there are 2 clients with references to the remote object, but client A crashes, then Unreferenced still wouldn't be called because client B still has a reference to it (the remote object), right? So what's the point? Or is my understanding completely wrong?
Also, to use WeakHashMap you need to keep the thread name as a key right? Well then if I put the record number as the value, where do I store the freakin' cookie? Or do I have to create another class just to put the recNo and cookie as the value to the WeakHashMap?
Damn, what a headache I have...
In my Data() class I validate the db file by checking for the magic cookie at the beginning of the file. If it's not valid, I throw an exception. My Server and Client GUI's catch the exception and display an error message. I don't know if it's necessary, but it's not difficult.
haha, that was me. right after I posted I found the method I needed (setMargin()).
Let's say you have multiple GUI clients accessing our server db. If one client books a customer, should all the other GUIs be updated automatically to reflect this change? How would this be accomplished?
My program right now doesn't do this. Updated info isn't shown unless the client re-queries the db with a search or something.
Andrew, you are right. It was the call the createRegistry() that caused the problem. There doesn't seem to be a way to "uncreate" the registry in Java (other than closing the app), since unbind() just removes the remote object.
I worked my way around this by calling createRegistry() when the server window is opened, and just adding buttons that either bind or unbind the remote object.
I don't have a ConnectionFactory. my remote object is my remote implementation of Data.
"It doesn't work" means that it doesn't seem to unbind the remote object. A subsequent call to rebind() gives me the following error:
java.rmi.server.ExportException: internal error: ObjID already in use
Failed To Register object with the RMI registry