当前位置: 首页>>代码示例>>Java>>正文


Java Session.setValid方法代码示例

本文整理汇总了Java中org.apache.catalina.Session.setValid方法的典型用法代码示例。如果您正苦于以下问题:Java Session.setValid方法的具体用法?Java Session.setValid怎么用?Java Session.setValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.Session的用法示例。


在下文中一共展示了Session.setValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSession

import org.apache.catalina.Session; //导入方法依赖的package包/类
@Override
public Session createSession(String sessionId) {
    
    if ((maxActiveSessions >= 0) &&
            (getActiveSessions() >= maxActiveSessions)) {
        rejectedSessions++;
        throw new TooManyActiveSessionsException(
                sm.getString("managerBase.createSession.ise"),
                maxActiveSessions);
    }
    
    // Recycle or create a Session instance
    Session session = createEmptySession();

    // Initialize the properties of the new session and return it
    session.setNew(true);
    session.setValid(true);
    session.setCreationTime(System.currentTimeMillis());
    session.setMaxInactiveInterval(((Context) getContainer()).getSessionTimeout() * 60);
    String id = sessionId;
    if (id == null) {
        id = generateSessionId();
    }
    session.setId(id);
    sessionCounter++;

    SessionTiming timing = new SessionTiming(session.getCreationTime(), 0);
    synchronized (sessionCreationTiming) {
        sessionCreationTiming.add(timing);
        sessionCreationTiming.poll();
    }
    return (session);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:35,代码来源:ManagerBase.java

示例2: createSession

import org.apache.catalina.Session; //导入方法依赖的package包/类
@Override
public Session createSession(String sessionId) {

	if ((maxActiveSessions >= 0) && (getActiveSessions() >= maxActiveSessions)) {
		rejectedSessions++;
		throw new TooManyActiveSessionsException(sm.getString("managerBase.createSession.ise"), maxActiveSessions);
	}

	// Recycle or create a Session instance
	Session session = createEmptySession();

	// Initialize the properties of the new session and return it
	session.setNew(true);
	session.setValid(true);
	session.setCreationTime(System.currentTimeMillis());
	session.setMaxInactiveInterval(((Context) getContainer()).getSessionTimeout() * 60);
	String id = sessionId;
	if (id == null) {
		id = generateSessionId();
	}
	session.setId(id);
	sessionCounter++;

	SessionTiming timing = new SessionTiming(session.getCreationTime(), 0);
	synchronized (sessionCreationTiming) {
		sessionCreationTiming.add(timing);
		sessionCreationTiming.poll();
	}
	return (session);

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:ManagerBase.java

示例3: createSession

import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
 * Construct and return a new session object, based on the default
 * settings specified by this Manager's properties.  The session
 * id specified will be used as the session id.  
 * If a new session cannot be created for any reason, return 
 * <code>null</code>.
 * 
 * @param sessionId The session id which should be used to create the
 *  new session; if <code>null</code>, a new session id will be
 *  generated
 * @exception IllegalStateException if a new session cannot be
 *  instantiated for any reason
 */
public Session createSession(String sessionId) {
    
    // Recycle or create a Session instance
    Session session = createEmptySession();

    // Initialize the properties of the new session and return it
    session.setNew(true);
    session.setValid(true);
    session.setCreationTime(System.currentTimeMillis());
    session.setMaxInactiveInterval(this.maxInactiveInterval);
    if (sessionId == null) {
        sessionId = generateSessionId();
    // FIXME WHy we need no duplication check?
    /*         
         synchronized (sessions) {
            while (sessions.get(sessionId) != null) { // Guarantee
                // uniqueness
                duplicates++;
                sessionId = generateSessionId();
            }
        }
    */
        
        // FIXME: Code to be used in case route replacement is needed
        /*
    } else {
        String jvmRoute = getJvmRoute();
        if (getJvmRoute() != null) {
            String requestJvmRoute = null;
            int index = sessionId.indexOf(".");
            if (index > 0) {
                requestJvmRoute = sessionId
                        .substring(index + 1, sessionId.length());
            }
            if (requestJvmRoute != null && !requestJvmRoute.equals(jvmRoute)) {
                sessionId = sessionId.substring(0, index) + "." + jvmRoute;
            }
        }
        */
    }
    session.setId(sessionId);
    sessionCounter++;

    return (session);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:60,代码来源:ManagerBase.java


注:本文中的org.apache.catalina.Session.setValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。