Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20911
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Knute Johnson <nospam@knutejohnson.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Recommended way to handle ClosedByInterruptException? |
| Date | Wed, 02 Jan 2013 19:48:26 -0800 |
| Organization | A noiseless patient Spider |
| Lines | 41 |
| Message-ID | <kc2v2b$1vq$1@dont-email.me> (permalink) |
| References | <2b4da3ee-0ca3-456d-ae92-5b36e6e1a769@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 3 Jan 2013 03:48:27 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="9b3fcb0d22708969e4dc99e7aa0ef1f9"; logging-data="2042"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+G/QgCWSN+MYETukVfP3ec" |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| In-Reply-To | <2b4da3ee-0ca3-456d-ae92-5b36e6e1a769@googlegroups.com> |
| Cancel-Lock | sha1:bGe/cfsqzV6bmlcboe7amSOqCys= |
| Xref | csiph.com comp.lang.java.programmer:20911 |
Show key headers only | View raw
On 1/2/2013 6:43 PM, raphfrk@gmail.com wrote: > This is an example of what causes this exception > > http://hastebin.com/mayuyuvimu.avrasm > > This gives: > > Exception in thread "main" > java.nio.channels.ClosedByInterruptException at > java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202) > > at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:880) > at Main.main(Main.java:17) > > ---------------------- > > Anyway, there doesn't seem to be any sane way of dealing with this. > If interrupt is intended to mean stop what you are doing and stop the > thread cleanly, then this works against that. This prevents you > doing any more writes to the file. Is the intention that you reopen > the file and then do the writes. > > Also, it doesn't even clear the interrupted flag. So, you have to > wipe the flag manually if you want to repeat the write attempt. > I think the intent is that interrupting a blocked file channel is an immediate abort, not a way to stop the thread cleanly. From the docs on ClosedByInterruptException; "Checked exception received by a thread when another thread interrupts it while it is blocked in an I/O operation upon a channel. Before this exception is thrown the channel will have been closed and the interrupt status of the previously-blocked thread will have been set." Are you deliberately interrupting the thread or is something unanticipated happening? -- Knute Johnson
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Recommended way to handle ClosedByInterruptException? raphfrk@gmail.com - 2013-01-02 18:43 -0800
Re: Recommended way to handle ClosedByInterruptException? Knute Johnson <nospam@knutejohnson.com> - 2013-01-02 19:48 -0800
Re: Recommended way to handle ClosedByInterruptException? raphfrk@gmail.com - 2013-01-03 13:12 -0800
Re: Recommended way to handle ClosedByInterruptException? Knute Johnson <nospam@knutejohnson.com> - 2013-01-03 15:51 -0800
csiph-web