Skip to content

Commit 51a5cf6

Browse files
committed
Avoid creating a HashSet on each call to HollowObjectMapper.addObject()
1 parent 63c76b9 commit 51a5cf6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hollow/src/main/java/com/netflix/hollow/core/write/objectmapper/HollowObjectMapper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,18 @@ public void initializeTypeState(Class<?> clazz) {
6666
}
6767

6868
HollowTypeMapper getTypeMapper(Type type, String declaredName, String[] hashKeyFieldPaths) {
69-
return getTypeMapper(type, declaredName, hashKeyFieldPaths, new HashSet<Type>());
69+
return getTypeMapper(type, declaredName, hashKeyFieldPaths, null);
7070
}
71+
7172
HollowTypeMapper getTypeMapper(Type type, String declaredName, String[] hashKeyFieldPaths, Set<Type> visited) {
7273
String typeName = declaredName != null ? declaredName : HollowObjectTypeMapper.getDefaultTypeName(type);
7374

7475
HollowTypeMapper typeMapper = typeMappers.get(typeName);
7576

7677
if(typeMapper == null) {
78+
79+
if(visited == null)
80+
visited = new HashSet<Type>();
7781

7882
if(type instanceof ParameterizedType) {
7983
ParameterizedType parameterizedType = (ParameterizedType)type;

0 commit comments

Comments
 (0)