[ 
https://issues.apache.org/jira/browse/GEODE-5666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Karen Smoler Miller resolved GEODE-5666.
----------------------------------------
    Resolution: Information Provided

> Can't use java enums inside a cache key
> ---------------------------------------
>
>                 Key: GEODE-5666
>                 URL: https://issues.apache.org/jira/browse/GEODE-5666
>             Project: Geode
>          Issue Type: Bug
>          Components: client/server, docs, general, serialization
>            Reporter: Naoufal
>            Assignee: Karen Smoler Miller
>            Priority: Major
>
> *+Use case:+*
> * Partitioned region with one shard
> * I put data which key contains an enum.
> * Sometimes the data is not returned when we ask for that key. Although it's 
> not caught in the client, this exception is raised :
> {code:java}
> PartitionedRegionException( "Object hashCode inconsistent between cache 
> peers. Here ...)
> {code}
> I Believe it's related to the limitation of using raw java enum in the 
> hashcode generation. When a server checks hashcode consistency with its 
> peers, it will fail for those keys, since the enum hashcode is equal to 
> Object.Identity a.k.a: its address in the JVM. For this reason the hascode 
> will differ between two peers.
> You maybe aware of this limitation.
> * If so it should be properly mentioned in the documentation, possibly with 
> example and workaround (like using the enum's ordinal()). I could not find it 
> any such thing.
> * Otherwise, is it something that could be handled better? For example by 
> sending the whole keys instead of hashes?
> Regards,
> Naoufal 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to