Use the provided atomic method to replace the attachment and return a reference to the old value rather than doing the same thing in a thread unsafe manner.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1646303 13f79535-47bb-0310-9956-ffa450edef68