deactivate method

void deactivate()
override

Deactivate all endpoints that belong to this object adapter. After deactivation, the object adapter stops receiving requests through its endpoints. Object adapters that have been deactivated must not be reactivated again, and cannot be used otherwise. Attempts to use a deactivated object adapter raise {@link ObjectAdapterDeactivatedException} however, attempts to {@link #deactivate} an already deactivated object adapter are ignored and do nothing. Once deactivated, it is possible to destroy the adapter to clean up resources and then create and activate a new adapter with the same name.

After {@link #deactivate} returns, no new requests are processed by the object adapter. However, requests that have been started before {@link #deactivate} was called might still be active. You can use {@link #waitForDeactivate} to wait for the completion of all requests for this object adapter.

@see #activate @see #hold @see #waitForDeactivate @see Communicator#shutdown

Implementation

void deactivate() {
  state = State.deactivating;

  if (serverSocket != null) {
    serverSocket!.close();
    serverSocket = null;
  }

  // TODO: wait reply...
  connections.forEach((c) {
    c.close(ConnectionClose.gracefullyWithWait);
  });
  connections.clear();

  state = State.deactivated;
}