def shutdown(self):
        LOGGER.critical("Shutting down.")
        self.job_queue = []
        self.queued_jobs = {}
        deferreds = []
        LOGGER.debug("%s stopping on main HTTP interface." % self.name)
        d = self.site_port.stopListening()
        if isinstance(d, Deferred):
            deferreds.append(d)
        if self.reportjobspeedloop is not None:
            LOGGER.debug("Stopping report job speed loop.")
            d = self.reportjobspeedloop.stop()
            if isinstance(d, Deferred):
                deferreds.append(d)            
        if self.jobsloop is not None:
            LOGGER.debug("Stopping jobs loop.")
            d = self.jobsloop.stop()
            if isinstance(d, Deferred):
                deferreds.append(d)           
        if self.queryloop is not None:
            LOGGER.debug("Stopping query loop.")
            d = self.queryloop.stop()
            if isinstance(d, Deferred):
                deferreds.append(d)
        if self.coordinateloop is not None:
            LOGGER.debug("Stopping coordinating loop.")
            d = self.coordinateloop.stop()
            if isinstance(d, Deferred):
                deferreds.append(d)
            LOGGER.debug("Removing data from SDB coordination domain.")
            d = self.sdb.delete(self.aws_sdb_coordination_domain, self.uuid)
            d.addCallback(self.peerCheckRequest)
            deferreds.append(d)
        if len(deferreds) > 0:
            d = DeferredList(deferreds)
            d.addCallback(self._shutdownCallback)
            return d
        else:
            return self._shutdownCallback(None)
dataset/ETHPy150Open wehriam/awspider/awspider/servers/execution.py/ExecutionServer.shutdown/original