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


Java Context.getManager方法代码示例

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


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

示例1: doImminentSessionTimeout

import org.apache.catalina.Context; //导入方法依赖的package包/类
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);
    }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TestSSOnonLoginAndBasicAuthenticator.java

示例2: invoke

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Log the interesting request parameters, invoke the next Valve in the
 * sequence, and log the interesting response parameters.
 *
 * @param request The servlet request to be processed
 * @param response The servlet response to be created
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
@Override
public void invoke(Request request, Response response)
    throws IOException, ServletException
{
    long totalstart = 0;

    //this happens before the request
    if(doStatistics()) {
        totalstart = System.currentTimeMillis();
    }
    if (primaryIndicator) {
        createPrimaryIndicator(request) ;
    }
    Context context = request.getContext();
    boolean isCrossContext = context != null
            && context instanceof StandardContext
            && ((StandardContext) context).getCrossContext();
    try {
        if(isCrossContext) {
            if(log.isDebugEnabled())
                log.debug(sm.getString("ReplicationValve.crossContext.add"));
            //FIXME add Pool of Arraylists
            crossContextSessions.set(new ArrayList<DeltaSession>());
        }
        getNext().invoke(request, response);
        if(context != null && cluster != null
                && context.getManager() instanceof ClusterManager) {
            ClusterManager clusterManager = (ClusterManager) context.getManager();

            // valve cluster can access manager - other cluster handle replication 
            // at host level - hopefully!
            if(cluster.getManager(clusterManager.getName()) == null)
                return ;
            if(cluster.hasMembers()) {
                sendReplicationMessage(request, totalstart, isCrossContext, clusterManager, cluster);
            } else {
                resetReplicationRequest(request,isCrossContext);
            }        
        }
    } finally {
        // Array must be remove: Current master request send endAccess at recycle. 
        // Don't register this request session again!
        if(isCrossContext) {
            if(log.isDebugEnabled())
                log.debug(sm.getString("ReplicationValve.crossContext.remove"));
            // crossContextSessions.remove() only exist at Java 5
            // register ArrayList at a pool
            crossContextSessions.set(null);
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:62,代码来源:ReplicationValve.java

示例3: getSessionsForName

import org.apache.catalina.Context; //导入方法依赖的package包/类
protected List<Session> getSessionsForName(ContextName cn,
        StringManager smClient) {
    if ((cn == null) || !(cn.getPath().startsWith("/") ||
            cn.getPath().equals(""))) {
        String path = null;
        if (cn != null) {
            path = cn.getPath();
        }
        throw new IllegalArgumentException(smClient.getString(
                "managerServlet.invalidPath",
                RequestUtil.filter(path)));
    }

    Context ctxt = (Context) host.findChild(cn.getName());
    if (null == ctxt) {
        throw new IllegalArgumentException(smClient.getString(
                "managerServlet.noContext",
                RequestUtil.filter(cn.getDisplayName())));
    }
    Manager manager = ctxt.getManager();
    List<Session> sessions = new ArrayList<Session>();
    sessions.addAll(Arrays.asList(manager.findSessions()));
    if (manager instanceof DistributedManager && showProxySessions) {
        // Add dummy proxy sessions
        Set<String> sessionIds =
            ((DistributedManager) manager).getSessionIdsFull();
        // Remove active (primary and backup) session IDs from full list
        for (Session session : sessions) {
            sessionIds.remove(session.getId());
        }
        // Left with just proxy sessions - add them
        for (String sessionId : sessionIds) {
            sessions.add(new DummyProxySession(sessionId));
        }
    }
    return sessions;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:38,代码来源:HTMLManagerServlet.java

示例4: expire

import org.apache.catalina.Context; //导入方法依赖的package包/类
private void expire(SingleSignOnSessionKey key) {
    if (engine == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.engineNull", key));
        return;
    }
    Container host = engine.findChild(key.getHostName());
    if (host == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.hostNotFound", key));
        return;
    }
    Context context = (Context) host.findChild(key.getContextName());
    if (context == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.contextNotFound", key));
        return;
    }
    Manager manager = context.getManager();
    if (manager == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerNotFound", key));
        return;
    }
    Session session = null;
    try {
        session = manager.findSession(key.getSessionId());
    } catch (IOException e) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerError", key), e);
        return;
    }
    if (session == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.sessionNotFound", key));
        return;
    }
    session.expire();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:SingleSignOn.java

示例5: invoke

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Log the interesting request parameters, invoke the next Valve in the
 * sequence, and log the interesting response parameters.
 *
 * @param request
 *            The servlet request to be processed
 * @param response
 *            The servlet response to be created
 *
 * @exception IOException
 *                if an input/output error occurs
 * @exception ServletException
 *                if a servlet error occurs
 */
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
	long totalstart = 0;

	// this happens before the request
	if (doStatistics()) {
		totalstart = System.currentTimeMillis();
	}
	if (primaryIndicator) {
		createPrimaryIndicator(request);
	}
	Context context = request.getContext();
	boolean isCrossContext = context != null && context instanceof StandardContext
			&& ((StandardContext) context).getCrossContext();
	try {
		if (isCrossContext) {
			if (log.isDebugEnabled())
				log.debug(sm.getString("ReplicationValve.crossContext.add"));
			// FIXME add Pool of Arraylists
			crossContextSessions.set(new ArrayList<DeltaSession>());
		}
		getNext().invoke(request, response);
		if (context != null && cluster != null && context.getManager() instanceof ClusterManager) {
			ClusterManager clusterManager = (ClusterManager) context.getManager();

			// valve cluster can access manager - other cluster handle
			// replication
			// at host level - hopefully!
			if (cluster.getManager(clusterManager.getName()) == null)
				return;
			if (cluster.hasMembers()) {
				sendReplicationMessage(request, totalstart, isCrossContext, clusterManager, cluster);
			} else {
				resetReplicationRequest(request, isCrossContext);
			}
		}
	} finally {
		// Array must be remove: Current master request send endAccess at
		// recycle.
		// Don't register this request session again!
		if (isCrossContext) {
			if (log.isDebugEnabled())
				log.debug(sm.getString("ReplicationValve.crossContext.remove"));
			// crossContextSessions.remove() only exist at Java 5
			// register ArrayList at a pool
			crossContextSessions.set(null);
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:64,代码来源:ReplicationValve.java

示例6: getSessionsForName

import org.apache.catalina.Context; //导入方法依赖的package包/类
protected List<Session> getSessionsForName(ContextName cn, StringManager smClient) {
	if ((cn == null) || !(cn.getPath().startsWith("/") || cn.getPath().equals(""))) {
		String path = null;
		if (cn != null) {
			path = cn.getPath();
		}
		throw new IllegalArgumentException(
				smClient.getString("managerServlet.invalidPath", RequestUtil.filter(path)));
	}

	Context ctxt = (Context) host.findChild(cn.getName());
	if (null == ctxt) {
		throw new IllegalArgumentException(
				smClient.getString("managerServlet.noContext", RequestUtil.filter(cn.getDisplayName())));
	}
	Manager manager = ctxt.getManager();
	List<Session> sessions = new ArrayList<Session>();
	sessions.addAll(Arrays.asList(manager.findSessions()));
	if (manager instanceof DistributedManager && showProxySessions) {
		// Add dummy proxy sessions
		Set<String> sessionIds = ((DistributedManager) manager).getSessionIdsFull();
		// Remove active (primary and backup) session IDs from full list
		for (Session session : sessions) {
			sessionIds.remove(session.getId());
		}
		// Left with just proxy sessions - add them
		for (String sessionId : sessionIds) {
			sessions.add(new DummyProxySession(sessionId));
		}
	}
	return sessions;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:33,代码来源:HTMLManagerServlet.java

示例7: expire

import org.apache.catalina.Context; //导入方法依赖的package包/类
private void expire(SingleSignOnSessionKey key) {
	if (engine == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.engineNull", key));
		return;
	}
	Container host = engine.findChild(key.getHostName());
	if (host == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.hostNotFound", key));
		return;
	}
	Context context = (Context) host.findChild(key.getContextName());
	if (context == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.contextNotFound", key));
		return;
	}
	Manager manager = context.getManager();
	if (manager == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerNotFound", key));
		return;
	}
	Session session = null;
	try {
		session = manager.findSession(key.getSessionId());
	} catch (IOException e) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerError", key), e);
		return;
	}
	if (session == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.sessionNotFound", key));
		return;
	}
	session.expire();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:34,代码来源:SingleSignOn.java

示例8: checkUndeploy

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Check for old versions of applications using parallel deployment that are
 * now unused (have no active sessions) and undeploy any that are found.
 */
public synchronized void checkUndeploy() {
    // Need ordered set of names
    SortedSet<String> sortedAppNames = new TreeSet<String>();
    sortedAppNames.addAll(deployed.keySet());

    if (sortedAppNames.size() < 2) {
        return;
    }
    Iterator<String> iter = sortedAppNames.iterator();

    ContextName previous = new ContextName(iter.next(), false);
    do {
        ContextName current = new ContextName(iter.next(), false);

        if (current.getPath().equals(previous.getPath())) {
            // Current and previous are same path - current will always
            // be a later version
            Context previousContext = (Context) host.findChild(previous.getName());
            Context currentContext = (Context) host.findChild(current.getName());
            if (previousContext != null && currentContext != null &&
                    currentContext.getState().isAvailable() &&
                    !isServiced(previous.getName())) {
                Manager manager = previousContext.getManager();
                if (manager != null) {
                    int sessionCount;
                    if (manager instanceof DistributedManager) {
                        sessionCount = ((DistributedManager) manager).getActiveSessionsFull();
                    } else {
                        sessionCount = manager.getActiveSessions();
                    }
                    if (sessionCount == 0) {
                        if (log.isInfoEnabled()) {
                            log.info(sm.getString(
                                    "hostConfig.undeployVersion", previous.getName()));
                        }
                        DeployedApplication app = deployed.get(previous.getName());
                        String[] resources = app.redeployResources.keySet().toArray(new String[0]);
                        // Version is unused - undeploy it completely
                        // The -1 is a 'trick' to ensure all redeploy
                        // resources are removed
                        undeploy(app);
                        deleteRedeployResources(app, resources, -1, true);
                    }
                }
            }
        }
        previous = current;
    } while (iter.hasNext());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:54,代码来源:HostConfig.java

示例9: createMBeans

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
     * Create the MBeans for the specified Context and its nested components.
     *
     * @param context Context for which to create MBeans
     *
     * @exception Exception if an exception is thrown during MBean creation
     */
    protected void createMBeans(Context context) throws Exception {

        // Create the MBean for the Context itself
//        if (log.isDebugEnabled())
//            log.debug("Creating MBean for Context " + context);
//        MBeanUtils.createMBean(context);
        context.addContainerListener(this);
        if (context instanceof StandardContext) {
            ((StandardContext) context).addPropertyChangeListener(this);
            ((StandardContext) context).addLifecycleListener(this);
        }

        // If the context is privileged, give a reference to it
        // in a servlet context attribute
        if (context.getPrivileged()) {
            context.getServletContext().setAttribute
                (Globals.MBEAN_REGISTRY_ATTR,
                 MBeanUtils.createRegistry());
            context.getServletContext().setAttribute
                (Globals.MBEAN_SERVER_ATTR,
                 MBeanUtils.createServer());
        }

        // Create the MBeans for the associated nested components
        Loader cLoader = context.getLoader();
        if (cLoader != null) {
            if (log.isDebugEnabled())
                log.debug("Creating MBean for Loader " + cLoader);
            //MBeanUtils.createMBean(cLoader);
        }
        Manager cManager = context.getManager();
        if (cManager != null) {
            if (log.isDebugEnabled())
                log.debug("Creating MBean for Manager " + cManager);
            //MBeanUtils.createMBean(cManager);
        }
        Realm hRealm = context.getParent().getRealm();
        Realm cRealm = context.getRealm();
        if ((cRealm != null) && (cRealm != hRealm)) {
            if (log.isDebugEnabled())
                log.debug("Creating MBean for Realm " + cRealm);
            //MBeanUtils.createMBean(cRealm);
        }

        // Create the MBeans for the NamingResources (if any)
        NamingResources resources = context.getNamingResources();
        createMBeans(resources);

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

示例10: destroyMBeans

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Deregister the MBeans for the specified Context and its nested
 * components.
 *
 * @param context Context for which to deregister MBeans
 *
 * @exception Exception if an exception is thrown during MBean destruction
 */
protected void destroyMBeans(Context context) throws Exception {

    // Deregister ourselves as a ContainerListener
    context.removeContainerListener(this);

    // Destroy the MBeans for the associated nested components
    Realm hRealm = context.getParent().getRealm();
    Realm cRealm = context.getRealm();
    if ((cRealm != null) && (cRealm != hRealm)) {
        if (log.isDebugEnabled())
            log.debug("Destroying MBean for Realm " + cRealm);
        //MBeanUtils.destroyMBean(cRealm);
    }
    Manager cManager = context.getManager();
    if (cManager != null) {
        if (log.isDebugEnabled())
            log.debug("Destroying MBean for Manager " + cManager);
        //MBeanUtils.destroyMBean(cManager);
    }
    Loader cLoader = context.getLoader();
    if (cLoader != null) {
        if (log.isDebugEnabled())
            log.debug("Destroying MBean for Loader " + cLoader);
        //MBeanUtils.destroyMBean(cLoader);
    }

    // Destroy the MBeans for the NamingResources (if any)
    NamingResources resources = context.getNamingResources();
    if (resources != null) {
        destroyMBeans(resources);
    }

    // deregister the MBean for the Context itself
    if (log.isDebugEnabled())
        log.debug("Destroying MBean for Context " + context);
    //MBeanUtils.destroyMBean(context);
    if (context instanceof StandardContext) {
        ((StandardContext) context).
            removePropertyChangeListener(this);
    }

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

示例11: createMBeans

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Create the MBeans for the specified Context and its nested components.
 *
 * @param context Context for which to create MBeans
 *
 * @exception Exception if an exception is thrown during MBean creation
 */
protected void createMBeans(Context context) throws Exception {
    // Create the MBean for the Context itself
    if (debug >= 4)
        log("Creating MBean for Context " + context);
    MBeanUtils.createMBean(context);
    context.addContainerListener(this);
    if (context instanceof StandardContext) {
        ((StandardContext) context).addPropertyChangeListener(this);
        ((StandardContext) context).addLifecycleListener(this);
    }

    // If the context is privileged, give a reference to it
    // in a servlet context attribute
    if (context.getPrivileged()) {
        context.getServletContext().setAttribute
            (Globals.MBEAN_REGISTRY_ATTR,
             MBeanUtils.createRegistry());
        context.getServletContext().setAttribute
            (Globals.MBEAN_SERVER_ATTR, 
             MBeanUtils.createServer());
    }

    // Create the MBeans for the associated nested components
    Loader cLoader = context.getLoader();
    if (cLoader != null) {
        if (debug >= 4)
            log("Creating MBean for Loader " + cLoader);
        MBeanUtils.createMBean(cLoader);
    }
    Logger hLogger = context.getParent().getLogger();
    Logger cLogger = context.getLogger();
    if ((cLogger != null) && (cLogger != hLogger)) {
        if (debug >= 4)
            log("Creating MBean for Logger " + cLogger);
        MBeanUtils.createMBean(cLogger);
    }
    Manager cManager = context.getManager();
    if (cManager != null) {
        if (debug >= 4)
            log("Creating MBean for Manager " + cManager);
        MBeanUtils.createMBean(cManager);
    }
    Realm hRealm = context.getParent().getRealm();
    Realm cRealm = context.getRealm();
    if ((cRealm != null) && (cRealm != hRealm)) {
        if (debug >= 4)
            log("Creating MBean for Realm " + cRealm);
        MBeanUtils.createMBean(cRealm);
    }

    // Create the MBeans for the associated Valves
    if (context instanceof StandardContext) {
        Valve cValves[] = ((StandardContext)context).getValves();
        for (int l = 0; l < cValves.length; l++) {
            if (debug >= 4)
                log("Creating MBean for Valve " + cValves[l]);
            MBeanUtils.createMBean(cValves[l]);
        }
        
    }        
    
    // Create the MBeans for the NamingResources (if any)
    NamingResources resources = context.getNamingResources();
    createMBeans(resources);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:74,代码来源:ServerLifecycleListener.java

示例12: destroyMBeans

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Deregister the MBeans for the specified Context and its nested
 * components.
 *
 * @param context Context for which to deregister MBeans
 *
 * @exception Exception if an exception is thrown during MBean destruction
 */
protected void destroyMBeans(Context context) throws Exception {

    // Deregister ourselves as a ContainerListener
    context.removeContainerListener(this);

    // destroy the MBeans for the associated Valves
    if (context instanceof StandardContext) {
        Valve cValves[] = ((StandardContext)context).getValves();
        for (int l = 0; l < cValves.length; l++) {
            if (debug >= 4)
                log("Destroying MBean for Valve " + cValves[l]);
            MBeanUtils.destroyMBean(cValves[l], context);
        }
        
    }

    // Destroy the MBeans for the associated nested components
    Realm hRealm = context.getParent().getRealm();
    Realm cRealm = context.getRealm();
    if ((cRealm != null) && (cRealm != hRealm)) {
        if (debug >= 4)
            log("Destroying MBean for Realm " + cRealm);
        MBeanUtils.destroyMBean(cRealm);
    }
    Manager cManager = context.getManager();
    if (cManager != null) {
        if (debug >= 4)
            log("Destroying MBean for Manager " + cManager);
        MBeanUtils.destroyMBean(cManager);
    }
    Logger hLogger = context.getParent().getLogger();
    Logger cLogger = context.getLogger();
    if ((cLogger != null) && (cLogger != hLogger)) {
        if (debug >= 4)
            log("Destroying MBean for Logger " + cLogger);
        MBeanUtils.destroyMBean(cLogger);
    }
    Loader cLoader = context.getLoader();
    if (cLoader != null) {
        if (debug >= 4)
            log("Destroying MBean for Loader " + cLoader);
        MBeanUtils.destroyMBean(cLoader);
    }

    // Destroy the MBeans for the NamingResources (if any)
    NamingResources resources = context.getNamingResources();
    if (resources != null) {
        destroyMBeans(resources);
    }
    
    // deregister the MBean for the Context itself
    if (debug >= 4)
        log("Destroying MBean for Context " + context);
    MBeanUtils.destroyMBean(context);
    if (context instanceof StandardContext) {
        ((StandardContext) context).
            removePropertyChangeListener(this);
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:69,代码来源:ServerLifecycleListener.java

示例13: invoke

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Select the appropriate child Context to process this request,
 * based on the specified request URI.  If no matching Context can
 * be found, return an appropriate HTTP error.
 *
 * @param request Request to be processed
 * @param response Response to be produced
 * @param valveContext Valve context used to forward to the next Valve
 *
 * @exception IOException if an input/output error occurred
 * @exception ServletException if a servlet error occurred
 */
public void invoke(Request request, Response response,
                   ValveContext valveContext)
    throws IOException, ServletException {

    // Validate the request and response object types
    if (!(request.getRequest() instanceof HttpServletRequest) ||
        !(response.getResponse() instanceof HttpServletResponse)) {
        return;     // NOTE - Not much else we can do generically
    }

    // Select the Context to be used for this Request
    StandardHost host = (StandardHost) getContainer();
    Context context = (Context) host.map(request, true);
    if (context == null) {
        ((HttpServletResponse) response.getResponse()).sendError
            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
             sm.getString("standardHost.noContext"));
        return;
    }

    // Bind the context CL to the current thread
    Thread.currentThread().setContextClassLoader
        (context.getLoader().getClassLoader());

    // Update the session last access time for our session (if any)
    HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
    String sessionId = hreq.getRequestedSessionId();
    if (sessionId != null) {
        Manager manager = context.getManager();
        if (manager != null) {
            Session session = manager.findSession(sessionId);
            if ((session != null) && session.isValid())
                session.access();
        }
    }

    // Ask this Context to process this request
    context.invoke(request, response);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:53,代码来源:StandardHostValve.java

示例14: checkUndeploy

import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
 * Check for old versions of applications using parallel deployment that are
 * now unused (have no active sessions) and undeploy any that are found.
 */
public synchronized void checkUndeploy() {
	// Need ordered set of names
	SortedSet<String> sortedAppNames = new TreeSet<String>();
	sortedAppNames.addAll(deployed.keySet());

	if (sortedAppNames.size() < 2) {
		return;
	}
	Iterator<String> iter = sortedAppNames.iterator();

	ContextName previous = new ContextName(iter.next(), false);
	do {
		ContextName current = new ContextName(iter.next(), false);

		if (current.getPath().equals(previous.getPath())) {
			// Current and previous are same path - current will always
			// be a later version
			Context previousContext = (Context) host.findChild(previous.getName());
			Context currentContext = (Context) host.findChild(current.getName());
			if (previousContext != null && currentContext != null && currentContext.getState().isAvailable()
					&& !isServiced(previous.getName())) {
				Manager manager = previousContext.getManager();
				if (manager != null) {
					int sessionCount;
					if (manager instanceof DistributedManager) {
						sessionCount = ((DistributedManager) manager).getActiveSessionsFull();
					} else {
						sessionCount = manager.getActiveSessions();
					}
					if (sessionCount == 0) {
						if (log.isInfoEnabled()) {
							log.info(sm.getString("hostConfig.undeployVersion", previous.getName()));
						}
						DeployedApplication app = deployed.get(previous.getName());
						String[] resources = app.redeployResources.keySet().toArray(new String[0]);
						// Version is unused - undeploy it completely
						// The -1 is a 'trick' to ensure all redeploy
						// resources are removed
						undeploy(app);
						deleteRedeployResources(app, resources, -1, true);
					}
				}
			}
		}
		previous = current;
	} while (iter.hasNext());
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:52,代码来源:HostConfig.java


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