This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi. I'm just starting my SCJD and I have a quick question. I looked thru some of the posts and see that there are a lot of people concerned about concurrency.
My assignment is B&S and I have the following line in my spec
"You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server."
Now is this requirement different in other projects cuz to me this means that no sync of read/write to the file is needed. What is needed it to make sure that only ONE client can execute ONE of the interface methods at the time. So I'm wondering why are you even discussing concurrent file reads/writes.
Concurrent read and write means that one client send request about writing file, and the other send request about reading file. I think so.
The server must handles all the concurrency issue because it must handle more than one clients with different request.
Jeffry Kristianto Yanuar Java Instructor SCJP 5.0 SCJA SCJD (Working on UrlyBird 1.3.2) --> preparing to upload
Zlatan Hajric
Greenhorn
Joined: Sep 18, 2008
Posts: 10
posted
0
Well I understand what concurrent means but if you assume what is written in the specification
"You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server."
and one program is one client than the scenario of 2 clients trying to write or read the data at the same time shouldn't even be concerned. The only issue you have is not allowing client B to modify the record client A has a lock on. Read is not a problem. So 2 clients connecting to a server at the same time is fine but accessing the file at the same time according to the spec is nothing to worry about.
Originally posted by Zlatan Hajric: So 2 clients connecting to a server at the same time is fine but accessing the file at the same time according to the spec is nothing to worry about.
I think you understand it correctly, but I'll rephrase it to be sure.
The spec says you don't have to worry about another application accessing the data file, you only have to worry about your own application.
Since your application/server allows multiple clients, your Data implementation still have to handle multiple clients/threads accessing the Data file concurrently (Each client call received on the server will run in a seperate thread, so 2 clients call would result in 2 threads running on the server...).
Regards, Alex [ September 21, 2008: Message edited by: Alex Belisle Turcot ]
What this sentence means is: "your server can be sure that no other application is accessing it (other server or other program) but this server must handle concurrent clients".
I also have B&S and in the introduction explains that the application that we have to develop has to coexist with a legacy system. They add this sentence to tell you explicitly that no other system process can modify your server except by the server you're developing.
I hope it helps,
Iv�n
Iván Párraga García
SCWCD 5, SCJD, SCJP 5, MySQL 5 DBA