• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passed 150/155

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just wanted to thank everyone at the JavaRanch. Not sure if I could have completed it with out everyones help. I know it would have taken me twice as long. I received the score on the website a week after taking the essay exam. Here is the score breakdown:
This report shows the total points that could have been awarded in each section and the actual number of points you were awarded. This is provided to give you per-section feedback on your strengths. The maximum possible # of points is 155; the minimum to pass is 124.
General Considerations (maximum = 58): 58
Documentation (maximum = 20): 20
GUI (maximum = 24): 23
Server (maximum = 53): 49
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you got a perfect in General Considerations, can you tell us what your Design Choices were?
What did you do about locking, Data - modify or extend, RMI or Sockets.
How did you handle: client id tracking, lock timeout, automatic downloading of stub, executable jar or not, user selection of connection method, automation, and gui online help.
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What did you do about locking, Data - modify or extend, RMI or Sockets
I created a very simple locking method that does not tracking client ids and stores locks in a Vector. I modified the Data class. I choose RMI because it was easier to implement and maintain. I did nothing for timeouts or automatic downloading of stubs. I did create an executible jar file and online help. I handled the database mode selection through an input parameter.
From what I listed above you can probably tell I used a very simplistic design. My goal was to just fullfill the requirements and nothing more. I did spend a lot of time testing. Let me know if you have any more detailed questions.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am in the final stage of the assignment.
I have a couple of question.
(1) How did u fill the Origin & Destination Combobox.
(2) The Java documemtation in the given class files are not complete. Should we make chnages to them?
And, in some methods, the order of JavaDoc tags are not correct.
For example, the @return is before @param and there is no description for fields.

Thanx. in Advance,
Shankar S
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

(1) How did u fill the Origin & Destination Combobox.

I created a method in the data class that returns an array of strings with all of the unique values from a column specified as a parameter. I called this method from a middle layer I created seperate from the GUI. Then passed the array of strings in as a parameter for the JComboBoxes

(2) The Java documemtation in the given class files are not complete. Should we make chnages to them?

I modified all of the JavaDoc comments supplied in the db package to follow my standard format

[This message has been edited by David Reck (edited August 01, 2001).]
 
ShankarS
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanx a lot, I didn't expect such a fast reply to my queries.
So, It tends me to ask you some more questions.
(1) Did you simulate current clients for load testing the RMI Application?
(2) How you implemented the online help?
(3) Will be lock be blocked for new requests, when the client that locked the records crashes without unlocking the record?
(4) And, Can you give us few tips on writing the readme, desing and other documents.
Once Again,
Thanx. in Advance,
Shankar S
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) Did you simulate current clients for load testing the RMI Application?
No, I used some of the people in my office for testing. I also added some sleep commands in the method making the bookings to make sure the would be attempting to access the same database record at the same time.
(2) How you implemented the online help?
I created a html file and included it in my client jar file. I used a JEditorPane to display the html file in. I didn't have to hard code any paths because the file is guaranted to be in the jar file.
(3) Will be lock be blocked for new requests, when the client that locked the records crashes without unlocking the record?
If the client crashes and it holds a lock that record will remained locked until the server is restarted. They didn't say it had to be production level just functional.
(4) And, Can you give us few tips on writing the readme, desing and other documents.
The readme file is pretty simple. It was a bit long just because I gave detailed instructions on running the program and listing each file submitted with a description. I had a total of nine points I disucssed in my design doc including RMI, Locking Scheme, Modyfing Data, Exception Handling, GUI Design, Event Handling and a couple of other small things.
 
ShankarS
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Since, you said that you have the help html file in the jar file itself, Did you place the db.db file too in the jar file.?
And, How abt the jar files. You had any server.jar, client.jar, db.jar, fbn.jar, etc.
Once Again,
Thanx a lot,
Shankar S
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you place the db.db file too in the jar file
No, I only placed class files and that one html file in my client jar. The database location was passed in as an application parameter.
And, How abt the jar files. You had any server.jar, client.jar, db.jar, fbn.jar, etc
I had three jar files
FBN.jar that contained all of my jar files, javadoc files, and java files
Client.jar an executible jar for the client application
Server.jar an executible jar for the server application
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Cognate for such great score.
Can you guide me in locking.
I have simply used Hashmap as it is threadsafe.
R_Lock = new HashMap(); // THIS IS FROM ANOTHER CLASS
��..
��

synchronized(R_Lock){
while(R_Lock.containsKey(new Integer(recno))){
try {
R_Lock.wait();
BUT to my surprise everyone in this group uses :
private Map lockTable = Collections.synchronizedMap(new HashMap());

Can you guide me where am I wrong? Is not Hashmap threadsafe ?
Or my design is all right.?
Thanks in advance.
Ck
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,
It is a great score!
Have a rest!
Bye,
Ban
Hi Devu,
I think you are wrong. My document says:
(The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.)
Hope it helped.
Bye,
Ban
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wa great score!
congrats.
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Devu Shah
HashMaps are not sycnronized. I would recommend using another object that is or you will have to do something like Collections.synchronizedMap(new HashMap());. I used a Vector but other than that mine was very similar to your current locking scheme.
Andras Nemeth & Swami nathan
Thanks
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratualtions!
did u implemented RMI call back for real time update?
Do we need to do that?
 
Devu Shah
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello David Reck,Andras Nemeth & Swami nathan

Thanks for your reply.
you said"... HashMaps are not sycnronized. I would recommend using another object that is or you will have to do something like Collections.synchronizedMap(new HashMap());."
Can you please tell me which object is Syncronised ?
you said "I used a Vector but other than that mine was very similar to your current locking scheme...."
Do you mean to say vector is Syncronised ?
please clearify.
Also one more point as i have syncronised block, is that 100 % right or better would be collection.syncronised...... ?
or can we use syncronised block as well as 'collection.syncronisedMap......
thanks
Devu
 
ShankarS
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanx a lot for your previous replies.
I still have a couple of questions for you.
(1) Did you have the only .class files inside the Server.jar &
Client.jar?
(2) Where did you place the Data.class files (3) Where did you place the source, class & doc files of Data, DataServer Implementation & the Data Client Implementation?
(4) Did you have any nested .jar files ?
(5) This question is not about jar files. The Data class constructor alone throws IOEXception, but all other punlic method throws DatabaseException. Can we make it throw DatabaseException? How did you handled it?
(6) The delete() method does not check for any validation(file exist or not), but some other validation are done in add() & modify() methods. Do we need to check whether the record actually exists before setting it as DELETED_RECORD ?

Thanx. in Advance,
Shankar S
[This message has been edited by ShankarS (edited August 05, 2001).]
[This message has been edited by ShankarS (edited August 05, 2001).]
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did u implemented RMI call back for real time update?
No, I didn't and there is no requirement that you have to.
you said "I used a Vector but other than that mine was very similar to your current locking scheme...."
Do you mean to say vector is Syncronised ?

A Vector is syncronized and I did my lock and unlock methods in syncronized blocks like you described in your initial message.
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) Did you have the only .class files inside the Server.jar Client.jar?
Yes, I only had class files in the jars. I included the java files outside the two application jar files.
(2) Where did you place the Data.class files
I left the Data.class file in the db package along with all of the other files provided for the exam.
(3) Where did you place the source, class & doc files of Data, DataServer Implementation & the Data Client Implementation?
I put the documentation, javadoc set, and java files in the main jar file that also contained my Server.jar and Client.jar
(4) Did you have any nested .jar files ?
Yes, see answer above.
(5) This question is not about jar files. The Data class constructor alone throws IOEXception, but all other punlic method throws DatabaseException. Can we make it throw DatabaseException? How did you handled it?
I suppose you can make it throw a DatabaseException but I left it as it was.
(6) The delete() method does not check for any validation(file exist or not), but some other validation are done in add() & modify() methods. Do we need to check whether the record actually exists before setting it as DELETED_RECORD ?
I did not make any changes to the methods listed above.
 
Devu Shah
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for ur reply David,
I have changed my lock/unlock design by implementing vector.
on ur advice.
except for server part, u got full marks!!
Can u tell us the reason if u can guess it.
Could it because of search criteria design ?
thanks,
Devu
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Reck:
HashMaps are not sycnronized. I would recommend using another object that is or you will have to do something like Collections.synchronizedMap(new HashMap());.


I strongly disagree with this suggestion. The core of the locking code is an algorithm like:
1. while(record is locked) wait()
2. lock record
As has been pointed out, this block needs to be synchronized in its entirety. A synchronized collection is completely useless in this situation, will only slow things down (marginally), and possibly lure people into feeling "threadsafe" and not synchronizing code that needs to be synchronized.
In my SCJD submission, the locking map was not synchronized (although access to it obviously was).
- Peter
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Peter completely. I don't see why the container of the lock should be synchronized. If access to the container is synchronized, that will be sufficient.
O Muthu
 
David Reck
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter may be correct, I don't know. The only thing I have to go by is the fact that I passed. I did loose 4 points on my server design and maybe that was why.
David
 
O Muthu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David,
As Peter points out, synchronizing the lock container won't cause any harm other than slowing down the program a little bit. May be that's why they took off a few points.
Regards,
Muthu
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic