MumbleCloseable
Remi Forax
forax at univ-mlv.fr
Fri Jun 28 14:40:57 PDT 2013
On 06/28/2013 11:05 PM, Joe Bowbeer wrote:
>
> On Fri, Jun 28, 2013 at 1:20 PM, Brian Goetz <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
> 1. What happens if close needs to throw an exception? Why is
> this form
> of close different from others?
>
>
> It was a mistake from Day 1 to allow Reader.close() and friends to
> throw anything checked. I mean, what could a caller *possibly do*
> to respond to such an exception? Close it again? OK, live and learn.
>
>
> Treat it like the IOException that it is! How does an app respond to
> IO exceptions? They often give the user the chance to try again...
> They generally don't silently ignore or crash.
>
> The proper handling of code like this involves a try-finally (resource
> management) nested inside a try-catch (to manage IO exception), in
> which case the IOException on close does not need special handling.
This is older than Java Day 1, Unix close() can return 1 with errno=EIO.
Rémi
More information about the lambda-libs-spec-experts
mailing list