Receive and process the <session-terminate> action.
552182
private IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) {

        // According to XEP-166 the only thing we can do is ack.
        IQ response = session.createAck(jingle);

        try {
            session.terminate("Closed remotely");
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, "exception", e);
        }

        return response;
    }
98426
def terminate(self, sa):
        
        response = self.handler.streamed_request("terminate", "control-log", sa)
        return self._result(*response)
284677
public void terminate(String reason) throws XMPPException, NotConnectedException, InterruptedException {
        if (isClosed())
            return;
        LOGGER.fine("Terminate " + reason);
        Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE);
        jout.setType(IQ.Type.set);
        sendStanza(jout);
        triggerSessionClosed(reason);
    }
11032
def terminate(self):
        
        try:
            self.send_signal(signal.SIGTERM)
        except pyuv.error.ProcessError as e:
            if e.args[0] != pyuv.errno.UV_ESRCH:
                raise
1042532
def handle_response(self, item_session: ItemSession) -> Actions:
        '''
        '''
        action = self.consult_response_hook(item_session)

        if action == Actions.RETRY:
            item_session.set_status(Status.error)
        elif action == Actions.FINISH:
            item_session.set_status(Status.done)
        elif action == Actions.STOP:
            raise HookStop('Script requested immediate stop.')

        return action
1356228
public void sessionEnd(SessionStatus finishState) {
    if (sessionStatusToMetrics.containsKey(finishState)) {
      sessionStatusToMetrics.get(finishState).inc();
    } else {
      throw new IllegalArgumentException("Invalid end state " + finishState);
    }
  }
646015
protected final void terminate() {
		if (rebind(connection)) {
			if (log.isTraceEnabled()) {
				log.trace(format(channel(), "Disposing ChannelOperation from a channel"),
						new Exception("ChannelOperation terminal stack"));
			}

			Operators.terminate(OUTBOUND_CLOSE, this);
			// Do not call directly inbound.onInboundComplete()
			// HttpClientOperations need to notify with error
			// when there is no response state
			onInboundComplete();
			if (channel().isActive() && isPersistent()) {
				channel().writeAndFlush(TERMINATED_OPS, this);
			}
			else {
				// Returned value is deliberately ignored
				setSuccess(null);
			}
		}
	}
40177
@EventThread
    protected void finishResumeSession ()
    {
        // if we have no client object for whatever reason; we're hosed, shut ourselves down
        if (_clobj == null) {
            log.info("Missing client object for resuming session " + this + ".");
            endSession();
            return;
        }

        // make extra sure we have no lingering subscriptions
        clearSubscrips(false);

        // Update our client secret with the new auth request
        _clobj.getLocal(ClientLocal.class).secret = getSecret();

        // let derived classes do any session resuming
        sessionWillResume();

        // send off a bootstrap notification immediately as we've already got our client object
        sendBootstrap();

        // resend the throttle update if non-default
        if (_messagesPerSec != Client.DEFAULT_MSGS_PER_SECOND) {
            sendThrottleUpdate();
        }

        log.info("Session resumed " + this + ".");
    }
640096
public function finish()
    {
        $session = $this->getSessionInstance();
        $pathCollection = $session->getSessionParam("aPath");
        $aSetupConfig = $session->getSessionParam("aSetupConfig");
        $aDB = $session->getSessionParam("aDB");

        try {
            $this->getUtilitiesInstance()->executeExternalRegenerateViewsCommand(); // move to last step possible?
        } catch (CommandExecutionFailedException $exception) {
            $this->handleCommandExecutionFailedException($exception);

            throw new SetupControllerExitException();
        } catch (Exception $exception) {
            $view = $this->getView();
            $view->setMessage($exception->getMessage());

            throw new SetupControllerExitException();
        }

        $this->setViewOptions(
            'finish.php',
            'STEP_6_TITLE',
            [
                "aPath" => $pathCollection,
                "aSetupConfig" => $aSetupConfig,
                "aDB" => $aDB,
                "blWritableConfig" => is_writable($pathCollection['sShopDir'] . "/config.inc.php")
            ]
        );
    }
398572
def execute(self):
        
        self._state_machine.transition_to_execute()
        for action in self._actions:
            self._executed_actions.append(action)
            self.execute_with_retries(action, lambda a: a.execute())
        self._state_machine.transition_to_execute_complete()
1028759
def Terminate(self, status=None):
    """"""
    try:
      self.queue_manager.DestroyFlowStates(self.session_id)
    except queue_manager.MoreDataException:
      pass

    # This flow might already not be running.
    if not self.IsRunning():
      return

    self._SendTerminationMessage(status=status)

    # Mark as terminated.
    self.context.state = rdf_flow_runner.FlowContext.State.TERMINATED
    self.flow_obj.Flush()
33365
public void execute() {
        try {
            while(true) {
                Event event = null;

                try {
                    event = eventQueue.poll(timeout, unit);
                } catch(InterruptedException e) {
                    throw new InsufficientOperationalNodesException(operation.getSimpleName()
                                                                    + " operation interrupted!", e);
                }

                if(event == null)
                    throw new VoldemortException(operation.getSimpleName()
                                                 + " returned a null event");

                if(event.equals(Event.ERROR)) {
                    if(logger.isTraceEnabled())
                        logger.trace(operation.getSimpleName()
                                     + " request, events complete due to error");

                    break;
                } else if(event.equals(Event.COMPLETED)) {
                    if(logger.isTraceEnabled())
                        logger.trace(operation.getSimpleName() + " request, events complete");

                    break;
                }

                Action action = eventActions.get(event);

                if(action == null)
                    throw new IllegalStateException("action was null for event " + event);

                if(logger.isTraceEnabled())
                    logger.trace(operation.getSimpleName() + " request, action "
                                 + action.getClass().getSimpleName() + " to handle " + event
                                 + " event");

                action.execute(this);
            }
        } finally {
            finished = true;
        }
    }
465580
public function terminate( $request, $response )
	{
		if ( $this->sessionHandled && $this->sessionConfigured() && !$this->usingHandler( CookieSessionHandler::class ) )
			$this->driver()->save();
	}
930459
public void endSession() {
		if (replayWindow != null) {
			replayWindow.removeAllElements();
		}
		replayWindow = null;
		txEncryptorSuite = rxEncryptorSuite = null;
		txIV = rxIV = null;
		txEncOut = rxEncOut = null;
		txHMAC = rxHMAC = null;
		txSessEncKey = null;
		txSessAuthKey = null;
		txSessSaltKey = null;
		rxSessEncKey = null;
		rxSessAuthKey = null;
		rxSessSaltKey = null;
		firstRtpSeq = 1;
		rollOverCounter = 0;
	}
251594
public void processAction() throws IOException {
		if (isDisposed()) {
			LOG.error("Skipping action phase. Attempt to reuse disposed ContainerHelper instance");
			return;
		}

		try {
			// Check user context has been prepared
			if (getNewConversation() == null) {
				throw new IllegalStateException(
						"User context has not been prepared before the action phase");
			}

			prepareAction();

			UIContext uic = getUIContext();
			if (uic == null) {
				throw new IllegalStateException("No user context set for the action phase.");
			}

			UIContextHolder.pushContext(uic);

			// Make sure maps are cleared up
			uic.clearScratchMap();
			uic.clearRequestScratchMap();

			prepareRequest();

			Request req = getRequest();
			getInterceptor().attachResponse(getResponse());
			getInterceptor().serviceRequest(req);

			if (req.isLogout()) {
				handleLogout();
				dispose();
			}
		} catch (ActionEscape esc) {
			LOG.debug("ActionEscape performed.");
			// Action escapes must be handled in the action phase and then
			// do nothing if they reach the render phase (which they will in
			// the servlet implementation)
			handleEscape(esc);
			dispose();
		} catch (Escape esc) {
			LOG.debug("Escape performed during action phase.");
			// We can't handle the escape until the render phase.
		} catch (Throwable t) {
			// We try not to let any exception propagate to container.
			String message = "Caught exception during action phase.";
			LOG.error(message, t);

			// We can't handle the error until the render phase.
			propogateError(t);
		} finally {
			UIContextHolder.reset();
		}
	}
105513
public void complete() {
        Session session = getSession(false);
        if (session == null) {
            return;
        }
        sessionHandler.complete(session);
    }
726524
public void receiveAndProcess() {
        if (this.shouldContinue()) {
            this.receiver.receive(this.onReceiveHandler.getMaxEventCount())
                    .handleAsync(this.processAndReschedule, this.executor);
        } else {
            if (TRACE_LOGGER.isInfoEnabled()) {
                TRACE_LOGGER.info(String.format(Locale.US, "Stopping receive pump for eventHub (%s), consumerGroup (%s), partition (%s) as %s",
                        this.eventHubName, this.consumerGroupName, this.receiver.getPartitionId(),
                        this.stopPumpRaised.get() ? "per the request." : "pump ran into errors."));
            }

            this.stopPump.complete(null);
        }
    }