|HashPartitioningPolicy fails for large IDs of type long [message #916123]
||Tue, 18 September 2012 11:19
| Alexander Bätz
Registered: August 2012
I'm toying with eclipse link partitioning for my current project. we have an id generator that is base on the twitter id schema (first x bits = timestamp (seconds), 10 bits machine id, rest counter per second)|
this means our ids are pretty large by default. the hashpartitioningpolicy uses the following line to find the target server:
int index = value.hashCode() % this.connectionPools.size();
in java % is the remainder function that can be negative IF value.hashCode() returns a negative value (its not a real modulo). since our Long ids are large the resulting hash code can indeed become negative, which causes a negative index, which causes an ArrayIndexOutOfBoundsException.
I'm going to work around this by implementing my own custom policy but this really should be fixed.
Powered by FUDForum
. Page generated in 0.01730 seconds