Skip to content

Commit

Permalink
Removed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DavyLandman committed Oct 16, 2023
1 parent 65115ed commit cdd2feb
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,20 @@ public boolean equals(@Nullable Object obj) {
*/
private final HotEntry<T>[] hotEntries;
private final int mask;
private final int expireAfter;

/**
* All entries are also stored in a WeakReference, this helps with clearing memory
* if entries are not referenced anymore
*/
private final ReferenceQueue<T> queue = new ReferenceQueue<T>();
private final ReferenceQueue<T> queue = new ReferenceQueue<>();
private final Map<Object, WeakReferenceWrap<T>> coldEntries;


public WeakReferenceHashConsingMap() {
this(16, (int)TimeUnit.MINUTES.toSeconds(30));
}

@SuppressWarnings({"unchecked"})
public WeakReferenceHashConsingMap(int size, int demoteAfterSeconds) {
if (size <= 0) {
throw new IllegalArgumentException("Size should be a positive number");
Expand All @@ -143,7 +143,6 @@ public WeakReferenceHashConsingMap(int size, int demoteAfterSeconds) {
size = Integer.highestOneBit(size - 1) << 1;
hotEntries = new HotEntry[size];
this.mask = size - 1;
this.expireAfter = demoteAfterSeconds;

coldEntries = new ConcurrentHashMap<>(size);

Expand Down Expand Up @@ -179,7 +178,7 @@ public WeakReferenceHashConsingMap(int size, int demoteAfterSeconds) {
}

private static int improve(int hash) {
// base on XXH32_avalanche from xxHash (BSD2 license, Yann Collet)
// based on XXH32_avalanche from xxHash (BSD2 license, Yann Collet)
hash ^= hash >>> 15;
hash *= 0x85EBCA77;
hash ^= hash >>> 13;
Expand Down

2 comments on commit cdd2feb

@jurgenvinju
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange; i did this before..

@jurgenvinju
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh right. On the pr

Please sign in to comment.