YungSheng Chang

Ranch Hand
+ Follow
since Jul 28, 2003
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 YungSheng Chang

I was pretty frustrated by the bad score taken from HFEJB mock exam. However, the real exam is surprisingly much easier.
This is to encourage people who do not score high in HFEJB book like me. Given the number of correct answer, you could definetely score much more!!
15 years ago
I try to implement your code, but some member variables are not defined, such as gui.

According to my experience, there must some runtime exception thrown. Maybe the exception is swallowed. Make sure you do not catch an exception and print nothing. It is harmful for debug.

One suggestion is pack() may go to the line before setVisibl(true) at the end of gui initiation.
Hi Baris,
I think this is a very fundemental and important question in SCJD. Make sure you know what you mean when you add synchronized on a method. It is actually locking the corresponding object for that thread. Therefore, the question should not be "synchronize all method", it instead should be "overall locking mechanism".
In Max Habibi's book he suggest to synchorize all public methods. If you use the same wrapper class design, maybe it is a good idea. Still, the question goes to your locking mechanism.
Just remind you that the validation check should be thorough. For me, I implement not only if the record is booked by others, also the delete flag and booking time allowed (48 hours). I think those are real-time checking and should be asking database.

I am not sure about your bookMethod since I do lock() / unlock() in read already. Therefore all other client methods do not to call lock / unlock anymore. But maybe you are implementing it the other way. Be sure to run multithread test for this before you submit. It is extremely important that locking / unlocking happens as you are expecting and no deadlock happens in SCJD.
Using Data Cache or not is a desgin choice, and you should clearly describe your consideration in design documnet.
I choose to use it and the reason is to improve the reading performance. But it is not neccessary to do so.
Find has nothing to do with this consideration. To implement find method, you may need some other assistant method, such as getAllRecords(), getNumberOfRecords(). If you use data cache, it will be very easy to implement those methods.
What is important for the finding method is weather you clearly consider all scenario and code reuse. Weather you use data cache or not is ok.
I agree with you that repeating update should not be allowed; otherwise you will never know if your NBA final tickets are valid or not!!

The point is where you put the validation check. Some validation check is GUI implementation, and others is server side. For those real-time information, it should be server side.

Think of this scenario. A very lazy guy opens URLyBird, and he finds a room availabe in the screen. He enters his name "Lazy Guy" and goes to the movie without submit. In the time period, another guy books this record, and believes he got it. What happens when lazy guy comes back and clicks submit?
The system should not allow him to finish this transaction because he is too late!!

Think of your validation check again; which of them should be client gui, and which of them should check database. Hope this helps!!
For me, I just use java.lang.SecurityException since that is what the instruction specifies.

It is ok to get RuntimeException in the middle of code, as long as you expect it to happen, such as ArithmeticException.

I do no see any benefits of making your own SecurityException class; but for DuplicatedException and RecordNotFoundException class you should make your own.
Next is SCBCD....
16 years ago
16 years ago
Hi Nicholas:
In SUN website, there are three kinds of SCWCD.
- Sun Certified Web Component Developer for the Java 2 Platform, Enterprise Edition 1.3 (CX-310-080)
- Sun Certified Web Component Developer for the Java 2 Platform, Enterprise Edition 1.4 (CX-310-081)
- Sun Certified Web Component Developer for the Java 2 Platform, Enterprise Edition 1.4 Upgrade Exam (CX-310-082)
The third one looks like the most updated. However, it requires the completion of SCJP(any edition) and SCWCD(CX-310-080).
Does that mean there are two prerequisite for it? I have to take SCWCD 1.3 before I take SCWCD 1.4 update?
Hi Satish:
Could you provide the detail information for "Malvia & Hanumanth's" book?
Book Name, version, and author?
Many thanks.
This information is from George.
By default we do not have permission to upload the assignment (as crazy as that statement is it seems to be true). Therefore, I would strongly recommend sending an email like the following to, if you have not already done so. Otherwise you potentially face a delay in being able to upload your project.

Hi SunCert,
When attempting to upload the "Sun Certified Developer Assignment for Java 2," I received the following error message:
"You do not have the rights to upload that assignment..."
However, I feel that I should have the ability to upload this assignment. Please make it possible for me to do so.
Candidate: xxxxxx xxxxxxxxxx
Address: xxx xxxxx xxxx xxxxx
xxxxxxxxxxxx, xx xxxxx-xxxxx
Candidate ID: xxxxxxxxx
My confirmation of payment is: xxxxxx
Thank you for your assistance,
Hi Akash:
Is it already too late to reschedule your essay exam? You should make a call right now to make sure about it.
Otherwise, you still have the chance. From my experience, SUN responded my request on the same day. Hope that story happens to you too!!
Of course, the worst is to pay again. Don't let this scenario happen, this money is too easy for SUN.
Hi Satish:
I think the successful factor for locking is "good documentation". For most people including me, if they do not implement client crash, the physical code for locking is really short. However, you have to show the assessor all of your consideration in choice.txt and javadoc.
Because my english is quite poor, I list my design detail one by one. It is easy for assessor to read and make sure "this guys knows what he is doing".
I did not implement clien crash. But I left a room for future extension with the same object design, and document all my reasons.
Yes I did save saver shutdown in server gui. And I handle this scenario on client side well too.
I have some general suggestion about locking:
1. Do not implement client crash. It will makes things complex, quite complex.
2. Definetely test it. Is the record really locked when you think it should be? and the waiting? and unlock?
3. If you really don't know where to start (like me), look at Max's book. This guy really points out a way for us.
The following is my locking mechanism:
1. Class Architecture:
Network clients access the same remote database connection object
(Database) through RMI. Object Database wraps
MyDBAccessAdapter, which executes the locking/unlocking.
This means that locking/unlocking is hidden from clients. Clients
are forced to follow lock/unlock procedure.
2. Contract for the use of locking process:
To use lock/unlock, the method must follow lock/process/unlock
Unlock should be guaranteed to be executed under any exception.
In the lock/unlock method, the thread should first
acquire the exclusive use of LockManager object, and notify all
thread waiting on it after it finishes operation.
3. LockManager class:
A static LockManager class is used.
A logical key-value mapping relationship is maintained by
LockManager.The key is the locking record number, the value is its corresponding LockMessage value. The LockMessage stores information about cookie value, thread name and lock time. Cookie value and thread name is checked while unlocking is called to verify the unlocking authority.
16 years ago