wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Passed with 148 / 155 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 "Passed with 148 / 155" Watch "Passed with 148 / 155" New topic
Author

Passed with 148 / 155

Theo Heinrichs
Greenhorn

Joined: Jun 04, 2001
Posts: 14
Hello all,
yesterday I got my results:
"General Considerations(maximum = 58): 56 Documentation(maximum = 20): 20 GUI(maximum = 24): 21 Server(maximum = 53): 51."
Short summary of my solution:
- simple GUI with multi-threaded booking
- main menu, mnemonics, key accelerators, user online help
- can switch between local and remote mode within GUI
- used object serialization over TCP sockets
- modified Data class, but added interface for it
- implemented the full database lock
- lock and unlock via wait() / notifyAll(), simple client identification. Did not change lock and unlock signatures in Data class!
- server is simple multi-threading, e.g. no thread pool.
Many thanks to all of you, this forum helped me a lot!
Theo
Conor Allen
Ranch Hand

Joined: Apr 27, 2001
Posts: 32
Hi,
Congratulations. Quick question ... did you attempt to track the clients, and if not how did you justify that decision?
Cheers
Conor
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1845
Theo Heinrichs,
<H2>
Congrats great going..
</H2>
So what next???
------------------

Mahindrakar
IBM Application Server Forum Moderator
Consultant - Zensar Technologies.
SCJP2 & SCJEA (Part I)
Theo Heinrichs
Greenhorn

Joined: Jun 04, 2001
Posts: 14
Hi Conor,
yes, I hold a set of all clients with their locks. The class managing this set must be synchronized separately.
However, I do not track client startups or deaths: when a client dies in the middle of a transaction, it leaves a dead record in there. Perhaps that is where I lost my 2 marks ...?
Hi Rahul,
thanks a lot!
Next thing I do is clean up my hard disk and make some vacation .
Brad Manning
Greenhorn

Joined: Jun 01, 2001
Posts: 6
Theo, congradulations.
Nice to hear that somebody else is using object serialization.
In your server did you simply create a new thread for each incoming request? How did you justify this in terms of resources used?
Thanks Brad
Theo Heinrichs
Greenhorn

Joined: Jun 04, 2001
Posts: 14
Hi Brad,
yes, I just spawn a new thread per request. The thread unpacks the parameters, does the database stuff, and packs results (or exceptions) into a return object.
I played with a thread pool, you may find good coding for it in the "Complete Certification Guide" (Roberts et al). However, it seemed overly complex for this project. I documented both approaches in my design doc.
Regards, Theo
Prabhakar
Greenhorn

Joined: Jun 06, 2001
Posts: 1
Hi Theo,
Congrats for your achievement.
I need ur help in understanding the locking/unlocking requirement.
From what i could gather so far, multiple clients share access to the same database file and all access/modify methods to this database are synchronized. Only the writeRecord method is not synchronized. Why?
We are told in the instructions to ensure thread safety by using lock/unlock methods for the write operation. Since the writeRecord method is a private one and is called only inside the synchronized methods add and modify, why is a record lock needed?
Does this mean that different clients will be using different instances of the database file? This makes sense because I think each client will create an instance of the Data Class using the 1st constructor and access its methods. But then how will a master or common database be maintained?
I am confused and would appreciate ur help.
Thanks for ur time
Prabhakar Thopa
Greenhorn

Joined: Jan 08, 2001
Posts: 3
Hi,
Thanks. I just found out why
Prabhakar


Prabhu
Ashish Kulkarni
Greenhorn

Joined: Jun 07, 2001
Posts: 3
Do you need to put help on GUI?? and Congradulations
Brad Manning
Greenhorn

Joined: Jun 01, 2001
Posts: 6
Theo, thanks for the reply on my previous question.
I just have one more concern...
When you spawned a new thread did each instantiate its own data class and if so did you perform locking using wait/notify (since sync keyword locks an object not a class)?
(Basically I created a singleton class which controls a linked list which contained elements that represent the various locks on records, no wait/notify whatsoever).
Thanks Brad
Theo Heinrichs
Greenhorn

Joined: Jun 04, 2001
Posts: 14
Hi Ashish,
my understanding of the instructions is that you do not *need* to add online help. However, if you do, it should be a "subset" (whatever that means...) of the user documentation (which shall be plain ASCII text). I just liked the idea because of the requirement of "good human-computer interaction".
Hi Brad,
my database is a "singleton", i.e. there is only one instance of it. So, I can use wait/notify.
Sorry guys for my late reply, I was away for a few days and had *no* internet access
Best regards, Theo
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Originally posted by Theo Heinrichs:
Short summary of my solution:
- modified Data class, but added interface for it
- Did not change lock and unlock signatures in Data class!
Theo[/B]

Did you have an abstract Data class in between the server side and client side implementations?
Brad Manning
Greenhorn

Joined: Jun 01, 2001
Posts: 6
Theo, since you used a singleton data base, what purpose would the lock methods serve, since only one thread will ever enter the data class to access the database (ie only one thread will hold the objects lock at one time). It seems to me that its an either - or scenerio. Either use multiple data classes and lock methods (so that there really could be two threads in the database concurrently, perhaps 2 read threads, or 2 write threads on different records), or a single data class with wait notifyAll (such taht each thread will wait, and there is no real concurrency), using both singleton and lock methods seems unnecessary (to call a lock method to get a lock, but then have to contend for the data class' object lock anyway because of synchronization).
I think for my own code, I'm creating too many objects to control locking. I'm caught up in the idea that 2 threads wishing to write to different records can do so at the same time.
Thanks,
Brad
Theo Heinrichs
Greenhorn

Joined: Jun 04, 2001
Posts: 14
Hi Nigel,
yes, I have a class which implements the above mentioned interface. However, it is not abstract.
Hi Brad,
let me try to clarify things a bit:
lock() and unlock() are synchronized so the internal data structures for the locks do not get corrupted. Threads may be sent to sleep because a particular lock (or the full db lock) hinders them to continue. However, there is no restriction in the total number of threads working in the class! Whenever a thread goes to sleep, it releases the object's monitor, so another thread can slip in and do its work.
The whole thing is very similar to the example in the Roberts et al book, I think it was section 7 (Threads).
You are right in that most of the work in the Data class is serialized, since most of the methods are declared "synchronized".
I think to have multiple "Data" objects is very dangerous, because "Data" holds some local variables, and synchronization will only be possible via class locks, which seems unnecessarily complex here.
Regards, Theo
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passed with 148 / 155
 
Similar Threads
Passed with score of 148/155
Passed - 151
passed SCJD 145/155
SCJD Passed and Thank you
YAHOO...... I Made it.... 146/150