Indicate that the instance is effectively closed.

        :param future: The close future.
162076
def _set_closed(self, future):
        
        logger.debug("%s[%s] closed.", self.__class__.__name__, id(self))
        self.on_closed.emit(self)
        self._closed_future.set_result(future.result())
1272532
def do_close(self, args):
        """"""

        if not self.current:
            print('There are no resources in use. Use the command "open".')
            return

        try:
            self.current.close()
        except Exception as e:
            print(e)
        else:
            print('The resource has been closed.')
            self.current = None
            self.prompt = self.default_prompt
1022548
def wait_closed(self):
        
        if self._closed:
            return
        if not self._closing:
            raise RuntimeError(
                ".wait_closed() should be called "
                "after .close()"
            )

        while self._free:
            conn = self._free.popleft()
            if not conn.closed:
                yield from conn.close()
            else:
                # pragma: no cover
                pass
        with (yield from self._cond):
            while self.size > self.freesize:
                yield from self._cond.wait()
        self._used.clear()
        self._closed = True
495183
def onClose(self, was_clean, code, reason):
        
        logger.debug("Connection closed ({peer})".format(peer=self.peer))

        # Publish ON_CLOSE message
        self.factory.mease.publisher.publish(
            message_type=ON_CLOSE, client_id=self._client_id, client_storage=self.storage)

        self.factory.remove_client(self)
260271
def close(self):
        '''
        
        '''
        if not self._closing:
            IPCClient.close(self)
            if self._closing:
                # This will prevent this message from showing up:
                # '[ERROR   ] Future exception was never retrieved:
                # StreamClosedError'
                if self._read_sync_future is not None and self._read_sync_future.done():
                    self._read_sync_future.exception()
                if self._read_stream_future is not None and self._read_stream_future.done():
                    self._read_stream_future.exception()
692801
public CompletableFuture<Void> close() {
    CompletableFuture<Void> future = new CompletableFuture<>();
    submitter.close()
      .thenCompose(v -> listener.close())
      .thenCompose(v -> manager.close())
      .whenComplete((managerResult, managerError) -> {
        connection.close().whenComplete((connectionResult, connectionError) -> {
          if (managerError != null) {
            future.completeExceptionally(managerError);
          } else if (connectionError != null) {
            future.completeExceptionally(connectionError);
          } else {
            future.complete(null);
          }
        });
      });
    return future;
  }
967132
@Override
    public void close() {
        if (this.closed.compareAndSet(false, true)) {
            Futures.await(Services.stopAsync(this, this.executor));
            this.storage.close();
            log.info("Closed.");
        }
    }
161311
def close(self):
        
        self.is_closed = True
        self.is_ready = False
        self._command_queue.put(None)
593196
void handleClosed() {
    if (!closed) {
      closed = true;

      for (ContextualFuture<?> responseFuture : responseFutures.values()) {
        responseFuture.context.executor().execute(() -> responseFuture.completeExceptionally(new ConnectException("connection closed")));
      }
      responseFutures.clear();

      for (Listener<Connection> listener : closeListeners) {
        listener.accept(this);
      }
      timeout.cancel();
    }
  }
37613
def cancel(self):
        
        super(MapFuture, self).cancel()

        return any(tuple(f.cancel() for f in self._futures))
1104035
def close(self):
        
        with self._close_lock:
            epfd = self._epfd
            if epfd >= 0:
                self._epfd = -1
                close(epfd)
316907
def _future_completed(future):
    
    exc = future.exception()
    if exc:
        log.debug("Failed to run task on executor", exc_info=exc)
1270124
public CompletableFuture<Void> closeAsync() {

        if (debugEnabled) {
            logger.debug("closeAsync()");
        }

        if (CLOSED.get(this) == ST_CLOSED) {
            logger.warn("Connection is already closed");
            return closeFuture;
        }

        if (CLOSED.compareAndSet(this, ST_OPEN, ST_CLOSED)) {

            active = false;
            CompletableFuture<Void> future = channelWriter.closeAsync();

            future.whenComplete((v, t) -> {

                closeEvents.fireEventClosed(this);
                closeEvents = new CloseEvents();

                if (t != null) {
                    closeFuture.completeExceptionally(t);
                } else {
                    closeFuture.complete(v);
                }
            });
        } else {
            logger.warn("Connection is already closed (concurrently)");
        }

        return closeFuture;
    }
700462
def close(self):
        
        if not self._closed:
            if self.protocol_version >= 3:
                log_debug("[#%04X]  C: GOODBYE", self.local_port)
                self._append(b"\x02", ())
                try:
                    self.send()
                except ServiceUnavailable:
                    pass
            log_debug("[#%04X]  C: <CLOSE>", self.local_port)
            try:
                self.socket.close()
            except IOError:
                pass
            finally:
                self._closed = True
361618
public CompletableFuture<Void> close() {
    if (client == null) {
      return CompletableFuture.completedFuture(null);
    }

    CompletableFuture<Void> future = new CompletableFuture<>();
    client.stop().whenComplete((clientResult, clientError) -> {
      if (server != null) {
        server.stop().whenComplete((serverResult, serverError) -> {
          future.complete(null);
        });
      } else {
        future.complete(null);
      }
    });
    return future;
  }
831628
def close(self):
        
        logger.info("Closing connection to %s:%s", self._host, self._port)
        self._ioloop_future.cancel()
        try:
            yield from self._ioloop_future
        except asyncio.CancelledError:
            pass
66605
def _future_done(self, future):
        
        try:
            # notify the subscribers (except result is an exception or NONE)
            result = future.result()  # may raise exception
            if result is not NONE:
                self.notify(result)  # may also raise exception
        except asyncio.CancelledError:
            return
        except Exception:  # pylint: disable=broad-except
            self._options.error_callback(*sys.exc_info())

        # check if queue is present and something is in the queue
        if self._queue:
            value = self._queue.popleft()

            # start the coroutine
            self._run_coro(value)
        else:
            self._future = None