Ryan Tang

+ Follow
since Aug 20, 2003
Merit badge: grant badges
For More
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 Ryan Tang

Does it imply that there will be a new version of SCEA certification very soon?

I am using com.ibm.db2.jcc.DB2ConnectionPoolDataSource and have set the driverType property to 4, but the connection drawn from the data source does not support updatable ResultSet. Websphere application server reports that the JDBC driver version is 2.

How can I configure a DB2 data source such that the connection got from the data source support updatable ResultSet?

Thank you.


Originally posted by Reza Rahman:
Although it isn't absolutely essential, I'd like extend the DB interface to add a few more methods (most notably for resource cleanup because I'll be using synchronous I/O instead of caching in to make the database server less susceptible to sudden JM crashes). Since the Data class will still indirectly implement the unmodified DB interface, I should still be OK right?

To play safe, I create another interface, Database, which has all the methods in DB AND other methods that I think useful, says closing the database file. The database access class, Data, implements BOTH Database and DB interfaces DIRECTLY.


Originally posted by Frank Verbruggen:
When name/location pair is already known in the database,
of when all fields (except the "booked" field) match the input.

This is very unclear to me since NOTHING in the DB file specifies name/location as the key for a record !

Yes, and I chose NOT to throw DuplicateKeyException in my data access class implementation.
I documented this uncertainty in my choices.txt.

Originally posted by Andy Zhu:
I can't imagine: after 4 weeks of essay, I am still waiting and endless. The website shows pending for result. How long do I need to wait?

For me, after 4 weeks of waiting I sent an e-mail to Prometric. They replied me they would escalate my case to the Sun certification program manager as I had waited 4 weeks already.

After that (2 or 3 days) I can see my result at CertManager.

Just out of curiousity, why did you chooese HashMap over Hashtable?

Hashtable is somehow a "legacy" data structure in Java. HashMap is newly introduced in Java Collection Framework with Java 1.2.
You can have a look on this for more details.

Are you synchronizing on your HashMap within your update method? If so, why? It makes no sense to me to do such if all you are doing is a lookup. My understanding is that you should only synchronize the HashMap (or whatever locking structure you may have) during times you plan to delete (during unlock) or add (during lock) operations.

Quoting from the JavaDoc of HashMap:

If multiple threads access this map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally.

My interpretation on this is that I need to synchronize the HashMap EVERY time when it is being accessed, as there are some threads that "structurally" modify the thread.

Again, I'm not sure what you mean by this. Are you talking about your unlock record operation? Also, shouldn't unlockRecord handle the deletion of the locked record number?

My data access interface requires throwing RecordNotFoundException when unlock is called.
Thus my client does not(and actually is not allowed to)call unlock after delete. It is the delete method responsibility to clean up the locked record entry in the HashMap.
Congratulation for your pass!

I see you get a great score on locking. May be you can join my thread to share your implementation.

19 years ago
Login into:
19 years ago

I was lead to believe that that made a whole lot of difference.
a bunch of books and some people keep on warning about processes locking records and never releasing them.

May be I was punished for not implementing that in "General Consideration", if you see my score in the certification result forum.

What I'm wondering, did u also use a lot of objects,
or did u prefer a fast primitive typed solution ?

Just String[].

I did create something like a "Column" class, but it is used for returning the column name to the client for constructing the JTable.

I'm wondering, what did u do to avoid that a record be locked forever when it is locked by a process and then that process dies.


It can never release its lock then ?


Recently I passed the exam, and got 80/80 for the locking part. I would like to share what I have done which may be helpful for you to determine what Sun expects us to write.

If my post violates the rule, I am willing to apologize and please kill this post.

I use the simplest approach, static HashMap(not a weak one) storing the locked records and cookies, and it is synchronized whenever it is being accessed.

For update, first I check if the record is being locked by the specified cookie within the HashMap sync block. Then I perform the actual I/O update out of the sync block.

For delete, I do similarly as update, but include another HashMap sync block after delete to remove the locked record.

For lock, I perform the checking "is record already locked" and "does record exist" in the HashMap sync block, and wait if the record is already locked. Cookie is returned if lock is placed. It is the simpliest design.

For unlock, I perform record existence checking out of the HashMap sync block. I check if record is locked by the specified cookie and remove the locked record entry in the sync block.

I cache the database file using an ArrayList. For update and create operations, both the cache and database file are updated together. This caching logic is implemented in another class, CacheManager. It has methods like read, update and create to be used by the data access class. All these methods synchronize on the private ArrayList instance.


Hope it helps.

Best wishes,
Although I seldom participate in this forum, your posts definitely help me a lot to archieve the certification.

Thank you.


General Con: 86/100
Docmentation: 67/70
OOD: 30/30
GUI: 40/40
Locking: 80/80
Data Store: 40/40
Network Server: 33/40
19 years ago
Dear all,
I would like to implement the 48 hrs requirement such that a warning dialog is shown if date_available is a past date or date_available - now > 2 days.
I choose to compare only the date but not the hour field since there is no time field in the record.
User can choose to proceed booking and ignore the warning.
Such validation is implemented in the model class of my application, and i am not going to externalize anything (likes the "2 days" parameter) to the property file.
Is this OK?
Thank you!
Hi George,
Thank you for your help! I also find that I can have...

provided that the implementation throws exceptions no more than that declared in any one of the implemented interfaces.
I think I will go into this approach to simplify my design.