LPS-50484 PortalImpl.getUniqueElementId() may end up in endless loop, because it isn't thread safe

Hey Julio,

I've just stumbled upon this issue. From the history, it seems that this is a regression caused LPS-27172.

Thanks for reviewing!

Cheers,
László