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; }
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; }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }