Skip to content
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

FISH-743 Fetch TypeProxy holder by filtering with type #17

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,20 @@ public TypeProxy<Type> getHolder(String name) {
}

public <T extends Type> TypeProxy<Type> getHolder(String name, Class<T> type) {
if (name.equals("java.lang.Object")) return null;
if (name.equals("java.lang.Object")) {
return null;
}
ConcurrentMap<String, TypeProxy<Type>> typeStorage = storage.get(type);
if (typeStorage==null) {
if (typeStorage == null) {
typeStorage = new ConcurrentHashMap<String, TypeProxy<Type>>();
ConcurrentMap<String, TypeProxy<Type>> old = storage.putIfAbsent(type, typeStorage);
if (old!=null) {
if (old != null) {
// some other thread got to set that type storage before us, let's use it
typeStorage=old;
typeStorage = old;
}
}
TypeProxy<Type> typeProxy = typeStorage.get(name);
if (typeProxy ==null) {
// we look first in our storage pools.
for (Map<String, TypeProxy<Type>> map : storage.values()) {
TypeProxy<Type> proxy = map.get(name);
if (proxy != null) {
return proxy;
}
}
if (typeProxy == null) {
// in our unknown type pool ?
TypeProxy<Type> tmp = unknownTypesStorage.get(name);
// in our unknown type pool ?
Expand Down