Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Aron J. Skantz

Greenhorn
+ Follow
since Oct 12, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aron J. Skantz

Im very close to not answering this since I don't "know the proper use of wait and notify."
Sigh, I will try to explain again, slowly this time:
Do you agree that you have to own the monitor of an object to be able to do a wait(), Im sure you do.
In Adrians example you had to call dbLocks.wait() since we synchronized on dbLocks, calling only this.wait() will fail.
In your example you are synchronizing on java, ok then we have the monitor for the java object, agree?
Your wait and notify, are the same as this.wait() and this.notify(), then how can this work for you if you have the monitor on java? Simple, they are INSIDE THE JAVARANCH CLASS. Thus, they will do wait and notify ON THE JAVA object since its an instance of the Javaranch class.
One more time: calling this.wait() inside the Javaranch object java, is equal to calling java.wait() in the run method.
So, the examplecode you provided only shows that in Adrians code you have to do dbLocks.wait() so I dont understand why you posted it to prove your point.

Regards,
Aron
[This message has been edited by Aron J. Skantz (edited April 05, 2001).]
Actually Gautam...
I really don't understand what you are talking about, but I will try to explain anyway.
Calling only this.wait() in Adrians (and my) case as you suggest will not work since it results in a IllegalMonitorStateException, the reason for this is simple:
synchronized(dbLocks) obtains the monitor for the object dbLocks, and thus you MUST call wait on that object. Calling this.wait() here fails since you don't own that monitor. The same goes for notifyAll().
So, again.. I don't know what you are talking about, what convention?

Regards,
Aron
Matt,
Actually im think about doing the exact reverse thing. Changing from a book method on the server to the client. The main reason is that I feel that a book method is much to ungeneric to be placed in the Data class. Also, the fear that the client should mess up is not a valid since i write the client myself and know that they will behave.
By moving book(..) to my client the Data class will be in every way reusable and this is probably a strong point to show this to the examinator, but then again, Im only guessing.
Also, I think SUN has left the directions as misleading as they are to force us to motivate our decisions and make us think. And I believe that you don't have to change your current implementation to pass, just motivate and explain and you will be fine.
Adrian has many good reasons to why to keep the booking on the server, and I think either way will do fine.
Regards,
Aron
Hi Adrian,
Your design is nearly identical to mine, except that I also have a -1 logic to handle locking of all records.
If I had to change something in your code, a
while(dbLocks.contains(...))
eliminates the need of that extra boolean :-)
j/k
And yes, it is recommended to use notifyAll instead of notify, probably dont make that big difference in this case though..
Regards
Aron
Douglas,
I thought the nice thing about RMI and a great deal of the concept with it was that the server handles the thread-issues for you. It creates threads as clients connects and threads live as long as the client makes calls, and then dies after a timeout-period. If the same client makes more class later a new thread is created for him. All this goes on "behing the scene", and we dont have to worry about it.
So, what im trying to say here is that creating 10 different instances of the implementation is to go against the whole thought behind RMI, and judging from your code only the last instance will be bind anyway since you bind them in the same name "Data" and thus overwrite the to "Data" assigned instance on every new bind-line; resulting in that only DataRef10 will be bound.
... or have I missunderstood the whole thing?
Regards,
Aron
[This message has been edited by Aron J. Skantz (edited April 04, 2001).]
I've implemented my locking the exact same way that Adrian decribes, even down to the unlock in the finally{ }.
When I first read the criterias this was the way I felt it must be done, later on I read various posts about using client-ID for tracking but still think this is beyond the criteras.
Anyway, just wanted to assure Adrian that I have tested this thoroughly, and as far as i can tell it works perfectly.
Regards,
Aron
May i speak, even though i havn't passed yet?
I've implemented the server server to prompt someone to type 'STOP' to shutdown. This gives me time to clean up a bit. The cleaning up can be achived in a couple of other ways, but I've seen SUN use this method in one of their tech-letters.
But then again, the criterias say nothing about how to do this, so do the simplest (ctrl+c) or motivate something about usability and use 'STOP' or similar..
Regards,
Aron
Hi guys.
I, as well, estimate 1-2 weeks before i can submit my assignment. I'm very nervous about it and are constantly finding reasons to why I should wait just a little longer. Anyway, here is what i did:
1: I use a policyfile, but see no reason to why either way should cause a drop in points if you explain your choice.
2: Dynamic loading is, if you ask me, way beyond the criterias and a single line motivating why not to implement it should be enough in the design document.
3: Hey, must be something in the air I do unlock/lock on the server without tracking clients.
4: I did implement the -1 lock in the simplest of ways, but i thought long and hard about the various solutions. If anyone are interested, ask.
This last week i have actually removed stuff from my code (double clicking in the table to book etc), cleaning it up and simplify it to just do what the criteria states and nothing more. Keeping it simple is everything here I belive. No one can blame you for doing only what you were told to ;)
(Adrian: you are the only person here besides myself that has choosed to implement server side locking without client tracking and i would like to talk to you about how you motivate it and exchange thoughts. So, mail me if you want to talk about it, otherwise, just dont. I really dislike mailing people that do not wish to talk
Good luck!
Regards,
Aron
As i understand it the questions are constructed to fit everyone that has completed the SCJD programming assignment.
You are required to know not only the things you choosed to implement but the alternatives as well (someone that choosed sockets for the assignment must be able to answer a question about RMI and vice versa)
Exempel q's ive seen includes "There are at least two ways to deal with exception handling, describe them and explain your choice for the assignment." and in your case a question as "Vector, ArrayList and Hasttable might be used to store information in the locking mechanism. What are the pro's and con's with each of them and argue for you choice in the assignment", might occur.
Oh, you get the point, good thing im not hired by SUN to write the questions
Regards,
Aron
Hi Ganesh,
Some quick answers to your questions
1: No other sw/hw are required, although i would recommend using a good text editor with syntax highlighting.
2: A test in a real network would be nice, but you can probably simulate the conditions by running one jvm for the client and one for the server on the same computer.
3: No knowledge of this are required, save it for the SCJA .)

Regards,
Aron
Setting the frame size to 800x600 on a system that doesnt support that high resolution might create problems.
So personally I check if the screen resolution is 640x480 or above and if true set the frame size to that (640x480). If the resolution is smaller then i choose fullscreen to at least get as close to my prefered size as possible.
Then again, the examiner probably has big hi-rez'd monitors so i dont think it will be much of a problem
\Aron
Hi Kamal
It is possible to create a RMI server without extending UnicastRemoteObject. However, UnicastRemoteObject hides most of the details of making an object available to clients. So if you choose not to extend it you still have to use its static methods to export and unexport the implementing object.
The most common way is to extend.
Regards,
Aron
Hi Rudy,
Sounds like if you got the exact same problem talked about in the new thread "Creepy classpath", did you read it?
Regards,
Aron
Hi,

'Any files' probably includes a parameter file as well. And since it's easy to use command line parameters or even a small startup window for entering the data you really don't have to risk failure by doing exactly what SUN tells you not to do.. :-)
Regards,
Aron
Luis,
Personally I havn't replied since I don't understand what the question is and was kinda hoping that someone else would be more intelligent and respond

\Aron