Given a session and match of request-node, perform a "transaction commit"
@param session The session
@param pair The pair of (request, node)
@return The resource grant: non-null if the "commit" was successful, null
otherwise.
483261
private ResourceGrant commitMatchedResource(
      Session session, MatchedPair pair) {
    ResourceGrant grant = null;
    ResourceRequestInfo req = pair.req;
    ClusterNode node = pair.node;
    String appInfo = nodeManager.getAppInfo(node, type);
    if (appInfo != null) {
      if (nodeManager.addGrant(node, session.getSessionId(), req)) {
        // if the nodemanager can commit this grant - we are done
        // the commit can fail if the node has been deleted
        grant = new ResourceGrant(req.getId(), node.getName(),
          node.getAddress(), ClusterManager.clock.getTime(), req.getType());
        grant.setAppInfo(appInfo);
        sessionManager.grantResource(session, req, grant);
      }
    }
    if (nodeSnapshot != null) {
      synchronized (node) {
        if (node.deleted) {
          nodeSnapshot.removeNode(node);
        } else if (!node.checkForGrant(Utilities.getUnitResourceRequest(type),
          nodeManager.getResourceLimit())) {
          nodeSnapshot.removeNode(node);
        }
      }
    }
    return grant;
  }
448167
@Override
    protected void service( HttpServletRequest req,
                            HttpServletResponse resp ) throws ServletException, IOException {

        String methodName = req.getMethod();
        ITransaction transaction = null;
        boolean needRollback = false;

        if (LOG.isTraceEnabled()) {
            debugRequest(methodName, req);
        }

        try {
            Principal userPrincipal = req.getUserPrincipal();
            transaction = store.begin(userPrincipal);
            needRollback = true;
            store.checkAuthentication(transaction);
            resp.setStatus(WebdavStatus.SC_OK);

            try {
                IMethodExecutor methodExecutor = methodMap.get(methodName);
                if (methodExecutor == null) {
                    methodExecutor = methodMap.get("*NO*IMPL*");
                }

                methodExecutor.execute(transaction, req, resp);

                store.commit(transaction);
                /**
                 * Clear not consumed data Clear input stream if available otherwise later access include current input. These
                 * cases occure if the client sends a request with body to an not existing resource.
                 */
                if (RequestUtil.streamNotConsumed(req)) {
                    if (LOG.isTraceEnabled()) {
                        LOG.trace("Clear not consumed data!");
                    }
                    try {
                        while (req.getInputStream().available() > 0) {
                            req.getInputStream().read();
                        }
                    } catch (IOException e) {
                        //ignore
                    }
                }
                needRollback = false;
            } catch (IOException e) {
                LOG.error(e, new TextI18n("IOException"));
                resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                store.rollback(transaction);
                throw new ServletException(e);
            }

        } catch (UnauthenticatedException e) {
            resp.sendError(WebdavStatus.SC_FORBIDDEN);
        } catch (AccessDeniedException e) {
            resp.sendError(WebdavStatus.SC_FORBIDDEN);
        } catch (LockFailedException e) {
            resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
        } catch (ObjectAlreadyExistsException e) {
            resp.sendError(WebdavStatus.SC_PRECONDITION_FAILED);
        } catch (ObjectNotFoundException e) {
            resp.sendError(WebdavStatus.SC_NOT_FOUND);
        } catch (WebdavException e) {
            throw new ServletException(e);
        } catch (Throwable t) {
            t = translate(t);
            if (t instanceof UnauthenticatedException) {
                resp.sendError(WebdavStatus.SC_FORBIDDEN);
            } else if (t instanceof AccessDeniedException) {
                resp.sendError(WebdavStatus.SC_FORBIDDEN);
            } else if (t instanceof LockFailedException) {
                resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
            } else if (t instanceof ObjectAlreadyExistsException) {
                resp.sendError(WebdavStatus.SC_PRECONDITION_FAILED);
            } else if (t instanceof ObjectNotFoundException) {
                resp.sendError(WebdavStatus.SC_NOT_FOUND);
            } else if (t instanceof WebdavException) {
                throw new ServletException(t);
            } else {
                throw new ServletException(t);
            }
        } finally {
            if (needRollback) {
                store.rollback(transaction);
            }
        }
    }
409880
public BoxRequestsFile.CommitUploadSession getCommitSessionRequest(List<BoxUploadSessionPart> uploadedParts, BoxUploadSession uploadSession) {
        return new BoxRequestsFile.CommitUploadSession(uploadedParts, null, null, null, uploadSession, mSession);
    }
1333189
protected void ack(TransactionAttempt tx, DrpcRequestInfo requestInfo)
    {
        if (logger.isDebugEnabled() == true)
        {
            String logFormat = "Transaction succeeded. TransactionAttempt={0}, DrpcRequestInfo={1}";
            logger.debug(MessageFormat.format(logFormat, tx, requestInfo));
        }

        try
        {
            this.fetchHelper.ack(requestInfo.getRequestId(), "Succeeded");
        }
        catch (TException ex)
        {
            String logFormat = "Success notify failed. TransactionAttempt={0}, DrpcRequestInfo={1}";
            logger.warn(MessageFormat.format(logFormat, tx, requestInfo));
        }
    }
286697
@Nullable
  public static ISessionWebScope getSessionWebScopeOfSession (@Nullable final HttpSession aHttpSession)
  {
    return aHttpSession == null ? null : getSessionWebScopeOfID (aHttpSession.getId ());
  }
674548
@Override
    public final void commit() throws XAException
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "commit", new Object[] { _resource, _xid, getPriority() });
        if (tcSummary.isDebugEnabled())
            Tr.debug(tcSummary, "xa_commit", this);
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Committing resource with priority " + getPriority());

        try {
            if (_state == FAILED)
                _resource = reconnectRM();

            _resource.commit(_xid, false);

            // Record the completion direction
            _completedCommit = true;

            destroy();
        } catch (XAException xae) {
            _completionXARC = xae.errorCode;
            // Record the completion XA return code
            FFDCFilter.processException(xae, "com.ibm.ws.Transaction.JTA.JTAXAResourceImpl.commit", "317", this);
            throw xae;
        } finally {
            if (tc.isEntryEnabled())
                Tr.exit(tc, "commit");
            if (tcSummary.isDebugEnabled())
                Tr.debug(tcSummary, "xa_commit result: " +
                                    XAReturnCodeHelper.convertXACode(_completionXARC));
        }
    }
1012628
private IQ receiveSessionAcceptAction(JingleSession session, Jingle inJingle) {

        // According to XEP-166 the only thing we can do is ack.
        session.setSessionState(JingleSessionStateActive.getInstance());
        return session.createAck(inJingle);
    }
781869
public static Optional<Session> find(HttpRequest<?> request) {
        return request.getAttributes().get(HttpSessionFilter.SESSION_ATTRIBUTE, Session.class);
    }
1183122
public static boolean migrate(final Session session, final MigrationResources resources) {
        return MigrationEngine.withSession(session).migrate(resources);
    }
652325
@Override
  public AppSession getSession(String sessionId, Class<? extends AppSession> aClass) {
    if (sessionId == null) {
      throw new IllegalArgumentException("SessionId must not be null");
    }
    if (!this.iss.exists(sessionId)) {
      return null;
    }
    AppSession appSession = null;
    try {
      if (aClass == ServerRfSession.class) {
        IServerRfSessionData sessionData = (IServerRfSessionData) this.sessionDataFactory.getAppSessionData(ServerRfSession.class, sessionId);
        // FIXME: determine how to get boolean flag!
        ServerRfSessionImpl session = new ServerRfSessionImpl(sessionData, sessionFactory, getServerSessionListener(), getServerContextListener(),
            getStateListener(), messageTimeout, true);

        session.getSessions().get(0).setRequestListener(session);
        appSession = session;
      }
      else if (aClass == ClientRfSession.class) {
        IClientRfSessionData sessionData = (IClientRfSessionData) this.sessionDataFactory.getAppSessionData(ClientRfSession.class, sessionId);
        ClientRfSessionImpl session = new ClientRfSessionImpl(sessionData, sessionFactory, getClientSessionListener(), getClientContextListener(),
            getStateListener(), this.getApplicationId());

        session.getSessions().get(0).setRequestListener(session);
        appSession = session;
      }
      else {
        throw new IllegalArgumentException("Wrong session class: " + aClass + ". Supported[" + ClientRfSession.class + "," + ServerRfSession.class + "]");
      }
    }
    catch (Exception e) {
      logger.error("Failure to obtain new Rf Session.", e);
    }

    return appSession;
  }
679256
synchronized void prepareCommit(Session session) {

        RowActionBase action = this;

        do {
            if (action.session == session && action.commitTimestamp == 0) {
                action.prepared = true;
            }

            action = action.next;
        } while (action != null);
    }
1233850
def session_commit(self, session):
        
        # this may happen when there's nothing to commit
        if not hasattr(session, 'meepo_unique_id'):
            self.logger.debug("skipped - session_commit")
            return

        self._session_pub(session)
        self._session_del(session)
873474
@Override
  public BaseSession getSession(String sessionId) {
    if (this.localDataSource.exists(sessionId)) {
      return this.localDataSource.getSession(sessionId);
    }
    else if (!this.localMode && this.existReplicated(sessionId)) {
      this.makeLocal(sessionId);
      return this.localDataSource.getSession(sessionId);
    }

    return null;
  }
640515
public GetSessionResponse getSession(GetSessionRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SESSION,
                request.getSessionId());
        return invokeHttpClient(internalRequest, GetSessionResponse.class);
    }
489820
public void commit(boolean force) {
        if (checkSession()) {
            return;
        }

        if (log.isDebugEnabled()) {
            ToStringBuilder tsb = new ToStringBuilder(String.format("Committing transactional %s@%x",
                    sqlSession.getClass().getSimpleName(),sqlSession.hashCode()));
            tsb.append("force", force);
            log.debug(tsb.toString());
        }

        sqlSession.commit(force);
    }
403424
@Override
	public void commit() throws IndoubtException {
		session.transaction.remove();
		
		if (logs.size() == 0) {
			return;
		}
		
		try {
			for (Log log : logs) {
				if (log.operation() != Operation.GET) {
					if (transaction.isActive()) {
						transaction.commit();
					}
					
					log.state(State.COMMITTED);
				}
			}

		} catch (Exception e) {
			throw new UncheckedException(e);
		}
		
		logger.fine("Transaction [" + id + "] committed");
	}
72912
@Override
    public int doEndTag() throws JspException {
        try {
            conn.commit();
        } catch (SQLException e) {
            throw new JspTagException(
                    Resources.getMessage("TRANSACTION_COMMIT_ERROR",
                            e.toString()), e);
        }
        return EVAL_PAGE;
    }