Alexey posted a proposed patch here:
https://github.com/aloubyansky/jboss-as/commit/fa92ebafc41905674d6143d461257d49ee40c965
I had something similar in mind, but thought a single cleanup method on the chain that would use attachment state would be sufficient. Any thoughts on this?