Concurrency of RandomAccessFile in Java

Viewed 3199

I am creating a RandomAccessFile object to write to a file (on SSD) by multiple threads. Each thread tries to write a direct byte buffer at a specific position within the file and I ensure that the position at which a thread writes won't overlap with another thread:

file_.getChannel().write(buffer, position);

where file_ is an instance of RandomAccessFile and buffer is a direct byte buffer.

For the RandomAccessFile object, since I'm not using fallocate to allocate the file, and the file's length is changing, will this utilize the concurrency of the underlying media?

If it is not, is there any point in using the above function without calling fallocate while creating the file?

2 Answers
Related