On Wed, 3 May 2006 07:32:10 -0400
"Ioan - Ciprian Tandau" <[EMAIL PROTECTED]> wrote:

> I told him about getFD().sync() (for FileInput/OutputStream and
> RandomFile.... It seems to be the only way to make sure things are
> synchronously written to disk (local storage).

The fact that the file is physically written to disk is not important
because the OS will provide the last contents of a file either from
disk or from the buffers. Flushing the buffers to disk is only
important when one doesn't want to lose data when the system crashes.

I believe that the OP's problem is that the copying of the file happens
in a different thread than the use of the copy by the test routine. In
this case, the thread performing the copy can still be busy while the
thread performing the test is being scheduled. 

Other than synchronising the threads, the OP could try to copy to a
file in a staging directory below the directory where the final copy
needs to be placed, and then rename the file after the copy completes.
File renaming is atomic on Unix/Linux. 

-- 
Stefaan
-- 
As complexity rises, precise statements lose meaning,
and meaningful statements lose precision. -- Lotfi Zadeh 


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to