Article View: borland.public.jbuilder.java.api
Article #116Re: Too many open files error thrown from java.io.File
From: Scott
Date: Wed, 14 Apr 2004 19:38
Date: Wed, 14 Apr 2004 19:38
39 lines
2400 bytes
2400 bytes
Owen, Thanks for your help. Scott "Owen Green" <o.t.green@ntlworld.com> wrote in message news:2c0nm8qvwwdo$.dlg@borkborkbork.bork... > On Sat, 10 Apr 2004 10:43:34 -0400, Scott wrote: > > > Owen, > > > > Thanks for the advice on the try/finally approach. > > > > One question: if a method (call it readMyStream) receives the stream as a > > parameter, should I close it in readMyStream, or in the method that passed > > the stream to readMyStream? > > The same applies here as applies to discarding objects in languages with > destructors - it should, for preference be done in the same scope as the > object was created. If that isn't possible then look at having some sort of > central pool that will ensure that streams are properly closed. > > > In a way, I'm still not clear when the stream gets opened -- when it's > > instantiated or when the first read or write operation is performed. > > Assume it's when the stream is created. > > > And I'm not clear if close() would cause the next read/write request to fail > > (because it's closed) or those would just re-open the stream. > > Future operations should fail. > > -- > Owen
Technical Details
Message-ID:
<407d93bf$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!npeer.de.kpn-eurorings.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<406edc6e$1@newsgroups.borland.com> <407073e5$1@newsgroups.borland.com> <40708fae$1@newsgroups.borland.com> <12t5q88i275kw.dlg@borkborkbork.bork> <11b43zwzhv51k.dlg@borkborkbork.bork> <40780885@newsgroups.borland.com> <2c0nm8qvwwdo$.dlg@borkborkbork.bork>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,606a3d8ee4cf8a04 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2004-04-14 12:49:31 PST Reply-To: "Scott" <scotthpowell@yahoo.com> From: "Scott" <scotthpowell@yahoo.com> Newsgroups: borland.public.jbuilder.java.api References: <406edc6e$1@newsgroups.borland.com> <407073e5$1@newsgroups.borland.com> <40708fae$1@newsgroups.borland.com> <12t5q88i275kw.dlg@borkborkbork.bork> <11b43zwzhv51k.dlg@borkborkbork.bork> <40780885@newsgroups.borland.com> <2c0nm8qvwwdo$.dlg@borkborkbork.bork> Subject: Re: Too many open files error thrown from java.io.File Date: Wed, 14 Apr 2004 15:38:39 -0400 Lines: 41 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 24.239.150.17 Message-ID: <407d93bf$2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1081971647 24.239.150.17 (14 Apr 2004 12:40:47 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!npeer.de.kpn-eurorings.net!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail