wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Database lock() method test. 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 "Database lock() method test." Watch "Database lock() method test." New topic
Author

Database lock() method test.

Marcin Mroczkowski
Greenhorn

Joined: Apr 15, 2013
Posts: 17

Below test can throughtly check blocking ability of database .lock() method. This feature is one of the most important MUSTS in OCMJD assignment, and it's commonly overlooked by standard tests. This code locks random records, and then creates additional threads, to check two things:
- if .lock() method blocks other threads for locking same record
- if record is not locked, it can be always locked with no problems

If code deadlocks, its simple mean that .lock() method erroneously blocked, when record is not locked by other thread.



OCJP 6, OCMJD 6
 
jQuery in Action, 2nd edition
 
subject: Database lock() method test.
 
Similar Threads
Why the EOFException always thrown ?????
Data class multithreaded load test (UB1.1.2)
Tests for the Data class/locking mechanism
Locking policies and general architecture doubts.
NX: About data consistent