Stepan Mishura wrote:
Andrew, thanks for the test. But working test doesn't mean that there is no
bug :-)

AFAIK in our case an operation on file (if file is not exist - create file)
should be atomic. And it looks like Harmony implementation doesn't do in
atomic way.(see FileHandler.initOutputFiles() method)
Seems there is a bug in the FileHandler.initOutputFiles(), in Ln. 232, if the FileLock isn't held, the FileOutputStream should be closed before continue.

<code>
               lock = channel.tryLock();
               if (null == lock) {
//the FileChannel(or FileOutputStream) should be closed here
                   continue;
               }
</code>

But I didn't catch up what's the "atomic" means here, do you mean the tryLock() is not atomic or sth.? If so, any other solutions for Java codes? Otherwise, I think current implementation is fine, if two process try to open same log file at same time, only one process can get the lock by tryLock(), and the other will close the FileOutputStream then continue to try another log file name, anything I missed?

Thanks,
Stepan.



--
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to