<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shutdown(self, collector, success):
 """Shutdown of the application."""

        self.event.delegate(success)
        if collector is not None:
            collector.queue.put(None)
            collector.join()
        if not success:
            sys.exit(1)