Created
September 12, 2021 01:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void execute(FunctionContext<Object[]> context) { | |
// Get the region name | |
Object[] arguments = context.getArguments(); | |
String regionName = (String) arguments[0]; | |
context.getCache().getLogger().info("GetBucketIdsFunction getting bucket ids for regionName=" + regionName); | |
// Get the region | |
PartitionedRegion region = (PartitionedRegion) context.getCache().getRegion(regionName); | |
// Create the data structure | |
String redundancyZone = ((InternalDistributedSystem) context.getCache().getDistributedSystem()).getConfig().getRedundancyZone(); | |
int configuredNumberOfBuckets = region.getTotalNumberOfBuckets(); | |
List<Integer> allBucketIds = new ArrayList<>(region.getDataStore().getAllLocalBucketIds()); | |
List<Integer> primaryBucketIds = new ArrayList<>(region.getDataStore().getAllLocalPrimaryBucketIds()); | |
ServerBucketIds ids = new ServerBucketIds(regionName, redundancyZone, configuredNumberOfBuckets, allBucketIds, primaryBucketIds); | |
// Return result | |
context.getResultSender().lastResult(ids); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment