Hazelcast won't give you all the keys in a particular partition but
you can find out yourself easily.
Here is the code for your question:
PartitionService partitionService = Hazelcast.getPartitionService();
partitionService.addMigrationListener(new MigrationListener () {
public void migrationStarted(MigrationEvent migrationEvent) {
}
public void migrationCompleted(MigrationEvent migrationEvent) {
if (migrationEvent.getNewOwner().localMember()) {
// great! I am the new owner
// find the keys I own right now
Set keys = map.localKeySet();
for (Object key : keys) {
// is this key just migrated?
if
(partitionService.getPartition(key).getPartitionId() ==
migrationEvent.getPartitionId()) {
// super.. this key just
migrated to me!!
}
}
}
}
});
Make sure you read this section:
http://www.hazelcast.com/documentation.jsp#InternalsDistributedMap
> --
> You received this message because you are subscribed to the Google Groups "Hazelcast" group.
> To post to this group, send email to haze...@googlegroups.com.
> To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
>
>
Yes. Entries with Key1 on each map will fall into the same partition.
This is explained here:
http://www.hazelcast.com/documentation.jsp#KeyBasedDistributedExecution
> Or if I rephrase it: are partitions balanced out based on the count of
> keys or based on data size in bytes?
No.. neither. Hazelcast doesn't care about number of keys or data
size. It cares about how partitions are distributed among members.
Hazelcast contains 271 (default and configurable) virtual partitions.
Hazelcast will try to evenly distribute the partitions. Say you have
10 node cluster then each node will own around 27 partitions.
-talip