Article View: borland.public.jbuilder.java.api
Article #115Re: Too many open files error thrown from java.io.File
From: Owen Green
Date: Wed, 14 Apr 2004 12:17
Date: Wed, 14 Apr 2004 12:17
27 lines
2059 bytes
2059 bytes
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:
<2c0nm8qvwwdo$.dlg@borkborkbork.bork>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!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>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 05:39:49 PST From: Owen Green <o.t.green@ntlworld.com> Subject: Re: Too many open files error thrown from java.io.File Newsgroups: borland.public.jbuilder.java.api MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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> Date: Wed, 14 Apr 2004 13:17:58 +0100 Message-ID: <2c0nm8qvwwdo$.dlg@borkborkbork.bork> User-Agent: 40tude_Dialog/2.0.5.1 NNTP-Posting-Host: 80.1.205.234 X-Trace: newsgroups.borland.com 1081945226 80.1.205.234 (14 Apr 2004 05:20:26 -0800) Lines: 27 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail