Hi all,
I brought and finished Andrew's
SCJD exam book, also read many precious articles in this forum, many thanks to this website; and hope you experts could help answer the following questions-
1.) In Andrew's book, he uses both the techiques of synchronized block and ReetrantReadLock to handle the concurrency of shared object, I intend to use
Java 1.5 version to implement my assignment, will I get pentaly to only use synchronize block?
2.) The sample source 'DVDFileAccess.java' in Andrew's book,
After the execution of line 1, current
thread 'A' may be blocked and the control is then passed another thread, say 'B', to complete record creation. If thread A is back and resumes the record creation, duplicate record is added. Is it a better idea to recheck UPC value after line 2?
3.) Regarding application design layer, I would like to keep it simple so it is
GUI layer -> remote layer -> Adaptor layer -> Data Access layer (Data.class -- complusory class in my assignment) -> Database layer (physical DB file manipulation)
or
GUI layer ->Adaptor layer -> Data Access layer -> Database layer
According the specification of my assigment B&S 2.2.3,
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:" Will my design fulfill it, or do I have to remove the database layer and let the Data Access layer directly access the DB file?
4.) In database layer, I would like to create a singleton Object,
this idea is introduced by 'Head first Design
Patterns', which is solely responisble any updating. Does it design still work? (According to the article "double-checked locking and the singletonattern of Peter Haggar -- old JVMs like JDK1.2.1 resuls in the out-of-order write problem,
web page)
Refer to Andrew's book, he uses a static variable to declare the singleton file access object within the data access layer (database.java), is the above approach better or Andrew's one?
Thanks for your help.