public function shutdown()
    {
        if ($this->masterPid === posix_getpid() && !$this->finished) {
            // only master process.
            $this->dispatcher->dispatch(WorkerEvents::SHUTTING_DOWN, new WorkerShuttingDownEvent($this));
            $this->output->writeln("<info>Shutdown <comment>".$this->config->getName()."</comment>.</info>");
            $this->finished = true;
        }
    }