On 19 April 2011 15:30, Stefan Bodewig <bode...@apache.org> wrote: > On 2011-04-19, sebb wrote: > >> On 19 April 2011 06:35, <bode...@apache.org> wrote: > >>>> // this flag is only written here and read in finalize() which >>>> // can never be run in parallel. >>>> // no synchronization needed. > >> Are you sure? > > At least as long as finalize is not called by anybody else but the > garbage collector. > > You can't call close without a reference to the object and as long as > such a reference exists finalize will not be called.
OK, I was thinking that GC would be equivalent to a separate thread. But thinking about it, I suppose the JMM must make special provision for the GC to ensure that cached writes are flushed. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org