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


Java Session.getIdInternal方法代码示例

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


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

示例1: remove

import org.apache.catalina.Session; //导入方法依赖的package包/类
@Override
public void remove(Session session, boolean update) {
    // If the session has expired - as opposed to just being removed from
    // the manager because it is being persisted - update the expired stats
    if (update) {
        long timeNow = System.currentTimeMillis();
        int timeAlive =
            (int) (timeNow - session.getCreationTimeInternal())/1000;
        updateSessionMaxAliveTime(timeAlive);
        expiredSessions.incrementAndGet();
        SessionTiming timing = new SessionTiming(timeNow, timeAlive);
        synchronized (sessionExpirationTiming) {
            sessionExpirationTiming.add(timing);
            sessionExpirationTiming.poll();
        }
    }

    if (session.getIdInternal() != null) {
        sessions.remove(session.getIdInternal());
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:ManagerBase.java

示例2: remove

import org.apache.catalina.Session; //导入方法依赖的package包/类
@Override
public void remove(Session session, boolean update) {
	// If the session has expired - as opposed to just being removed from
	// the manager because it is being persisted - update the expired stats
	if (update) {
		long timeNow = System.currentTimeMillis();
		int timeAlive = (int) (timeNow - session.getCreationTimeInternal()) / 1000;
		updateSessionMaxAliveTime(timeAlive);
		expiredSessions.incrementAndGet();
		SessionTiming timing = new SessionTiming(timeNow, timeAlive);
		synchronized (sessionExpirationTiming) {
			sessionExpirationTiming.add(timing);
			sessionExpirationTiming.poll();
		}
	}

	if (session.getIdInternal() != null) {
		sessions.remove(session.getIdInternal());
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:ManagerBase.java

示例3: sendMessage

import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
* Send message delta message from request session 
* @param session current session
* @param manager session manager
* @param cluster replication cluster
*/
protected void sendMessage(Session session,
         ClusterManager manager, CatalinaCluster cluster) {
    String id = session.getIdInternal();
    if (id != null) {
        send(manager, cluster, id);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:ReplicationValve.java

示例4: findSession

import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p>
 * This method checks the persistence store if persistence is enabled,
 * otherwise just uses the functionality from ManagerBase.
 */
@Override
public Session findSession(String id) throws IOException {

    Session session = super.findSession(id);
    // OK, at this point, we're not sure if another thread is trying to
    // remove the session or not so the only way around this is to lock it
    // (or attempt to) and then try to get it by this session id again. If
    // the other code ran swapOut, then we should get a null back during
    // this run, and if not, we lock it out so we can access the session
    // safely.
    if(session != null) {
        synchronized(session){
            session = super.findSession(session.getIdInternal());
            if(session != null){
               // To keep any external calling code from messing up the
               // concurrency.
               session.access();
               session.endAccess();
            }
        }
    }
    if (session != null)
        return session;

    // See if the Session is in the Store
    session = swapIn(id);
    return session;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:35,代码来源:PersistentManagerBase.java

示例5: changeSessionId

import org.apache.catalina.Session; //导入方法依赖的package包/类
@Override
public void changeSessionId(Session session) {
    String oldId = session.getIdInternal();
    session.setId(generateSessionId(), false);
    String newId = session.getIdInternal();
    container.fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT,
            new String[] {oldId, newId});
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:ManagerBase.java

示例6: findSession

import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
 * Return the active Session, associated with this Manager, with the
 * specified session id (if any); otherwise return <code>null</code>.
 * This method checks the persistence store if persistence is enabled,
 * otherwise just uses the functionality from ManagerBase.
 *
 * @param id The session id for the session to be returned
 *
 * @exception IllegalStateException if a new session cannot be
 *  instantiated for any reason
 * @exception IOException if an input/output error occurs while
 *  processing this request
 */
public Session findSession(String id) throws IOException {

    Session session = super.findSession(id);
    // OK, at this point, we're not sure if another thread is trying to
    // remove the session or not so the only way around this is to lock it
    // (or attempt to) and then try to get it by this session id again. If
    // the other code ran swapOut, then we should get a null back during
    // this run, and if not, we lock it out so we can access the session
    // safely.
    if(session != null) {
        synchronized(session){
            session = super.findSession(session.getIdInternal());
            if(session != null){
               // To keep any external calling code from messing up the
               // concurrency.
               session.access();
               session.endAccess();
            }
        }
    }
    if (session != null)
        return (session);

    // See if the Session is in the Store
    session = swapIn(id);
    return (session);

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

示例7: findSession

import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p>
 * This method checks the persistence store if persistence is enabled,
 * otherwise just uses the functionality from ManagerBase.
 */
@Override
public Session findSession(String id) throws IOException {

	Session session = super.findSession(id);
	// OK, at this point, we're not sure if another thread is trying to
	// remove the session or not so the only way around this is to lock it
	// (or attempt to) and then try to get it by this session id again. If
	// the other code ran swapOut, then we should get a null back during
	// this run, and if not, we lock it out so we can access the session
	// safely.
	if (session != null) {
		synchronized (session) {
			session = super.findSession(session.getIdInternal());
			if (session != null) {
				// To keep any external calling code from messing up the
				// concurrency.
				session.access();
				session.endAccess();
			}
		}
	}
	if (session != null)
		return session;

	// See if the Session is in the Store
	session = swapIn(id);
	return session;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:35,代码来源:PersistentManagerBase.java

示例8: changeSessionId

import org.apache.catalina.Session; //导入方法依赖的package包/类
@Override
public void changeSessionId(Session session) {
	String oldId = session.getIdInternal();
	session.setId(generateSessionId(), false);
	String newId = session.getIdInternal();
	container.fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT, new String[] { oldId, newId });
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:8,代码来源:ManagerBase.java

示例9: sendMessage

import org.apache.catalina.Session; //导入方法依赖的package包/类
/**
 * Send message delta message from request session
 * 
 * @param session
 *            current session
 * @param manager
 *            session manager
 * @param cluster
 *            replication cluster
 */
protected void sendMessage(Session session, ClusterManager manager, CatalinaCluster cluster) {
	String id = session.getIdInternal();
	if (id != null) {
		send(manager, cluster, id);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:ReplicationValve.java


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