You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/04/22 22:03:43 UTC

DO NOT REPLY [Bug 42707] add host alias using jmx doesn' t take affect until restart

https://issues.apache.org/bugzilla/show_bug.cgi?id=42707


Andrew Mottaz <an...@site9.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew@site9.net




--- Comment #1 from Andrew Mottaz <an...@site9.net>  2008-04-22 13:03:42 PST ---
The support for this in Mapper.java is easy to add: (Note -- this is based on
code posted by Luke Kirby, inelegantly re-written)

    public synchronized void addHost(String name, String[] aliases,
                                     Object host) {
        Host[] newHosts = new Host[hosts.length + 1];
        Host newHost = new Host();
        ContextList contextList = new ContextList();
        newHost.name = name;
        newHost.contextList = contextList;
        newHost.object = host;
        if (insertMap(hosts, newHosts, newHost)) {
            hosts = newHosts;

        for (int i = 0; i < aliases.length; i++) {
            newHosts = new Host[hosts.length + 1];
            newHost = new Host();
            newHost.name = aliases[i];
            newHost.contextList = contextList;
            newHost.object = host;
            if (insertMap(hosts, newHosts, newHost)) {
                hosts = newHosts;
            }
        }
        }
        else {
                Host aliasedHost;
                // insert failed because the host already exists; grab it
                int hostPos = find(hosts, name);
                if (hostPos >= 0) {
                aliasedHost = hosts[hostPos];
                for (int i = 0; i < aliases.length; i++) {
                    newHosts = new Host[hosts.length + 1];
                    newHost = new Host();
                    newHost.name = aliases[i];
                    newHost.contextList = aliasedHost.contextList;
                    newHost.object = aliasedHost.object;
                    if (insertMap(hosts, newHosts, newHost)) {
                        hosts = newHosts;
                    }
                }
                } else {

                        System.out.println("huh?");
                }

        }
    }


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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