public final void dispose() {
if (disposed) {
return;
}
IoFuture disposalFuture;
synchronized (disposalLock) {
disposalFuture = this.disposalFuture;
if (!disposing) {
disposing = true;
try {
this.disposalFuture = disposalFuture = dispose0();
} catch (Exception e) {
ExceptionMonitor.getInstance().exceptionCaught(e);
} finally {
if (disposalFuture == null) {
disposed = true;
}
}
}
}
idleStatusChecker.getNotifyingTask().cancel();
if (disposalFuture != null) {
disposalFuture.awaitUninterruptibly();
}
if (createdExecutor) {
ExecutorService e = (ExecutorService) executor;
e.shutdown();
while (!e.isTerminated()) {