This speeds up hashing, as weak keys are forcing identity-based
hashCode/equals().
Change-Id: If6b0323ac8e80fc8833a13ff5b4406e908e7f558
Signed-off-by: Robert Varga <rovarga@cisco.com>
}
});
+ // Weak keys to force identity lookup
// Soft values to keep unreferenced codecs around for a bit, but eventually we want them to go away
- private final LoadingCache<TypedSchemaNode, JSONCodec<?>> codecs = CacheBuilder.newBuilder().softValues()
+ private final LoadingCache<TypedSchemaNode, JSONCodec<?>> codecs = CacheBuilder.newBuilder().weakKeys().softValues()
.build(new CacheLoader<TypedSchemaNode, JSONCodec<?>>() {
@Override
public JSONCodec<?> load(@Nonnull final TypedSchemaNode key) {