Summary: | add host alias using jmx doesn't take affect until restart | ||
---|---|---|---|
Product: | Tomcat 5 | Reporter: | Ted Leung <tedmanleung> |
Component: | Catalina | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | andrew |
Priority: | P2 | ||
Version: | 5.5.27 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Bug Depends on: | |||
Bug Blocks: | 44856 |
Description
Ted Leung
2007-06-20 14:46:49 UTC
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?"); } } } *** Bug 44856 has been marked as a duplicate of this bug. *** Note to self - need to port this to 5.5.x when fixed. I have added a fix for this to trunk. There are a couple of ways if implementing this so I'll leave it a little while to let people comment before proposing it for 6.0.x. No-one commented so I have proposed the fix for 6.0.x This has been fixed in 6.0.x and will be included in 6.0.19 onwards. I've proposed backporting the fix to 5.5.x The patch has been applied to 5.5.x and will be included in 5.5.28 onwards. |