While constructing a SchemaContext is potentially costly, we do not need
to retain them if they are not used for long periods of time. Soft
references attempt to retain the context until the memory pressure is
pretty high, while weak references are cleared as soon as the object is
proven to be weakly reachable.
Change-Id: I2df2a78218d3b439edadda2192ff541e4c1c0fee
Signed-off-by: Robert Varga <rovarga@cisco.com>
return repository.getSchemaSource(input, ASTSchemaSource.class);
}
};
- private final Cache<Collection<SourceIdentifier>, SchemaContext> cache = CacheBuilder.newBuilder().softValues().build();
+ private final Cache<Collection<SourceIdentifier>, SchemaContext> cache = CacheBuilder.newBuilder().weakValues().build();
private final AsyncFunction<List<ASTSchemaSource>, SchemaContext> assembleSources = new AsyncFunction<List<ASTSchemaSource>, SchemaContext>() {
@Override