ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Myron Chelyada <myron.chely...@gmail.com>
Subject EvictableEntry
Date Tue, 16 Feb 2016 20:35:15 GMT
Hello team,

In my eviction policy I am trying to check if two EvictableEntry(ies) are
equals.
I expected that such entries are being using on entry's key. After quick
look into the code(i.e. CacheEvictableEntryImpl class) I saw that it is
intended to be so.
But after some testing I observed that it doesn't work as I expected, and
after deeper look I saw that there seems to be a bug, i.e:

instead of line in bold below:

 @Override public boolean equals(Object obj) {

        if (obj == this)

            return true;

        if (obj instanceof CacheEvictableEntryImpl) {

            CacheEvictableEntryImpl<K, V> other =
(CacheEvictableEntryImpl<K, V>)obj;

            *return cached.key().equals(other.getKey());*

        }

        return false;

    }
there has to be either:


*return cached.key().equals(other.cached.key());*
or

*return this.getKey().equals(other.getKey());*

Am I correct? Is it perhaps already known and fixed?
And btw, since there is nothing explicitly stated in java doc about
"equals" method implementation/overriding can I in fact rely that such
entries are being compared using entry's key?

Thanks,

Mime
View raw message