steps to the beginning of the termination process.
961001
@Override
    protected void processTerm(int linger)
    {
        //  Double termination should never happen.
        assert (!terminating);

        //  Send termination request to all owned objects.
        for (Own it : owned) {
            sendTerm(it, linger);
        }
        registerTermAcks(owned.size());
        owned.clear();

        //  Start termination process and check whether by chance we cannot
        //  terminate immediately.
        terminating = true;
        checkTermAcks();
    }
111073
public function terminate() {
		USession::terminate ();
		$fMessage = new FlashMessage ( "You have been properly disconnected!", "Logout", "success", "checkmark" );
		$this->terminateMessage ( $fMessage );
		$message = $this->fMessage ( $fMessage );
		$this->authLoadView ( $this->_getFiles ()->getViewNoAccess (), [ "_message" => $message,"authURL" => $this->getBaseUrl (),"bodySelector" => $this->_getBodySelector (),"_loginCaption" => $this->_loginCaption ] );
	}
421651
def finish(self):
        ''''''
        self.ibd.close()
        self._write_xml()
        self.xml.close()
463288
def on_terminate(func):
    """"""
    def exit_function(*args):
        func()
        exit(0)
    signal.signal(signal.SIGTERM, exit_function)
38369
def _finalize(self, chain=-1):
        """"""
        chain = range(self.chains)[chain]
        for name in self.trace_names[chain]:
            self._traces[name]._finalize(chain)
        self.commit()
793337
public function terminate()
    {
        /** @var EventHandler $eventHandler */
        $eventHandler = $this->getService('event-handler');

        $eventHandler->getEvent(TerminateApplication::class)->attach(new LogBeforeTerminate());
        $eventHandler->getEvent(TerminateApplication::class)->attach(new ExitApplication());

        $eventHandler->fire(TerminateApplication::class, ['app' => $this]);
    }
1079823
def signal_terminate(on_terminate):
    """"""
    for i in [signal.SIGINT, signal.SIGQUIT, signal.SIGUSR1, signal.SIGUSR2, signal.SIGTERM]:
        signal.signal(i, on_terminate)
845174
def end(self):
        """"""
        # Close export modules
        for e in self._exports:
            self._exports[e].exit()
        # Close plugins
        for p in self._plugins:
            self._plugins[p].exit()
998933
def finish(self, blueprint, documents):
        """"""

        # Reset the blueprint
        blueprint.reset()

        # Finish the documents
        finished = []
        for document in documents:
            finished.append(blueprint.finish(document))

        return finished
317227
def terminate(self):
        

        self.close()

        for conn in list(self._used):
            conn.close()
            self._terminated.add(conn)

        self._used.clear()
1194787
protected function stopTerminatingProcessesThatAreHanging()
    {
        foreach ($this->terminatingProcesses as $process) {
            $timeout = $this->options->timeout;

            if ($process['terminatedAt']->addSeconds($timeout)->lte(Chronos::now())) {
                $process['process']->stop();
            }
        }
    }
402050
protected function step2()
    {
        switch ($this->b[$this->k-1]) {
            case 'a':
                if ($this->ends("ational",7)) { $this->r("ate",3); break; }
                if ($this->ends("tional",6)) { $this->r("tion",4); break; }
                break;
            case 'c':
                if ($this->ends("enci",4)) { $this->r("ence",4); break; }
                if ($this->ends("anci",4)) { $this->r("ance",4); break; }
                break;
            case 'e':
                if ($this->ends("izer",4)) { $this->r("ize",3); break; }
                break;
            case 'l':
                if ($this->ends("bli",3)) { $this->r("ble",3); break; }
                // -DEPARTURE-
                // To match the published algorithm, replace the above line with
                // if ($this->ends("abli",4)) { $this->r("able",4); break; }
                if ($this->ends("alli",4)) { $this->r("al",2); break; }
                if ($this->ends("entli",5)) { $this->r("ent",3); break; }
                if ($this->ends("eli",3)) { $this->r("e",1); break; }
                if ($this->ends("ousli",5)) { $this->r("ous",3); break; }
                break;
            case 'o':
                if ($this->ends("ization",7)) { $this->r("ize",3); break; }
                if ($this->ends("ation",5)) { $this->r("ate",3); break; }
                if ($this->ends("ator",4)) { $this->r("ate",3); break; }
                break;
            case 's':
                if ($this->ends("alism",5)) { $this->r("al",2); break; }
                if ($this->ends("iveness",7)) { $this->r("ive",3); break; }
                if ($this->ends("fulness",7)) { $this->r("ful",3); break; }
                if ($this->ends("ousness",7)) { $this->r("ous",3); break; }
                break;
            case 't':
                if ($this->ends("aliti",5)) { $this->r("al",2); break; }
                if ($this->ends("iviti",5)) { $this->r("ive",3); break; }
                if ($this->ends("biliti",6)) { $this->r("ble",3); break; }
                break;
            case 'g':
                if ($this->ends("logi",4)) { $this->r("log",3); break; }
                // -DEPARTURE-
                // To match the published algorithm delete the above line
        }
    }
328033
void endIfStarted(CodeAttribute b, ClassMethod method) {
        b.aload(getLocalVariableIndex(0));
        b.dup();
        final BranchEnd ifnotnull = b.ifnull();
        b.checkcast(Stack.class);
        b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR);
        BranchEnd ifnull = b.gotoInstruction();
        b.branchEnd(ifnotnull);
        b.pop(); // remove null Stack
        b.branchEnd(ifnull);
    }
1182109
def final():
    """"""
    if DEBUG:
        print("Cleaning up message queues", queues)
        print("Cleaning up processes", procs)
    for q in queues:
        q.remove()
    for proc in procs:
        proc.terminate()
612752
def finish(self):
        """"""

        self.unset_env()
        self.cov.stop()
        self.cov.combine()
        self.cov.save()

        if self.is_collocated:
            # If we are collocated then just inform the master of our
            # data file to indicate that we have finished.
            self.config.slaveoutput['cov_slave_node_id'] = self.nodeid
        else:
            # If we are not collocated then add the current path
            # and coverage data to the output so we can combine
            # it on the master node.

            # Send all the data to the master over the channel.
            self.config.slaveoutput['cov_slave_path'] = self.topdir
            self.config.slaveoutput['cov_slave_node_id'] = self.nodeid
            self.config.slaveoutput['cov_slave_lines'] = self.cov.data.lines
            self.config.slaveoutput['cov_slave_arcs'] = self.cov.data.arcs
465920
private void stepDown() {
    if (context.getLeader() != null && context.getLeader().equals(context.getCluster().member())) {
      context.setLeader(0);
    }
  }
1069565
def terminate(self, reason=None):
        """"""
        self.logger.info('terminating')
        self.loop.unloop(pyev.EVUNLOOP_ALL)