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


Java DistributedManager类代码示例

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


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

示例1: getSessionsForName

import org.apache.catalina.DistributedManager; //导入依赖的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

示例2: getSessionsForName

import org.apache.catalina.DistributedManager; //导入依赖的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

示例3: checkUndeploy

import org.apache.catalina.DistributedManager; //导入依赖的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

示例4: checkUndeploy

import org.apache.catalina.DistributedManager; //导入依赖的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

示例5: checkUndeploy

import org.apache.catalina.DistributedManager; //导入依赖的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(previous.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:deathspeeder,项目名称:class-guard,代码行数:62,代码来源:HostConfig.java

示例6: checkUndeploy

import org.apache.catalina.DistributedManager; //导入依赖的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:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:62,代码来源:HostConfig.java


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