protected function runPayloadApplication($workerConfig = null): int {
        $this->getPayloadInstance();

        try {
            $runSuccess = $this->instance->run($workerConfig);
            unset($this->instance);
        } catch (Exception $ex) {
            $exitMessage = $ex->getMessage();
            $exitFile = $ex->getFile().':'.$ex->getLine();
            $this->log(LogLevel::ERROR, "[{pid}] App Exception: {$exitMessage} {$exitFile}");
            return 1;
        }

        $this->log(LogLevel::DEBUG, "[{pid}] App exited with status: {$runSuccess}");

        // If this was not a controlled exit
        $exitCode = 0;
        switch ($runSuccess) {
            case self::APP_EXIT_EXIT:
                $this->log(LogLevel::DEBUG, "[{pid}] Halting from error condition...");
                $exitCode = 8;
                break;

            case self::APP_EXIT_HALT:
                $this->log(LogLevel::DEBUG, "[{pid}] Halting from normal operation...");
                $exitCode = 0;
                break;

            case self::APP_EXIT_RESTART:
                $this->log(LogLevel::DEBUG, "[{pid}] Gracefully exiting (cron restart)...");
                $exitCode = 2;
                break;

            case self::APP_EXIT_RELOAD:
            default:
                $this->log(LogLevel::DEBUG, "[{pid}] Preparing to reload...");
                $exitCode = 1;
                break;
        }
        return $exitCode;
    }