• 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 SCJD

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't been a partcipant in this forum much, but I wan't to share my score and maybe help with some high level questions on the SCJD. First off, here is what I scored...
General Considerations(maximum = 72): 64
Documentation(maximum = 10): 10
Object-Oriented Design(maximum = 6): 6
GUI(maximum = 20): 18
Data conversion program(maximum = 10): 7
Server(maximum = 37): 35
I scored 140/155 90%. In my book that isn't bad. Just wish I knew what I was taken off for, but that would take away the flexability in this assignment.
In a majority of posts I have read, people get to bogged down in details. I don't know if this is a lack of experience or because of the intensity of what the progammers test was. This certification was... More enjoyable.... Easier, yes in a sense it was hands on. Just remember, meet the specs of the project and document what you did. Not in rediculous detail.
The written test, easy... It took ten minutes. They allocate 150 minutes. I don't know why. But if you did your assigment you will be able to answer the questions. Also know the pros and cons of RMI vs. Object Serialization and you'll be fine. Hope this info helps, and good luck to all.
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff:
Congratulations, man! Best wishes.
You mention some of the discussions, can you please elaborate on them.
Thanks.
Hope you'll stay around to help us out.
 
Jeff Holmes
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess I really meant that I have found a lot of discussions that deal with to much detail. Just not on this board. For Eaxample, I just read here where there was a post that the person is trying to Create a Lock file. Why? It's not required.. You're not going to score extra points on it... Just stick to the requirements and don't get bogged down. That's what I trying to get to. I had to catch myself a couple of times from trying to put extras in, it doesn't serve a purpose and can ONLY hurt you.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey mate,
I think you are an experienced programmer. What about novice ones?
I am a student and afraid of downloading the assignment coz i think anyone with exp can clear it else not.
Good programming practice comes with exp. Am i wrong?
Help me Please..
Thanx in advance
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congradulations Jeff,

That's so cool
Thank you so much for sharing your invaluble experience with us...
Rgds,
Shan
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations!
 
Jeff Holmes
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This goes out to Amit... Yes I am an experienced developer, but, Students can accomplish this too. It isn't an impossable assignment for you. It might take longer, but you can accomplish it. What's the worst that can happen? You don't get it your first time? Just use you resources here and give it a shot. Good Luck.
 
Amit Trivedi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks James
that was supporting. I am going to download the assignment. I have submitted the request.
Please tell me what softwares we need to solve the assignment. should i download JSP , sevlets separately or enterprise develpment kit would do. sorry for my ignorance
help
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Jeff,
I have an elementary question on lock/unlock.
As almost all methods in the Data class are synchronized, calling any of these synchronized method would put a lock on the Data instance. The lock would be released once the synchronized method has returned(which is equivalent to unlock). Then why use the methods lock() and unlock() specifically. And even if one uses lock() and unlock() what kind of coding will be written.
Further, say, lock() has been written. What is the need of unlock(). I suppose, once the code of lock() has executed the record automatically gets unlocked.
I fear I am missing something. Please explain in as much detail as possible.
TIA for your help.
 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations Jeff. Thanks for the advice of keeping it simple.
Consequently I am having second thoughts about my client design. I had designed it so that a user can submit concurrent requests i.e. user need not wait for request1 to complete before submitting request2. To ensure this I had to define a number of interfaces and classes, adopting a listener pattern for the gui-application layer interaction, and making the RMI calls in a separate thread, rather than the event-dispatch thread. I am now providing a simpler- single request at a time functionality.
Could you give me some hints about how you specified the 'control scheme' for the gui.
 
Rahul Rathore
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dhirendra
1. The lock() and unlock() method that we must implement are to ensure that database transaction is ATOMIC and CONSISTENT (ACID standard). This lock() is to be held against a specific record or against ALL records of the database.
2. The lock that a thread must acquire when executing a synchronized method, is a built-in core feature of the java language. This lock/monitor is obtained by a thread, on an Object (not a database record). A thread may synchronize on 'this' object or any other object. It ensures that no other thread which needs a lock on the SAME object runs concurrently.
If we adopt a bad design, the lock mentioned in point2 will suffice, and we would not need the lock mentioned in point1. This is possible if for every single ATOMIC transaction that a client can perform against the database, a single synchronized method() is defined in the database. For eg. we may defined a synchronized book() function within the data class. In such case there is no need to implement lock() and unlock() as mentioned in point1.
Unfortunately we can't place client-side logic in the database. The database has to remain generic. The client-side logic must remain on the client-local or remote.
So we must put an operation like book() on the client-side and implement it by calling the generic read/write methods of the data object.
Now consider what an ATOMIC book() operation involves:-
1. Read operation to find the number of seats available.
2. Check if seats requested <= seats available
3. If condition 2 is true then make write operation on database to reserve seats, decrementing available seats by 2.
Consider this scenario:-
Client1 wants to book 2 seats on a Flight (= a specific database record). Client1 executes Step1 to find the number of available seats. Client1 receives the return which shows that the number of available seats which is 2.
Just after Client1 executes Step1 (and before it executes Step3), another Client2 also executes against the same record (i.e. same flight) and books 2 seats.
Thereafter Client1 takes step2 and Step3, without knowing that Client2's actions have rendered the condition found in Step1 untrue. Here a write action to reserve non-existent seats may leave the database in an INCONSISTENT state.
It is thus clear that we need to externally implement a lock which fulfills the following conditions:-
1. It exists against a specific record (or ALL records),
2. It can live/survive across the several method calls necessary to implement a single ATOMIC transaction.
3. It is granted only to one client at a time for a given record.
Then the inconsistency mentioned in the above scenario would not occur if the clients follow a lock/unlock protocol to implement an ATOMIC transactions that involves database modification.
Thus Client1 should acquire a lock before executing Step1 and then release the lock after executing Step3.
It is thus guaranteed that while Client1 holds a lock against a record, Client2 cannot acquire a lock against the same record. This in turn guarantees that Client2 cannot modify the record until Client1 has completed its ATOMIC transaction and released the lock.
 
dhirendra singh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rahul,
Thanks for detailed reply. I have probably got a hang of half of it. What I understood is, that, for lock() I need to write -
void lock(){
synchronized(record){
//all the operations for atomic booking, eg, read(record),
//modify(record) etc.
}
}
However, I still do not understand unlock().
I mean lock() method uses 'synchronized' keyword to lock a record. How do I 'unlock()' a record?(1. There is no 'unsynchronized' key word. 2. Won't the lock automatically get released after lock() method has executed fully?)
Please clarify.
Thanks.
 
Rahul Rathore
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, this is NOT what I was saying. Please read my earlier post again.
It makes no sense to include book() code within lock method. And there can be any number of methods eg. cancelBooking() or modifyBooking() which may be defined subsequently.
In a good design, the book() operation will be defined on the client-side. The client will implement the book operation by calling read/write methods of the database.
The synchronized(record) is a lock which lasts only so long as as the synchronized block of that method is executed- This lock will be released by the thread as soon as the synchronized block is executed- so it does not survive between or during subsequent method calls which are part of an atomic transaction.
What you need to implement is a lock which exists CONTINUOUSLY across several method calls needed to complete on ATOMIC transaction. What you need is to define some way eg. a hashtable in the data class to store 'locks' against specific 'records'. These locks are NOT to prevent other threads from executing concurrently- these locks are only to prevent a thread from modifying a record, which is locked by another client. Don't confuse these database locks with locks associated with synchronization.
Thus the minimal logic of simple lock() method would be:-
1. Check in the hashtable, whether the same record is already locked.
2. If no, then grant a lock to the current thread by adding to hashtable, else make the current thread go into wait().
unlock() may be programmed to remove the lock from the hashtable and issue notify(), so that waiting threads may again loop from step1 of the lock method.
Depending upon your design, you can make your lock/unlock methods more sophisticated, by associating clientIDs with the locks granted, and allowing the database to control the time-period for which locks are held.
You may need to put in some effort to understand the concept of synchronization in Java language and then to understand the concept of ATOMIC transaction in database. Read some good books. Best of luck!

[This message has been edited by Rahul Rathore (edited March 11, 2001).]
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rahul,
congrats on passing the exam Jeff...
BTW, i was just thinking on the last part of your comment regarding the "unlock" which you say;
...remove record number from hashtable then issue "notify".
what if there is no thread waiting? I think it would issue an java.lang.IllegalMonitorStateException
can you advise me on this problem of mine (%?@#).It's been a tiring week actually.
Thanks

[This message has been edited by luis veron (edited March 14, 2001).]
 
Rahul Rathore
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by luis veron:
what if there is no thread waiting? I think it would issue an java.lang.IllegalMonitorStateException
][/B]


No it won't. If no thread is waiting, notify()/notifyAll() call will simply have no effect.
But the thread calling object.notify() should first acquire a lock/monitor over the object (The object may be 'this'). Otherwise IllegalMonitorStateException is thrown.
 
reply
    Bookmark Topic Watch Topic
  • New Topic