Fwd: AutoCloseable blocking or not (original) (raw)
Alan Bateman Alan.Bateman at oracle.com
Fri Oct 5 09:56:46 UTC 2012
- Previous message: hg: jdk8/tl/jdk: 7184932: Remove the temporary Selector usage in the NIO socket adapters
- Next message: Fwd: AutoCloseable blocking or not
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Forwarding Kasper's mail to the right list.
-------- Original Message -------- Subject: AutoCloseable blocking or not Date: Fri, 5 Oct 2012 11:42:35 +0200 From: Kasper Nielsen <kasperni at gmail.com> To: nio-discuss at openjdk.java.net
Hi,
I have a question about the AutoCloseable interface. Since I cannot find any mention about how asynchronously closeable resources should be handled.
Say I wanted juc.ThreadPoolExecutorService to implement AutoCloseable. When close() returned should the executor be in the shutdown phase or in the terminated phase?
In other words should I implement close() like this (which I believe)
public void close() { executor.shutdown(); executor.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); //ignore any interrupted exceptions }
or like this
public void close() { executor.shutdown(); }
- Kasper
- Previous message: hg: jdk8/tl/jdk: 7184932: Remove the temporary Selector usage in the NIO socket adapters
- Next message: Fwd: AutoCloseable blocking or not
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]