File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Concurrency Testing - 2.0 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 "Concurrency Testing - 2.0" Watch "Concurrency Testing - 2.0" New topic

Concurrency Testing - 2.0

John Samuels

Joined: Jul 29, 2011
Posts: 9
Hi there!

I've been watching these forums for the past couple of weeks (ever since I started working on my OCMJD). It's certainly an excellent resource! One particular stand out is Roberto Perillo's DataClassTest, which inspired me to create the following piece of code. Many of the main ideas remain his; the changes mainly deal with rigorousness and generalness. The mechanism for the execution of the test threads has been changed such that the Data class is put under more concurrent pressure. This is especially helpful since, as well all know, concurrency bugs don't always manifest themselves and they must be put under as much rigor as possible. The mechanism with which each test is created has been made more generic, relying purely on what the DB interface requires. For instance, I didn't have "Room"s or RoomRetriever utilities (maybe I should?), so I had to make substantial changes to the code before I could use it.

I hope this helps! If it doesn't, please tell me how I can improve it. Thanks!

Note: My implementation of 'delete' automatically unlocks the record. To me, that makes the most sense - once you delete a record number, attempting to unlock that record number should result in a RecordNotFoundException being thrown. If that's not how you implemented it (Roberto's original DataClassTest, for instance, assumes so), make sure you add "db.unlock(recNo, cookie);" after "db.delete(recNo, cookie);".

Dmitry Kotlov

Joined: Sep 09, 2011
Posts: 23

Hi Howard!
I've tested my Data class by means of your test.
I found it very helpful! Thanks a lot!

Best regards,

OCMJEA, OCJP, OCJD, OCE SQL, OCP Forms Developer, OCP PL/SQL Developer
I agree. Here's the link:
subject: Concurrency Testing - 2.0
It's not a secret anymore!