def METHOD_NAME(self):
    while True:
        kill_found = False
        commands = []
        command = self.notifications_queue.get(block=True)
        if isinstance(command, KillServer):
            kill_found = True
        else:
            assert isinstance(command, ParallelNotification)
            commands.append(command.to_tuple())
        try:
            while True:
                command = self.notifications_queue.get(block=False) #No block to create a batch.
                if isinstance(command, KillServer):
                    kill_found = True
                else:
                    assert isinstance(command, ParallelNotification)
                    commands.append(command.to_tuple())
        except:
            pass #That's OK, we're getting it until it becomes empty so that we notify multiple at once.
        if commands:
            try:
                #Batch notification.
                self.server.lock.acquire()
                try:
                    self.server.notifyCommands(self.job_id, commands)
                finally:
                    self.server.lock.release()
            except:
                traceback.print_exc()
        if kill_found:
            self.finished = True
            return