Mike Matrigali <[EMAIL PROTECTED]> writes:

> getChannel() has comments that say callers should synchronize when
> calling.
>
> 1) why not just put the synchronization in this routine?

It is only called two places, and those two places already have a
synchronized block because of calls to getCommittedDropState(). So
synchronizing the routine wouldn't help us simplifying the code in any
of the callers.

> 2) There are 3 calls in this file that are not synchronized, is that a
> problem?  (writeAtOffset and getEmbryonicPage and
> getChannel(StorageRandomAccessFile file)

These shouldn't cause any problem because

 - getEmbryonicPage() and writeAtOffset() call
   getChannel(StorageRandomAccessFile), not getChannel(void)

 - getChannel(StorageRandomAccessFile file) calls
   RandomAccessFile.getChannel(), not RAFContainer4.getChannel().

The reason why RAFContainer4.getChannel() needs synchronization, is that
it updates a field (ourChannel). getChannel(file) only works on local
variables and therefore doesn't need synchronization.

> I have no idea if this is a problem at all, just trying to guess at a
> cause for      DERBY-3607

-- 
Knut Anders

Reply via email to