Updates session with the internalMessages key. Some application servers require session value to be updated
in order to replicate the session across nodes or persist it correctly.
541300
private void updateSession(final LinkedHashMap<String, XMLObject> messages) {
        context.getSessionStore().set(context, SAML_STORAGE_KEY, messages);
    }
916028
public void onSessionUpdate(Request currentRequest, Session session)
	{
		HttpServletResponse response = (HttpServletResponse)httpResponse.get();
		storeSessionDataInCookie(SESSION_TOKEN_KEY, session.getToken(), response);
		if(session.getUser(/*realm.getId()*/) != null)
		{
			storeSessionDataInCookie(USER_ID_KEY, session.getUser(/*realm.getId()*/).getId(), response);
		}
		else
		{
			storeSessionDataInCookie(USER_ID_KEY, null, response);
		}
	}
212077
def _UpdateSessionIfRequired(self, request_headers, response_result, response_headers):    
        

        '''if this request was made with consistency level as session, then update
        the session'''

        if response_result is None or response_headers is None:
            return

        is_session_consistency = False
        if http_constants.HttpHeaders.ConsistencyLevel in request_headers:
            if documents.ConsistencyLevel.Session == request_headers[http_constants.HttpHeaders.ConsistencyLevel]:
                is_session_consistency = True
              
        if is_session_consistency:
            # update session
            self.session.update_session(response_result, response_headers)
1299405
private void updateMemcachedReadInstancesByZone() {
        for (ServerGroup serverGroup : memcachedInstancesByServerGroup.keySet()) {
            final BooleanProperty isZoneInWriteOnlyMode = writeOnlyFastPropertyMap.get(serverGroup);
            if (isZoneInWriteOnlyMode.get().booleanValue()) {
                if (memcachedReadInstancesByServerGroup.containsKey(serverGroup)) {
                	EVCacheMetricsFactory.increment(_appName, null, serverGroup.getName(), _appName + "-" + serverGroup.getName() + "-WRITE_ONLY");
                    memcachedReadInstancesByServerGroup.remove(serverGroup);
                }
            } else {
                if (!memcachedReadInstancesByServerGroup.containsKey(serverGroup)) {
                	EVCacheMetricsFactory.increment(_appName, null, serverGroup.getName(), _appName + "-" + serverGroup.getName() + "-READ_ENABLED");
                    memcachedReadInstancesByServerGroup.put(serverGroup, memcachedInstancesByServerGroup.get(serverGroup));
                }
            }

            // if we lose over 50% of instances put that zone in writeonly mode.
            final List<EVCacheClient> clients = memcachedReadInstancesByServerGroup.get(serverGroup);
            if (clients != null && !clients.isEmpty()) {
                final EVCacheClient client = clients.get(0);
                if (client != null) {
                    final EVCacheConnectionObserver connectionObserver = client.getConnectionObserver();
                    if (connectionObserver != null) {
                        final int activeServerCount = connectionObserver.getActiveServerCount();
                        final int inActiveServerCount = connectionObserver.getInActiveServerCount();
                        if (inActiveServerCount > activeServerCount) {
                            memcachedReadInstancesByServerGroup.remove(serverGroup);
                        }
                    }
                }
            }
        }

        if (memcachedReadInstancesByServerGroup.size() != memcachedFallbackReadInstances.getSize()) {
            memcachedFallbackReadInstances = new ServerGroupCircularIterator(memcachedReadInstancesByServerGroup.keySet());

            Map<String, Set<ServerGroup>> readServerGroupByZoneMap = new ConcurrentHashMap<String, Set<ServerGroup>>();
            for (ServerGroup serverGroup : memcachedReadInstancesByServerGroup.keySet()) {
                Set<ServerGroup> serverGroupList = readServerGroupByZoneMap.get(serverGroup.getZone());
                if (serverGroupList == null) {
                    serverGroupList = new HashSet<ServerGroup>();
                    readServerGroupByZoneMap.put(serverGroup.getZone(), serverGroupList);
                }
                serverGroupList.add(serverGroup);
            }

            Map<String, ServerGroupCircularIterator> _readServerGroupByZone = new ConcurrentHashMap<String, ServerGroupCircularIterator>();
            for (Entry<String, Set<ServerGroup>> readServerGroupByZoneEntry : readServerGroupByZoneMap.entrySet()) {
                _readServerGroupByZone.put(readServerGroupByZoneEntry.getKey(), new ServerGroupCircularIterator(
                        readServerGroupByZoneEntry.getValue()));
            }
            this.readServerGroupByZone = _readServerGroupByZone;
            localServerGroupIterator = readServerGroupByZone.get(_zone);
        }
    }
1209907
public void updateSessionType(String type) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
	if (!hasAccess) throw new SecurityException("no access to update scope setting");

	type = type.toLowerCase().trim();

	Element scope = _getRootElement("scope");
	scope.setAttribute("session-type", type);
    }
756082
public void updateSessionManagement(Boolean sessionManagement) throws SecurityException {
	checkWriteAccess();
	boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);

	if (!hasAccess) throw new SecurityException("no access to update scope setting");

	Element scope = _getRootElement("scope");
	scope.setAttribute("sessionmanagement", Caster.toString(sessionManagement, ""));
    }
901726
def update(self, body):
        
        data = values.of({'Body': body, })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return MessageInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            sid=self._solution['sid'],
        )
581123
@PUT
    @Path("/{key}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.TRANSLATION_WRITE)
    public Response updateTranslation(@PathParam("key") String keyName, TranslationRepresentation representation) {
        WebAssertions.assertNotNull(representation, "The translation should not be null");
        TranslationValueRepresentation translationToUpdate = representation.getTarget();
        WebAssertions.assertNotNull(translationToUpdate, "The translation target should not be null");

        Key key = keyRepository.get(keyName).orElseThrow(() -> new NotFoundException("The key is not found"));
        key.addTranslation(locale, translationToUpdate.getTranslation(), translationToUpdate.isApprox());
        keyRepository.update(key);

        return Response.noContent().build();
    }
356046
@Override
    public Message createMessage(Session session) throws JMSException {
        Message message = session.createTextMessage(requestMessage);
        if (correlationId != null)
            message.setJMSCorrelationID(correlationId);
        if (replyQueue != null) {
            message.setJMSReplyTo(replyQueue);
        }
        if (delaySeconds >0) {
            ApplicationContext.getJmsProvider().setMessageDelay(null, message, delaySeconds);
        }
        return message;
    }
1200715
def session_update(self, session, *_):
        
        self._session_init(session)
        session.pending_write |= set(session.new)
        session.pending_update |= set(session.dirty)
        session.pending_delete |= set(session.deleted)
        self.logger.debug("%s - session_update" % session.meepo_unique_id)
408281
@Override
    protected Object save(final NoSqlSession session, final Object version, final boolean activateAfterSave)
    {
        try
        {
            log.debug("save:" + session);
            session.willPassivate();

            if (!session.isValid())
            {
                log.debug("save: skip saving invalidated session: id=" + session.getId());
                deleteKey(session.getId());
                return null;
            }

            ISerializableSession data;
            synchronized (session)
            {
                data = getSessionFactory().create(session);
            }
            data.setDomain(_cookieDomain);
            data.setPath(_cookiePath);
            long longVersion = 1; // default version for new sessions
            if (version != null)
            {
                longVersion = (Long) version + 1L;
            }
            data.setVersion(longVersion);

            try
            {
                if (!setKey(session.getId(), data))
                {
                    throw (new RuntimeException("unable to set key: data=" + data));
                }
            }
            catch (TranscoderException error)
            {
                throw (new IllegalArgumentException("unable to serialize session: id=" + session.getId() + ", data="
                    + data, error));
            }
            log.debug("save:db.sessions.update(" + session.getId() + "," + data + ")");

            if (activateAfterSave)
            {
                session.didActivate();
            }

            return longVersion;
        }
        catch (Exception e)
        {
            log.warn(e);
        }
        return null;
    }
488950
@Override
	public synchronized void update(long sessionId, String sessionName) throws DatabaseException {
        try {
			psUpdate.setLong(2, sessionId);
			psUpdate.setString(1, sessionName);
			psUpdate.executeUpdate();
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
1350528
private void repairBrokenSessionWithPreKeyMessage(OmemoManager.LoggedInOmemoManager managerGuard,
                                                      OmemoDevice brokenDevice) {

        LOGGER.log(Level.WARNING, "Attempt to repair the session by sending a fresh preKey message to "
                + brokenDevice);
        OmemoManager manager = managerGuard.get();
        try {
            // Create fresh session and send new preKeyMessage.
            buildFreshSessionWithDevice(manager.getConnection(), manager.getOwnDevice(), brokenDevice);
            sendRatchetUpdate(managerGuard, brokenDevice);

        } catch (CannotEstablishOmemoSessionException | CorruptedOmemoKeyException e) {
            LOGGER.log(Level.WARNING, "Unable to repair session with " + brokenDevice, e);
        } catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException e) {
            LOGGER.log(Level.WARNING, "Could not fetch fresh bundle for " + brokenDevice, e);
        } catch (CryptoFailedException | NoSuchAlgorithmException e) {
            LOGGER.log(Level.WARNING, "Could not create PreKeyMessage", e);
        }
    }
776431
protected void updateMessage() {

        if (!hasIndividualMessage()) {
            m_message = Messages.get().container(Messages.ERR_MULTI_EXCEPTION_1, new Integer(m_exceptions.size()));
        }
    }
719530
public void updateSession(BackedSession backedSess) {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[UPDATE_SESSION]);
        }

        if (!backedSess.isValid()) {
            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[UPDATE_SESSION], "session " + backedSess.getId()
                                                                                                              + " has been invalidated since last access, clean up and return ");
            }

            if (backedSess.appDataChanges != null)
                backedSess.appDataChanges.clear();
            if (backedSess.appDataRemovals != null)
                backedSess.appDataRemovals.clear();
            return;
        }

        if (cachedLastAccessedTimes != null) { // manual write or time based writes
            if (backedSess.cacheLastAccessedTime) {
                cachedLastAccessedTimes.put(backedSess.getId(), new Long(backedSess.getCurrentAccessTime()));
                return; // only cache last access time to be written prior to inval thread
            } else {
                cachedLastAccessedTimes.remove(backedSess.getId());
            }
        }

        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[UPDATE_SESSION], "Do the write!");
        }

        boolean propHit = false;

        if (_smc.writeAllProperties()) {
            propHit = true;
        }

        if (!propHit && backedSess.appDataChanges != null) {
            propHit = !backedSess.appDataChanges.isEmpty();
        }

        if (!propHit && backedSess.appDataRemovals != null) {
            propHit = !backedSess.appDataRemovals.isEmpty();
        }

        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[UPDATE_SESSION], "propHit is: " + propHit);
            if (propHit) {
                String changes = (backedSess.appDataChanges == null ? "null" : backedSess.appDataChanges.keySet().toString());
                String removals = (backedSess.appDataRemovals == null ? "null" : backedSess.appDataRemovals.keySet().toString());
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[UPDATE_SESSION], "prop hit " + propHit + " app changes " + changes + " app removals "
                                                                                                              + removals);
            }
        }

        boolean writeSucc = persistSession(backedSess, propHit);

        backedSess.update = null;
        if (writeSucc) {

            backedSess.userWriteHit = false;
            backedSess.maxInactWriteHit = false;
            backedSess.listenCntHit = false;
            // PK32205: Clear appDataChanges and appDataRemovals only if it
            // is not a MR configuration. In MR configuration these are
            // appropriately cleared in handlePropertyHits
            if (!_smc.isUsingMultirow()) {
                if (backedSess.appDataChanges != null)
                    backedSess.appDataChanges.clear();
                if (backedSess.appDataRemovals != null)
                    backedSess.appDataRemovals.clear();
            }
        }
    }
28592
private void sendMessage(AuthenticationManagerRequest req) {
    Message<AuthenticationManagerRequest> msg = new Message<AuthenticationManagerRequest>(AuthenticationManagerCommandAction.COMMAND_NAME, req);
    try {
      sender.sendMessage(msg, null);
    } catch (Exception e) {
      log.error("Failed to update authentication.", e);
    }
  }
977475
def ensure_session_key(request):
    
    key = request.session.session_key
    if key is None:
        # @@@ Django forces us to handle session key collision amongst
        # multiple processes (not handled)
        request.session.save()
        # force session to persist for client
        request.session.modified = True
        key = request.session.session_key
    return key