org.apache.catalina.session.ManagerBase Java Examples

The following examples show how to use org.apache.catalina.session.ManagerBase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSSOnonLoginAndBasicAuthenticator.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
private void doImminentSessionTimeout(Context activeContext) {

        ManagerBase manager = (ManagerBase) activeContext.getManager();
        Session[] sessions = manager.findSessions();
        for (int i = 0; i < sessions.length; i++) {
            if (sessions[i]!=null && sessions[i].isValid()) {
                sessions[i].setMaxInactiveInterval(EXTRA_DELAY_SECS);
                // leave it to be expired by the manager
            }
        }
        try {
            Thread.sleep(REASONABLE_MSECS_TO_EXPIRY);
        } catch (InterruptedException ie) {
            // ignored
        }

        // paranoid verification that active sessions have now gone
        sessions = manager.findSessions();
        assertTrue(sessions.length == 0);
    }
 
Example #2
Source File: TestSSOnonLoginAndBasicAuthenticator.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
private void doImminentSessionTimeout(Context activeContext) {

        ManagerBase manager = (ManagerBase) activeContext.getManager();
        Session[] sessions = manager.findSessions();
        for (int i = 0; i < sessions.length; i++) {
            if (sessions[i]!=null && sessions[i].isValid()) {
                sessions[i].setMaxInactiveInterval(EXTRA_DELAY_SECS);
                // leave it to be expired by the manager
            }
        }
        try {
            Thread.sleep(REASONABLE_MSECS_TO_EXPIRY);
        } catch (InterruptedException ie) {
            // ignored
        }

        // paranoid verification that active sessions have now gone
        sessions = manager.findSessions();
        assertTrue(sessions.length == 0);
    }
 
Example #3
Source File: JvmRouteBinderValve.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * get jvmroute from engine
 *
 * @param request current request
 * @return return jvmRoute from ManagerBase or null
 */
protected String getLocalJvmRoute(Request request) {
    Manager manager = getManager(request);
    if(manager instanceof ManagerBase) {
        return ((ManagerBase) manager).getJvmRoute();
    }
    return null ;
}
 
Example #4
Source File: DeltaSession.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public ClassLoader[] getClassLoaders() {
    if (manager instanceof ClusterManagerBase) {
        return ((ClusterManagerBase)manager).getClassLoaders();
    } else if (manager instanceof ManagerBase) {
        ManagerBase mb = (ManagerBase)manager;
        return ClusterManagerBase.getClassLoaders(mb.getContext());
    }
    return null;
}
 
Example #5
Source File: TestSSOnonLoginAndBasicAuthenticator.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void doImminentSessionTimeout(Context activeContext) {

        ManagerBase manager = (ManagerBase) activeContext.getManager();
        Session[] sessions = manager.findSessions();
        for (int i = 0; i < sessions.length; i++) {
            if (sessions[i]!=null && sessions[i].isValid()) {
                sessions[i].setMaxInactiveInterval(EXTRA_DELAY_SECS);
                // leave it to be expired by the manager
            }
        }


        try {
            Thread.sleep(EXTRA_DELAY_SECS * 1000);
        } catch (InterruptedException ie) {
            // ignored
        }

        // Paranoid verification that active sessions have now gone
        int count = 0;
        sessions = manager.findSessions();
        while (sessions.length != 0 && count < TIMEOUT_WAIT_SECS) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // Ignore
            }
            sessions = manager.findSessions();
            count++;
        }

        sessions = manager.findSessions();
        Assert.assertTrue(sessions.length == 0);
    }
 
Example #6
Source File: TestSSOnonLoginAndBasicAuthenticator.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void setRapidSessionTimeoutDetection() {

        ((ManagerBase) basicContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
        ((ManagerBase) nonloginContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
    }
 
Example #7
Source File: TestSSOnonLoginAndBasicAuthenticator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
private void setRapidSessionTimeoutDetection() {

        ((ManagerBase) basicContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
        ((ManagerBase) nonloginContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
    }
 
Example #8
Source File: TomcatEmbeddedContext.java    From spring-graalvm-native with Apache License 2.0 5 votes vote down vote up
@Override
public void setManager(Manager manager) {
	if (manager instanceof ManagerBase) {
		manager.setSessionIdGenerator(new LazySessionIdGenerator());
	}
	super.setManager(manager);
}
 
Example #9
Source File: DeltaSession.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public ClassLoader[] getClassLoaders() {
    if ( manager instanceof BackupManager ) return ((BackupManager)manager).getClassLoaders();
    else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders();
    else if ( manager instanceof StandardManager ) {
        StandardManager sm = (StandardManager)manager;
        return ClusterManagerBase.getClassLoaders(sm.getContainer());
    } else if ( manager instanceof ManagerBase ) {
        ManagerBase mb = (ManagerBase)manager;
        return ClusterManagerBase.getClassLoaders(mb.getContainer());
    }//end if
    return null;
}
 
Example #10
Source File: JvmRouteBinderValve.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * get jvmroute from engine
 * 
 * @param request current request
 * @return return jvmRoute from ManagerBase or null
 */
protected String getLocalJvmRoute(Request request) {
    Manager manager = getManager(request);
    if(manager instanceof ManagerBase)
        return ((ManagerBase) manager).getJvmRoute();
    return null ;
}
 
Example #11
Source File: TestSSOnonLoginAndBasicAuthenticator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
private void setRapidSessionTimeoutDetection() {

        ((ManagerBase) basicContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
        ((ManagerBase) nonloginContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
    }
 
Example #12
Source File: DeltaSession.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public ClassLoader[] getClassLoaders() {
    if ( manager instanceof BackupManager ) return ((BackupManager)manager).getClassLoaders();
    else if ( manager instanceof ClusterManagerBase ) return ((ClusterManagerBase)manager).getClassLoaders();
    else if ( manager instanceof StandardManager ) {
        StandardManager sm = (StandardManager)manager;
        return ClusterManagerBase.getClassLoaders(sm.getContainer());
    } else if ( manager instanceof ManagerBase ) {
        ManagerBase mb = (ManagerBase)manager;
        return ClusterManagerBase.getClassLoaders(mb.getContainer());
    }//end if
    return null;
}
 
Example #13
Source File: JvmRouteBinderValve.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * get jvmroute from engine
 * 
 * @param request current request
 * @return return jvmRoute from ManagerBase or null
 */
protected String getLocalJvmRoute(Request request) {
    Manager manager = getManager(request);
    if(manager instanceof ManagerBase)
        return ((ManagerBase) manager).getJvmRoute();
    return null ;
}
 
Example #14
Source File: TestNonLoginAndBasicAuthenticator.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
private void setRapidSessionTimeout() {

        ((ManagerBase) basicContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
    }
 
Example #15
Source File: DeltaManager.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * Reset manager statistics
 */
public synchronized void resetStatistics() {
    processingTime = 0 ;
    expiredSessions.set(0);
    synchronized (sessionCreationTiming) {
        sessionCreationTiming.clear();
        while (sessionCreationTiming.size() <
                ManagerBase.TIMING_STATS_CACHE_SIZE) {
            sessionCreationTiming.add(null);
        }
    }
    synchronized (sessionExpirationTiming) {
        sessionExpirationTiming.clear();
        while (sessionExpirationTiming.size() <
                ManagerBase.TIMING_STATS_CACHE_SIZE) {
            sessionExpirationTiming.add(null);
        }
    }
    rejectedSessions = 0 ;
    sessionReplaceCounter = 0 ;
    counterNoStateTransfered = 0 ;
    setMaxActive(getActiveSessions());
    sessionCounter = getActiveSessions() ;
    counterReceive_EVT_ALL_SESSION_DATA = 0;
    counterReceive_EVT_GET_ALL_SESSIONS = 0;
    counterReceive_EVT_SESSION_ACCESSED = 0 ;
    counterReceive_EVT_SESSION_CREATED = 0 ;
    counterReceive_EVT_SESSION_DELTA = 0 ;
    counterReceive_EVT_SESSION_EXPIRED = 0 ;
    counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
    counterReceive_EVT_CHANGE_SESSION_ID = 0;
    counterSend_EVT_ALL_SESSION_DATA = 0;
    counterSend_EVT_GET_ALL_SESSIONS = 0;
    counterSend_EVT_SESSION_ACCESSED = 0 ;
    counterSend_EVT_SESSION_CREATED = 0 ;
    counterSend_EVT_SESSION_DELTA = 0 ;
    counterSend_EVT_SESSION_EXPIRED = 0 ;
    counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
    counterSend_EVT_CHANGE_SESSION_ID = 0;
    
}
 
Example #16
Source File: TestNonLoginAndBasicAuthenticator.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
private void setRapidSessionTimeout() {

        ((ManagerBase) basicContext.getManager())
                .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
    }
 
Example #17
Source File: DeltaManager.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Reset manager statistics
 */
public synchronized void resetStatistics() {
    processingTime = 0 ;
    expiredSessions.set(0);
    synchronized (sessionCreationTiming) {
        sessionCreationTiming.clear();
        while (sessionCreationTiming.size() <
                ManagerBase.TIMING_STATS_CACHE_SIZE) {
            sessionCreationTiming.add(null);
        }
    }
    synchronized (sessionExpirationTiming) {
        sessionExpirationTiming.clear();
        while (sessionExpirationTiming.size() <
                ManagerBase.TIMING_STATS_CACHE_SIZE) {
            sessionExpirationTiming.add(null);
        }
    }
    rejectedSessions = 0 ;
    sessionReplaceCounter = 0 ;
    counterNoStateTransfered = 0 ;
    setMaxActive(getActiveSessions());
    sessionCounter = getActiveSessions() ;
    counterReceive_EVT_ALL_SESSION_DATA = 0;
    counterReceive_EVT_GET_ALL_SESSIONS = 0;
    counterReceive_EVT_SESSION_ACCESSED = 0 ;
    counterReceive_EVT_SESSION_CREATED = 0 ;
    counterReceive_EVT_SESSION_DELTA = 0 ;
    counterReceive_EVT_SESSION_EXPIRED = 0 ;
    counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
    counterReceive_EVT_CHANGE_SESSION_ID = 0;
    counterSend_EVT_ALL_SESSION_DATA = 0;
    counterSend_EVT_GET_ALL_SESSIONS = 0;
    counterSend_EVT_SESSION_ACCESSED = 0 ;
    counterSend_EVT_SESSION_CREATED = 0 ;
    counterSend_EVT_SESSION_DELTA = 0 ;
    counterSend_EVT_SESSION_EXPIRED = 0 ;
    counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
    counterSend_EVT_CHANGE_SESSION_ID = 0;
    
}
 
Example #18
Source File: TestNonLoginAndBasicAuthenticator.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
private void setRapidSessionTimeout() {
    basicContext.getParent().getParent().setBackgroundProcessorDelay(
            MANAGER_SCAN_INTERVAL_SECS);
    ((ManagerBase) basicContext.getManager())
            .setProcessExpiresFrequency(MANAGER_EXPIRE_SESSIONS_FAST);
}
 
Example #19
Source File: DeltaManager.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * Reset manager statistics
 */
public synchronized void resetStatistics() {
    processingTime = 0 ;
    expiredSessions.set(0);
    synchronized (sessionCreationTiming) {
        sessionCreationTiming.clear();
        while (sessionCreationTiming.size() <
                ManagerBase.TIMING_STATS_CACHE_SIZE) {
            sessionCreationTiming.add(null);
        }
    }
    synchronized (sessionExpirationTiming) {
        sessionExpirationTiming.clear();
        while (sessionExpirationTiming.size() <
                ManagerBase.TIMING_STATS_CACHE_SIZE) {
            sessionExpirationTiming.add(null);
        }
    }
    rejectedSessions = 0 ;
    sessionReplaceCounter = 0 ;
    counterNoStateTransfered = 0 ;
    setMaxActive(getActiveSessions());
    sessionCounter = getActiveSessions() ;
    counterReceive_EVT_ALL_SESSION_DATA = 0;
    counterReceive_EVT_GET_ALL_SESSIONS = 0;
    counterReceive_EVT_SESSION_ACCESSED = 0 ;
    counterReceive_EVT_SESSION_CREATED = 0 ;
    counterReceive_EVT_SESSION_DELTA = 0 ;
    counterReceive_EVT_SESSION_EXPIRED = 0 ;
    counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
    counterReceive_EVT_CHANGE_SESSION_ID = 0;
    counterSend_EVT_ALL_SESSION_DATA = 0;
    counterSend_EVT_GET_ALL_SESSIONS = 0;
    counterSend_EVT_SESSION_ACCESSED = 0 ;
    counterSend_EVT_SESSION_CREATED = 0 ;
    counterSend_EVT_SESSION_DELTA = 0 ;
    counterSend_EVT_SESSION_EXPIRED = 0 ;
    counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
    counterSend_EVT_CHANGE_SESSION_ID = 0;

}