Optimize WFLY-3136 fix.

https://issues.jboss.org/browse/WFLY-3136