Hi There, This one is very strange.
I have a .NET client, Java client and Java server. All running locally on
windows desktop.
On the server side I have some cache entries, SecurityKey,Security
I have two Security objects, one with id=4 and one with id=953
On the Java client, this works no problem
SystemContext.getCache().get(new SecurityKey(4));
SystemContext.getCache().get(new SecurityKey(953));
On the .NET client
(Security)SystemContext.Cache.Get(new SecurityKey() { Id = 4 });
Will succeed
(Security)SystemContext.Cache.Get(new SecurityKey() { Id = 953 });
Will FAIL, with KeyNotFoundException
This is the case 100% of the time, even after full restart of the environment.
The only thing that seems to cause the problem is the literal value of the id
Also note that if I iterate over the cache on the .NET side, I can absolutely
see the SecurityKey with id=953, but I will see KeyNotFound when I try to Get
foreach (var e in SystemContext.Cache)
{
if (e.Key is SecurityKey)
{
Log.Info(((SecurityKey)e.Key).Id); // this will print both
4 and 953
}
}
My only guess here is that something funny is going on internally with the
hashing of the binary object fields. So the equality test is failing when the
get is done from the .NET client??
I have attached the key class as it is on the .NET side and the Java side.
Any thoughts are much appreciated. Thanks!
This email and any attachments are proprietary & confidential and are intended
solely for the use of the individuals to whom it is addressed. Any views or
opinions expressed are solely for those of the author and do not necessarily
reflect those of Nine Mile Financial Pty. Limited. If you have received this
email in error, please let us know immediately by reply email and delete from
your system. Nine Mile Financial Pty. Limited. ABN: 346 1349 0252
namespace Dragon9GUI.SharedDotNetDataModel.Security
{
public class SecurityKey : IKey
{
public long Id { get; set; }
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 == ((SecurityKey)obj).Id;
}
public override int GetHashCode()
{
return (int)(Id ^ (Id >> 32));
}
}
}
SecurityKey.java
Description: SecurityKey.java
