Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #20908

Recommended way to handle ClosedByInterruptException?

X-Received by 10.224.207.66 with SMTP id fx2mr26637089qab.7.1357181013930; Wed, 02 Jan 2013 18:43:33 -0800 (PST)
Received by 10.49.116.135 with SMTP id jw7mr7697020qeb.10.1357181013915; Wed, 02 Jan 2013 18:43:33 -0800 (PST)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!ee4no12524775qab.0!news-out.google.com!k2ni4226qap.0!nntp.google.com!ee4no12524769qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Wed, 2 Jan 2013 18:43:33 -0800 (PST)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=46.7.14.168; posting-account=iOAcbgoAAADC8J1iW-JMMSO74f5TboSg
NNTP-Posting-Host 46.7.14.168
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <2b4da3ee-0ca3-456d-ae92-5b36e6e1a769@googlegroups.com> (permalink)
Subject Recommended way to handle ClosedByInterruptException?
From raphfrk@gmail.com
Injection-Date Thu, 03 Jan 2013 02:43:33 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Received-Bytes 1885
Xref csiph.com comp.lang.java.programmer:20908

Show key headers only | View raw


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.

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


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