def METHOD_NAME(self):
    if self.spawn_subprocess:
        # signal "stop"
        try:
            self.batch_in.put((None, None), timeout=2)
        except Full:
            # worker process might be stopped already
            pass
        try:
            self.worker.get(timeout=2)
        except NoResult:
            pass
        self.worker.stop()
    else:
        self.stop()