Summary: | Use switch(enum) in implementations of ActionHook.action(ActionCode, ...) | ||
---|---|---|---|
Product: | Tomcat 8 | Reporter: | Konstantin Kolinko <knst.kolinko> |
Component: | Connectors | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 8.0.8 | ||
Target Milestone: | ---- | ||
Hardware: | All | ||
OS: | All |
Description
Konstantin Kolinko
2014-06-01 23:59:27 UTC
Done for Tomcat 8 (r1599385 r1599393 r1599395), will be in 8.0.9. I plan to backport this change to Tomcat 7, as I think switch() behaves better for performance. One possible error spotted thanks to IDE warning: DISPATCH_EXECUTE action code is not processed by AbstractAjpProcessor. I placed a FIXME comment there. The fix is likely to copy the code from AbstractHttp11Processor.action(): case DISPATCH_EXECUTE: { getEndpoint().executeNonBlockingDispatches(socketWrapper); break; } Done for Tomcat 7 (r1599505 r1599711) and will be in 7.0.55. I am ready to close this issue, but DISPATCH_EXECUTE + AJP question for Tomcat 8 from Comment 1 is pending. (In reply to Konstantin Kolinko from comment #1) Implemented DISPATCH_EXECUTE action code for AJP connectors in Tomcat 8 by r1599752, will be in 8.0.9. (In reply to Konstantin Kolinko from comment #1) > I plan to backport this change to Tomcat 7, as I think switch() behaves > better for performance. +1 A tableswitch will be faster than a series of comparisons and jumps. If the set of cases is sufficiently sparse, it will degrade to a lookupswitch which is no slower than the old if/elseif implementation and may be a bit faster as lookupswitch is likely to be a highly-optimized JVM operation not requiring any JIT trickery. |