tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keiichi Fujino <kfuj...@apache.org>
Subject Re: svn commit: r1382367 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/ java/org/apache/catalina/core/ java/org/apache/catalina/startup/ webapps/docs/ webapps/docs/config/
Date Mon, 10 Sep 2012 06:32:30 GMT
>
>      /**
> +     * Check for old versions of applications using parallel deployment that are
> +     * now unused (have no active sessions) and undeploy any that are found.
> +     */
> +    public 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());
> +        do {
> +            ContextName current = new ContextName(iter.next());
> +
> +            if (current.getPath().equals(previous.getPath())) {
> +                // Current and previous are same version - current will always
> +                // be a later version
> +                Context context = (Context) host.findChild(previous.getName());
> +                if (context != null) {
> +                    Manager manager = context.getManager();
> +                    if (manager != null && manager.getActiveSessions() == 0)
{

manager.getActiveSessions() returns the various numbers of sessions
according to the kind of Manager.

1.
In BackupManager, manager.getActiveSessions() returns the number of a
primary and backup sessions.
A proxy session is not contained.
Thus manager only with a proxy session will be deleted.
(e.g. manager which newly joined in the cluster has only a proxy session.)
It is necessary to call DistributedManager#getActiveSessionsFull()
instead of manager.getActiveSessions().

2.
In PersistentManage, it may be necessary to take into consideration
also about the session saved in Store.
It should be deleted only when both manager.getActiveSessions() and
Store#getSize are 0.

Although it is possible to add these two cases,
It seems that it is better to define method which checks number of
sessions in a Manager/ManagerBase.


-- 
Keiichi.Fujino

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message