Re: new FileWriter hangs
- From: HGA03630@xxxxxxxxxxx
- Date: 31 Jul 2005 00:07:17 -0700
mattias wrote:
> Hello. I have a java program where I repeatedly write to a log file,
> and at random times (typically after 100.000 writes or so) the program
> just hangs. I've found that this happens while executing a 'new
> FileWriter' command. I only have one thread writing to the file,
> there's no exceptions thrown or anything, the CPU usage just goes to
> zero and then nothing happens at all. Meanwhile, the log file remains
> globally locked for writing, i.e. I can't delete it in Explorer without
> first killing my java program. I experience this bug on a dual xeon
> processor machine, running Windows Server 2003 and java version
> 1.5.0_04.
>
> Here's the code, it hangs while executing the very first line of code:
>
> FileWriter fileWriter = new FileWriter("log.txt", true);
> BufferedWriter buffWriter = new BufferedWriter(fileWriter);
> buffWriter.write(message);
> buffWriter.newLine();
> buffWriter.close();
>
> If anyone has any ideas why this happens, please let me know. I guess
> in this case I could leave the file open at all times to avoid this,
> but I would be more interested to know the cause of it.
>
> Mattias
.
- References:
- new FileWriter hangs
- From: mattias
- new FileWriter hangs
- Prev by Date: Re: Generics error messages
- Next by Date: Re: The variable bit cpu
- Previous by thread: new FileWriter hangs
- Next by thread: Re: new FileWriter hangs
- Index(es):
Relevant Pages
|