Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Ray Cheeny

Ranch Hand
+ Follow
since Aug 21, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ray Cheeny

Hi, I've uploaded the assignment a few days ago. Could any one tell me the address to the Prometric's Cert Manager ?
I am testing my program now.I make an empty db.db file and load it.But I found the Data would throw IOException when it operated on 'headerLen = db.readInt();' and the e.getMessenger() showed only 'null'.How to show this messenger in detail? When I wrote something in that empty db.db, it would throw java.lang.outOfMemery. How to handle it? When I changed something in db.db(provided by Sun), it threw java.lang.NegativeArraySizeException. Need I handle it ?
It's the constructor of my RemoteAccess.Should I add 'catch(Exception)' in it?
I am facing a very strange problem. I am using RMI for the network facilities. When i run my server application using the class files, everything works out fine.
However recently i created a server.jar with all the related files. When i run this server.jar, then the application comes up file, but gives a problem that it is unable to connect to the RMIRegistry, even though the RMIRegistry is running on the correct machine and the correct port. No such problems arise when i run the application using the class files.
I start RMIRegistry in my ConnectionDB(registry = LocateRegistry.createRegistry(port) . Is this acceptable.I do not use any codebase or permission file and it works fine in class files.
Pls help me as i can't figure out whats wrong
In my unreferenced(),the lockRecords keep a set of locked records in each remote connection object

public void unreferenced() {
System.out.println("Unreferenced called");
// the LockManager and lockRecords free all the locks and keys
Iterator iter = lockRecords.iterator();
while (iter.hasNext()) {
int record = ((Integer); // line 298
lockRecords.remove(new Integer(record));

It throws
at java.util.HashMap$HashIterator.nextEntry(
at java.util.HashMap$
at suncertify.server.RemoteAccess.unreferenced(
at sun.rmi.transport.Target$
Could someone tell me why and how to handle it?
I think when clientA is crashed and still has the lock on record1. ClientB have to wait for record1. When unreferenced() is called, it clears all the locks. So I call notifyAll() to notify ClientB.
Is that right?
Sorry,I push a wrong button.
in my lock

Could any one explain it?
Hi friends,
In my unreferenced(),I got some exceptions when it is called.
java.lang.IllegalMonitorStateException: current thread not owner
my unreferenced() is like:
But I still have two questions
1. I have the book method in the client.How about you? Which one is better,client or server?
2. This method return all the datas in some field.

Is it redundant?
I just wonder 'data.getRecord(i + 1)' in Data will throw a DatabaseException, if there's no records.
a.just like the above
b.ignore it
c.catch the 'data.getRecord(i + 1)' and rethrow it.
How do you think about it.I don't how to deal with null value.
Hi Jim,
Another question,how to handle the InterruptedException in LockManager? If I throw it to the client,could you tell me how to describe the msg(show in the errorDialog).
I have factory in server side which 'return new RemoteAccess()'.In the RemoteAccess,the constructor invokes Data(Data data = new Data(dbFile)).When start the server, I will not know the exists of the dbFile until one client visit the server. In this situation, the server will throw IOExceptions(cannot find db).
So, could anyone tell me that need I recheck the dbFile,when start server?
Now the IOException buggers me.In the Data constructor,it will throw IOExceptions.
My question is where to catch it in the server side and do you rethrow it to the clients?
I don't think the clent need to know it which the server dose not find the db.db
Could you tell me your design?
still some questions:
1.when the server call lock(-1) and some clients want to get lock, should the server throw Exceptions or blocking?
2.Will getRecord() return null? I think it will throw IOException first. If the db file exits and has no records , what will happen?
3.Does any one use only one DataInfterface? I still confuse with it, though I've looked up others posts. Could anybody tell me how to handle the RemoteException in localAccess?
Thank for reply
I have several questions:
(1) I use Facade and MVC design patterns in my client side. The model have an instance of Facade.
Is that right?
(2) Should I declare "throws xxxException" in the Facade and let the model catch it ,or catch it in the Facade?
(3) I have one DataInterface and both remote and local data extends it. Is that right? If I do this,the local data have declare "throws RemoteException" ,I think it may be bad. Need I put the DataInterface in both client and server side?
1. I know synchronized on method or object both will work fine .But which one will performance better on earth? Which one did you choose?

2. when lock -1,I wait all the client which have had lock ,then lock all.Is that right? When I lock all ,which one should I use?
a.just set a flag
b.set a flag and lock all with the calling object
3. In my referenced(),I clear all the locks.
a.Need I wait for all the clients which have had the lock.Then clear all.
b.make the locks = null ?
or remove every lock one by one?
Thanks a lot!
I know there're a bit more.
Sorry,it's TimerTask. I find that 15 min is too long.So I'd like to make a LockTimer extends TimerTask.
How do you think about it?