OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA
Roel De Nijs wrote:Reading a random access file is not an atomic operation. You have to perform 2 actions: position file pointer and read the record length. So when having multiple threads that should be made thread-safe. You have many options to do so: using synchronized block, marking method as synchronized, using new concurrency api,...
To pinpoint the problem I would mark your complete read method as synchronized. That means no other thread can access this method as long as another one is executing the code of this method. If your problem is solved using this approach, it will definitely have something to do with your ReentrantLock. If the problem is still present when using synchronized methods, we'll need to look at other possible reasons.
OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA
OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA
OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA
Himai Minh wrote:If my previous post describes your issue, you may want to try this:
OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA
OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA
Roel De Nijs wrote:Based on this bug report and this thread that could be the cause of your issues. Good job!
OCJA, OCJP, OCMJD, OCEJWCD, OCEJBCD, OCEJWSD, OCEJPA