def shutdown()

in src/main/scala/com/twitter/iago/server/ParrotServer.scala [96:129]


  def shutdown(): Future[Unit] = {
    if (shuttingDown.updateIfEmpty(Return.Unit)) {
      status = status.copy(status = Some(ParrotState.Stopping))
      log.setLevel(Level.ALL)
      log.trace("ParrotServer shutting down.")
      queue
        .shutdown()
        .onFailure { e =>
          log.error(s"Error shutting down queue:\n${e}")
        }
        .ensure {
          log.trace("Transport shutting down.")
        }
        .andThen {
          shutdownTransport
        }
        .andThenRun {
          status = status.copy(status = Some(ParrotState.Shutdown))
          log.trace("RecordProcessor shutting down.")
          config.parrot.recordProcessor.shutdown()
        }
        .ensure {
          log.trace("ThriftServer shutting down.")
        }
        .andThen {
          thriftServer.shutdown()
        }
        .andThenRun {
          log.trace("ParrotServer shut down.")
          done.setDone()
        }
    }
    done
  }