httpendpoint: Do not deadlock if element is released from its own thread

Change-Id: Iad7e1c2ca7d6223432501b6884dc94cd6d49b05a