Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Find partition from Partition id

How can I figure out Partition from Partition id?

Consider the Object below:

class A{
    String getId(){
    Integer getRouting(){
         return routingId;

If the value of routingId in class a is x. What is the formula to get the partition?

Is it routingId.hashCode() % (number_of_partitions +1) + 1?

Is there some method in gigaspace to get it?

asked 2018-02-18 20:03:52 -0500

akacoder007 gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

Hi, Related code is: safeAbs(routingValue.hashCode()) % numOfPartitions; where safeAbs is: public static int safeAbs(int value) { return value == Integer.MIN_VALUE ? Integer.MAX_VALUE : Math.abs(value); }

Regards, Ester.

answered 2018-02-19 01:34:41 -0500

Ester gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-02-18 20:03:52 -0500

Seen: 168 times

Last updated: Feb 19 '18