-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AbstractRegistryFactory have a piece of redundant code #2685
Comments
Hi, would u pls send a pr to fix this? |
// Lock the registry access process to ensure a single instance of the registry |
Yes, but seems like the REGISTRIES field could change to hashmap. |
|
I know. |
so,do the issue need to be modified to hashmap? |
Hi, @jingui123 |
ok, i will try it |
Thx for your issue. |
I have found a piece of redundant code, may be is I do not understand.
in AbstractRegistryFactory class, there are two variables,one is LOCK,the other is REGISTRIES,as follows :
private static final ReentrantLock LOCK = new ReentrantLock();
but when we use REGISTRIES.put() , the section of code is locked. so I think REGISTRIES will be better to modify HashMap.
example:
public Registry getRegistry(URL url) {
....
LOCK.lock();
REGISTRIES.put(key, registry);
LOCK.unlock();
}
public static void destroyAll() {
....
LOCK.lock();
REGISTRIES.clear();
LOCK.unlock();
}
Environment
The text was updated successfully, but these errors were encountered: