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

Ask Your Question
0

Find partition from Partition id

How can I figure out Partition from Partition id?

Consider the Object below:

class A{
    ....
    ....
    ...
    @SpaceId
    String getId(){
         .....
    }
    @SpaceRouting
    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 -0600

akacoder007 gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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 -0600

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

Stats

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

Seen: 96 times

Last updated: Feb 19