I was able to run it and reproduce the problem.
If you add "Console.WriteLine("Cache size: " + cache.GetSize());" to the
end of C# program,
you'll see that there are two entries in the cache, because keys from Java
and C# are not considered equal.

To fix the problem, override GetHashCode/Equals in C# in the same manner as
in Java:

public override bool Equals(object obj)
{
    if (ReferenceEquals(null, obj)) return false;
    if (ReferenceEquals(this, obj)) return true;
    if (obj.GetType() != this.GetType()) return false;
    return Id == ((MyClassKey) obj).Id;
}
 public override int GetHashCode()
{
    return (int)(Id ^ (Id >> 32));
}


This way I get expected result in Java log:
CacheListener - UPDATED , object0 written from .NET


On Tue, Mar 21, 2017 at 7:55 AM, kfeerick <
kevin.feer...@ninemilefinancial.com> wrote:

> Here you go - hopefully you can spin this up in your favoured Java / C# IDE
> pretty easily.
>
> cache-duplicate-reproducer.zip
> <http://apache-ignite-users.70518.x6.nabble.com/file/
> n11332/cache-duplicate-reproducer.zip>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/cache-update-from-NET-client-to-
> Java-cluster-tp11217p11332.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to