File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes use of seek() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "use of seek()" Watch "use of seek()" New topic
Author

use of seek()

luis veron
Ranch Hand

Joined: Mar 07, 2001
Posts: 35
hello,
Guys, can you explain what will happen if for example there were 2 users trying to search for a flight with different search criteria. If pc A tries to search and within the criteriafind method, we use the method seek(50), and another guy tries to search also and try to seek(100), this would be an issue since the db file position would be inconsistent. I think the reason why the Data class was declared synchronized is because to prevent this kind of inconsistency.
But if we continue to use the synchronized seek() method, the idea of concurrent reading of each record would be useless..
Come to think of it, If I'm going to read through the whole db to find the matching search criteria, anyone who try to search will need to wait after I finished using my criteriaFind() method. I think the filepointer is an issue here?
Any other idea about this.

Thank you very much
Luis
[This message has been edited by luis veron (edited March 20, 2001).]
luis veron
Ranch Hand

Joined: Mar 07, 2001
Posts: 35
It seems no one is interested in giving ANY answer/clarification to my inquiry..been waiting for reply ever since I posted this topic.
Nevertheless, Thanks for your support.
[This message has been edited by luis veron (edited March 22, 2001).]
Aron J. Skantz
Greenhorn

Joined: Oct 12, 2000
Posts: 26
Luis,
Personally I havn't replied since I don't understand what the question is and was kinda hoping that someone else would be more intelligent and respond

\Aron
Sam Wong
Ranch Hand

Joined: Dec 07, 2000
Posts: 133
Luis,
Your points are quite correct. The synchronized methods will not be efficient. In the real world, would you use a file pointer? No. A database server is the most likely choice. But for the purposes of this exam, it isn't available. Hence, synchronized access will have to do. So, don't sweat over it.
Sam
 
 
subject: use of seek()
 
Threads others viewed
Question about criteria string
IllegalArgumentException criteriaFind
criteria search concurrency
criteriaFind() criteria
CriteriaFind() location
MyEclipse, The Clear Choice