Atomikos Forum

OverlappingFileLockException even if logging is false

In file UserTransactionServiceImp.java in Atomikos 3.3.3

this code is wrong

        try {
            lockfilestream_ = new FileOutputStream ( lockfile_ );
            lock_ = lockfilestream_.getChannel().tryLock();
            lockfile_.deleteOnExit();
        } catch ( IOException failedToGetLock ) {
            //happens on windows
            lock_ = null;
        }

method tryLock() throws OverlappingFileLockException not IOException.

Good code :

        try {
            lockfilestream_ = new FileOutputStream ( lockfile_ );
            lock_ = lockfilestream_.getChannel().tryLock();
            lockfile_.deleteOnExit();
        } catch ( OverlappingFileLockException failedToGetLock ) {
            //happens on windows
            lock_ = null;
        } catch ( IOException failedToGetLock ) {
            //happens on windows
            lock_ = null;
        }

Maybe this piece of code shouldnt never run when enableRecovery is false ? Not sure.
cesnek Send private email
Tuesday, September 23, 2008
 
 
Again, thanks for this. Another case ;-)

Guy
Guy Pardon Send private email
Tuesday, September 23, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics