The function registered as the shutdown function. Cleans up the trace and
reports using the provided ExporterInterface. Adds additional attributes to
the root span detected from the response.
160150
public function onExit()
    {
        $this->addCommonRequestAttributes($this->headers);

        $this->scope->close();

        $this->exporter->export($this->tracer->spans());
    }
1282561
def _shutdown(self, message=None, code=0):
        """"""
        if self._shutdown_complete:
            # Make sure we don't accidentally re-run the all cleanup
            sys.exit(code)

        if self.shutdown_callback is not None:
            # Call the shutdown callback with a message suitable for
            # logging and the exit code
            self.shutdown_callback(message, code)

        if self.pidfile is not None:
            self._close_pidfile()

        self._shutdown_complete = True
        sys.exit(code)
1098023
@Override
    public void shutdown(boolean compact) {
        try {
            if (view != null) {
                view.getRequestPanel().saveConfig(model.getOptionsParam().getConfig());
                view.getResponsePanel().saveConfig(model.getOptionsParam().getConfig());
            }

            getProxy(null).stopServer();
            super.shutdown(compact);
        } finally {
            // Ensure all extensions' config changes done during shutdown are saved.
            saveConfigurations();
        }
    }
526827
public function _shutdown()
	{
		if ($this->_registered && $error = error_get_last())
		{
			try
			{
				// clear the output buffer if we can
				if(ob_get_level()>=1) ob_end_clean();

				// build an error exception
				if (isset($error['type']) && in_array($error['type'],
					array(E_ERROR, E_PARSE, E_COMPILE_ERROR)))
				{
					$this->_handleError(
						$error['type'],
						$error['message'],
						$error['file'],
						$error['line']
						);
				}
			}
			catch(Exception $e)
			{
			}
		}
	}
464338
@FFDCIgnore(Exception.class)
    final void shutdownFramework() {
        Tr.audit(tc, "httpChain.error.shutdown", name);

        try {
            Bundle bundle = bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION);

            if (bundle != null)
                bundle.stop();
        } catch (Exception e) {
            // do not FFDC this.
            // exceptions during bundle stop occur if framework is already stopping or stopped
        }
    }
9214
public static void shutdown() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "shutdown");
        }
        synchronized (oneAtATime) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "have lock"); // running with fixes (2)");
            }

            if (aioInitialized == AIO_INITIALIZED) {
                // mark the library as shutdown
                aioInitialized = AIO_SHUTDOWN;
                // Shut down sequence for the library...
                closeAllCompletionPorts();
                try {
                    aio_shutdown();
                } catch (AsyncException ae) {
                    // ignore shutdown errors
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "AsyncException occured while shutting down: " + ae.getMessage());
                    }
                }
            }
        } // end-sync
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "shutdown");
        }
    }
631272
private function _processFunctionStop() {
		$this->_inFunction = false; // We are out of the function

		// Check the cyclomatic complexity
		$this->_checkCyclomaticComplexity();

		// Check the NPath Complexity
		$this->_checkNPathComplexity();

		// Check the docblock content
		$this->_checkDocBlockParameters();

		// Check function length
		$this->_checkFunctionLength();

		// Check unused function parameters
		$this->_checkUnusedFunctionParameters();

		// Reset the warnings suppressed by annotation
		$this->_functionSuppressWarnings = array();

		// Reset the count of elements in the current function docblock
		$this->statementStack->getParentStackItem()->docblocNbParams = 0;
		$this->statementStack->getParentStackItem()->docblocNbReturns = 0;
		$this->statementStack->getParentStackItem()->docblocNbThrows = 0;
		$this->statementStack->getParentStackItem()->docblocInheritDoc = false;
	}
691815
public static function ShutdownHandler () {
		$error = error_get_last();
		if (isset($error['type'])) static::Exception($error);
		if (!self::isHtmlResponse() || count(self::$dumps) === 0) return;
		list($dumps, $lastDump) = self::formatDebugDumps();
		echo str_replace(
			['%mvccoreDumps%', '"%mvccoreInitArgs%"'],
			[$dumps, ($lastDump ? '!0' : '!1') . ',' . count(self::$dumps)],
			file_get_contents(__DIR__.'/debug.html')
		);
	}
851062
def finish(end_time = ::Instana::Util.now_in_ms)
      if ::Instana.tracer.current_span.id != id
        ::Instana.logger.debug "Closing a span that isn't active. This will result in a broken trace: #{self.inspect}"
      end

      if is_root?
        # This is the root span for the trace.  Call log_end to close
        # out and queue the trace
        ::Instana.tracer.log_end(name, {}, end_time)
      else
        ::Instana.tracer.current_trace.end_span({}, end_time)
      end
      self
    end
71479
function registerShutdownFunc($func, $args = array())
    {
        // if we are called statically, there is a potential
        // that no shutdown func is registered.  Bug #6445
        if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
            register_shutdown_function("_PEAR_call_destructors");
            $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
        }
        $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
    }
138228
public function shutdown() {
        if (($error = error_get_last())) {
            ob_clean();
            /* log error */
            $msg = $error["message"] . " in file: " . $error["file"] . " on line: " . $error["line"];
            $log = new Logger('kernel');
            $file = self::get("dir", "log") . "/log-" . date("Ymd") . ".log";
            $log->pushHandler(new StreamHandler($file, Logger::ERROR));
            switch ($this->mode) {
                case self::$MODE_PRODUCTION:
                    $log->addError($msg);
                    $request = new HttpRequest();
                    $class = self::get("defaultController");
                    $method = self::get("errorMethod");
                    $controller = new $class();
                    $this->dispatch($controller, $method, $request);
                    break;
                case self::$MODE_DEVELOPMENT:
                    die($msg);
                    break;

                default:
                    echo $msg;
                    break;
            }
        }
    }
661349
public static function shutdown()
    {    
		
        if (self::$_instance->_debugger_channel) {
			self::$_instance->_debugger_channel->flush();
			self::$_instance->_debugger_response->sendHeaders();
			ob_end_flush();
		}
		
		if (self::$_instance->cronMode) {
			if ( php_sapi_name() == 'cli' ) {
				$txt = ob_get_contents();
				ob_end_clean();
				if (self::$_instance->cronLog) {
					file_put_contents(self::$_instance->cronLog, date('Y.m.d H:i:s')."\n===================\n".$txt."\n\n", FILE_APPEND);
				}				
				exit(self::$_instance->exitCode);
			}				
		}
		
		if ( php_sapi_name() != 'cli' ) {
			if (self::$_instance->exitCode) {
				http_response_code(500);
			}	
		}		
    }
73455
public static function handle_shutdown() {
		$isFatal = false;
		$error = error_get_last();
		if($error !== NULL && $error['type'] === E_ERROR) {
			$isFatal = true;
			self::handle_error($error['type'], $error['message'], $error['file'], $error['line']);
		}

		if(!count(self::$log))
			return false;

		$filament = self::getFilament();

		curl_get_contents(Configuration::get("filament.location"), array(
			"version"     => 2,
			"key"         => Configuration::get("filament.key"),
			"data"        => @json_encode($filament),
			"error_count" => self::$error_count
		), defined('CURLOPT_CONNECTTIMEOUT_MS') ? array(
			CURLOPT_NOSIGNAL => true,
			CURLOPT_CONNECTTIMEOUT_MS => 250
		) : array(
			CURLOPT_CONNECTTIMEOUT => 1
		));

		if($isFatal) {
			Request::setResponseCode("exception", "fatal server error");
			$response = array(
				"data"           => $data,
				"response"       => Request::getResponseCode(),
				"render_actions" => array()
			);

			if(Request::isAjax()) {
				http_response_code(200);
				if(Kernel::getEnvironment() != "production")
					$response["filament"] = $filament;
				json_echo($response);
			} else {
				echo "<h1>Fatal Error</h1>";
				if(Kernel::getEnvironment() != "production")
					echo "<pre>" . var_export(self::$log, true) . "</pre>";
			}
		}
	}
362025
protected void cleanupOnExit() {
        String threadName = "Shutdown Hook Deletion Thread for Temporary DB " + dataDir.toString();
        final DB db = this;
        Runtime.getRuntime().addShutdownHook(new Thread(threadName) {

            @Override
            public void run() {
                // ManagedProcess DestroyOnShutdown ProcessDestroyer does
                // something similar, but it shouldn't hurt to better be save
                // than sorry and do it again ourselves here as well.
                try {
                    // Shut up and don't log if it was already stop() before
                    if (mysqldProcess != null && mysqldProcess.isAlive()) {
                        logger.info("cleanupOnExit() ShutdownHook now stopping database");
                        db.stop();
                    }
                } catch (ManagedProcessException e) {
                    logger.warn("cleanupOnExit() ShutdownHook: An error occurred while stopping the database", e);
                }

                if (dataDir.exists() && (configuration.isDeletingTemporaryBaseAndDataDirsOnShutdown() && Util.isTemporaryDirectory(dataDir.getAbsolutePath()))) {
                    logger.info("cleanupOnExit() ShutdownHook quietly deleting temporary DB data directory: " + dataDir);
                    FileUtils.deleteQuietly(dataDir);
                }
                if (baseDir.exists() && (configuration.isDeletingTemporaryBaseAndDataDirsOnShutdown() && Util.isTemporaryDirectory(dataDir.getAbsolutePath()))) {
                    logger.info("cleanupOnExit() ShutdownHook quietly deleting temporary DB base directory: " + baseDir);
                    FileUtils.deleteQuietly(baseDir);
                }
            }
        });
    }
1044629
def shutdown(exit_event = ExitEvent.new(behavior_proxy))
      @behavior.shutdown
      cleanup exit_event
    ensure
      Thread.current[:celluloid_actor]   = nil
      Thread.current[:celluloid_mailbox] = nil
    end
1358685
public final synchronized void shutdown() {
        if (DESTROYED_UPDATER.compareAndSet(this, 0, 1)) {
            engineMap.remove(ssl);
            SSL.freeSSL(ssl);
            ssl = networkBIO = 0;

            isInboundDone = outboundClosed = true;
        }

        // On shutdown clear all errors
        SSL.clearError();
    }
568395
function (callbackFn) {
            var self = this;
            request.post(this.options.hostAndPort + '/phantom/functions/exit', {
                    form:{
                    }
                },
                function (error, response, body) {

                    if (response && response.statusCode === 200) {    //server up
                        self.server.close();
                        callbackFn && callbackFn.call(self, true);
                    }
                    else {    //server down
                        callbackFn.call(self, false);
                    }
                });
        }