Ralf Riedel

Greenhorn
+ Follow
since Dec 30, 2002
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ralf Riedel

Hi Mark,
I'd rather avoid to give them command lines like

copy <root dir>\db.db <location>\db.db


which imply a certain operating environment. The fact that you developed under win32 might no be a justification for this.
My instructions state that

... Specifically, you should document clear, simple command lines that allow your programs to be run on any Java 2 platform, regardless of the underlying hardware and operating system.


The assessor is supposed to type just what you dictated on his machine, and respond with an "automatic failure" exception.
Greetings.
Ralf
Hi Zhou,
think about how your gui behaves with long running (say, 2 seconds) method calls on the server - if you call those methods from the gui thread, the client will look frozen to the user. Just for fun, I've inserted a sleep into the criteriaFind() method, and it felt bad
Maybe with the 24 records in the assignment this all is no problem, but I always tried to keep a real environment in mind.
Greetings,
Ralf

In my assignment, all the methods of Data that use seek() are already synchronized. Threfore, if all threads use the same instance of Data, the methods are thread-safe.


Oh, seems that I was misled. Yes I've got the assignment samples with the right methods synchronized. I just got somehow unsure about this while following the discussion.
Thank you very much for making this clear.
- Ralf
Hi all,
I'm still confused ...
besides the question whether to modify Data and introduce blocks - what about the file pointer??
I still think it is necessary to synchronize all threads that modify the file pointer. And since Data holds exactly one file handle, isn't it ok to use the synchronized keyword on the Data methods ?
About synchronizing again:
In my sample code for the Data class a RandomAccessFile is used for directly for storage, and in almost every method seek() is called to position the file pointer. So in my understanding every method that deals with the file pointer has to be synchronized thus preventing other threads from repositioning the pointer.
Am I wrong with this?