本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}