Hi Mike,
Welcome to JavaRanch and this forum!
I am planning on implementing my code around multiple raf instances but I have one concern. If I have two threads each with their own RAFs and one adds a record to the RAF, is the other thread's RAF automatically aware of the write? Or will the RAF file pointer be out of wack?
Other RAF instances won't be "aware" of records added by others, but they don't *need* to. For each read or write, you'll have to compute a position in the file and use seek() anyway, the useful information to determine whether a given operation can be performed or not, being shared through the file itself.
About what Satish write:
But utmost care should be taken that no two raf instances are working on same record.
I'd like to add that only *writes* should be exclusive at the record level: allowing multiple threads to read the same record is OK, and even desirable.
Baruch:
I do see a strong benefit in working with one static RAF - the simplicity. Simplicity in multithreading, simplicity in not managing pool, etc. (...)
"A clear design, such as will be readily understood by junior programmers, will be preferred to a complex one, even if the complex one is a little more efficient."
And that's why I think (and wrote already) that both designs are defendable: even if less simple, RAF connections pooling may be
much more efficient.
Regards,
Phil.