This method looks a bit weird:

1) There can be race conditions here if the WSRefRegistry is supposed to be global. Is it a per deployment registry or a global registry.
2) The other weird part is this "getter" updating/adding a new attachment to the deployment unit. IMO, the unit.putAttachment should happen in the appropriate deployment unit processor which knows whether or not it wants the DU attachment to be added.