當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。