commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JavaDev7 <>
Subject Re: [io] FileMonitor. How to deal with a huge file whom copy is longer than file monitor checkAndNotify call frequency
Date Wed, 27 Apr 2011 07:48:24 GMT

on windows, it is simple to detect if file was copied or is copying..
You should start thread and check if you can obtain lock on file if not 
you sleep on some period and then try again..

FileChannel fileChannel = file.getChannel();
 fileLock = fileChannel.tryLock();
            if (fileLock != null){
                System.out.println("File is locked");

Here is link with sample code:

The problem is on linux where you can obtain lock on copying file..
We solved this problem by renaming file with correct extension after copying
was complete...

View this message in context:
Sent from the Commons - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message