I updated ProxyManager to use a slightly different paradigm.
It uses a static property to maintain the registered Proxies instead of a per instance property. That shouldn't make any difference since ProxyManager is a singleton anyway. This also has the effect on ensuring only one construction.
Then, since there wasn't much reason to operate directly on the instance, I made the methods static, which further hides the singleton, that really didn't improve thread safety, but it's nice.
Finally, I made the ID property an atomic to avoid multiple threads trying to update it. This might have some performance impact, but I don't think registering new proxies at a high rate of speed is required.
I updated ProxyManager to use a slightly different paradigm.
It uses a static property to maintain the registered Proxies instead of a per instance property. That shouldn't make any difference since ProxyManager is a singleton anyway. This also has the effect on ensuring only one construction.
Then, since there wasn't much reason to operate directly on the instance, I made the methods static, which further hides the singleton, that really didn't improve thread safety, but it's nice.
Finally, I made the ID property an atomic to avoid multiple threads trying to update it. This might have some performance impact, but I don't think registering new proxies at a high rate of speed is required.