Java 类org.apache.catalina.session.PersistentManager 实例源码

项目:tomcat7    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:apache-tomcat-7.0.73-with-comment    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:lazycat    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {

    if (getEnabled() && request.getContext() != null && request.getContext().getDistributable()
            && !request.isAsyncDispatching()) {
        // valve cluster can access manager - other cluster handle turnover
        // at host level - hopefully!
        Manager manager = request.getContext().getManager();

        if (manager != null && ((manager instanceof ClusterManager && getCluster() != null
                && getCluster().getManager(((ClusterManager) manager).getName()) != null)
                || (manager instanceof PersistentManager)))
            handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:spring-boot-spring-loaded-java8-example    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return factory -> {
        TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
        containerFactory.setTomcatContextCustomizers(Arrays.asList(context -> {
            final PersistentManager persistentManager = new PersistentManager();
            final FileStore store = new FileStore();

            final String sessionDirectory = makeSessionDirectory();
            log.info("Writing sessions to " + sessionDirectory);
            store.setDirectory(sessionDirectory);

            persistentManager.setStore(store);
            context.setManager(persistentManager);
        }));
    };
}
项目:class-guard    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:apache-tomcat-7.0.57    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:apache-tomcat-7.0.57    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:WBSAirback    文件:JvmRouteBinderValve.java   
/**
 * Detect possible the JVMRoute change at cluster backup node..
 * 
 * @param request
 *            tomcat request being processed
 * @param response
 *            tomcat response being processed
 * @exception IOException
 *                if an input/output error has occurred
 * @exception ServletException
 *                if a servlet error has occurred
 */
@Override
public void invoke(Request request, Response response) throws IOException,
        ServletException {

     if (getEnabled() &&
             request.getContext() != null &&
             request.getContext().getDistributable() &&
             !request.isAsyncDispatching()) {
         // valve cluster can access manager - other cluster handle turnover 
         // at host level - hopefully!
         Manager manager = request.getContext().getManager();

         if (manager != null && (
                 (manager instanceof ClusterManager
                   && getCluster() != null
                   && getCluster().getManager(((ClusterManager)manager).getName()) != null)
                 ||
                 (manager instanceof PersistentManager)))
             handlePossibleTurnover(request);
    }
    // Pass this request on to the next valve in our pipeline
    getNext().invoke(request, response);
}
项目:Equella    文件:TomcatServiceImpl.java   
private Manager getSessionManager(Context context)
{
    // Must be set for the persistent manager to work correctly.
    System.setProperty("org.apache.catalina.session.StandardSession.ACTIVITY_CHECK", "true");

    PersistentManager manager = new PersistentManager();
    StoreBase store;

    // Check if Migration has run and setup JDBC persistence
    if( !hibernateMigrationService.hasRunSystemMigration("com.tle.tomcat.migration.CreateTomcatSessionEntity") )
    {
        // Use filestore until JDBC setup complete
        LOGGER.info("Setting up temporary file session store");
        FileStore fileStore = new FileStore();
        fileStore.setDirectory(System.getProperty("java.io.tmpdir"));
        store = fileStore;
    }
    else
    {
        LOGGER.info("Setting up JDBC session store");
        JDBCStore jdbcStore = new JDBCStore();
        jdbcStore.setConnectionURL(dataSourceService.getSystemUrl());
        jdbcStore.setConnectionName(dataSourceService.getSystemUsername());
        jdbcStore.setConnectionPassword(dataSourceService.getSystemPassword());
        jdbcStore.setDriverName(dataSourceService.getDriverClass());
        jdbcStore.setSessionTable("tomcat_sessions");
        store = jdbcStore;
    }

    manager.setContext(context);
    manager.setProcessExpiresFrequency(3); // Every 30 seconds
    manager.setStore(store);
    // Persist immediately but leave in memory
    manager.setMaxIdleBackup(0);
    // Don't remove from memory for 30 minutes
    manager.setMaxIdleSwap((int) TimeUnit.MINUTES.toSeconds(30));

    return manager;
}
项目:jerrydog    文件:StandardServer.java   
/**
 * Store the specified Manager properties.
 *
 * @param writer PrintWriter to which we are storing
 * @param indent Number of spaces to indent this element
 * @param manager Object whose properties are being stored
 *
 * @exception Exception if an exception occurs while storing
 */
private void storeManager(PrintWriter writer, int indent,
                          Manager manager) throws Exception {

    if (isDefaultManager(manager)) {
        return;
    }

    // Store the beginning of this element
    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.print("<Manager");
    storeAttributes(writer, manager);
    writer.println(">");

    // Store nested <Store> element
    if (manager instanceof PersistentManager) {
        Store store = ((PersistentManager) manager).getStore();
        if (store != null) {
            storeStore(writer, indent + 2, store);
        }
    }

    // Store the ending of this element
    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.println("</Manager>");

}
项目:HowTomcatWorks    文件:StandardServer.java   
/**
 * Store the specified Manager properties.
 *
 * @param writer PrintWriter to which we are storing
 * @param indent Number of spaces to indent this element
 * @param manager Object whose properties are being stored
 *
 * @exception Exception if an exception occurs while storing
 */
private void storeManager(PrintWriter writer, int indent,
                          Manager manager) throws Exception {

    if (isDefaultManager(manager)) {
        return;
    }

    // Store the beginning of this element
    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.print("<Manager");
    storeAttributes(writer, manager);
    writer.println(">");

    // Store nested <Store> element
    if (manager instanceof PersistentManager) {
        Store store = ((PersistentManager) manager).getStore();
        if (store != null) {
            storeStore(writer, indent + 2, store);
        }
    }

    // Store the ending of this element
    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.println("</Manager>");

}