All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Common.Extensibility.Client.RPC.Impl.BroadcastingMethodArgumentPartitioner Maven / Gradle / Ivy

package Alachisoft.NCache.Common.Extensibility.Client.RPC.Impl;

import Alachisoft.NCache.Common.Extensibility.Client.RPC.IMethodArgumentPartitioner;
import Alachisoft.NCache.Common.Extensibility.Client.RPC.Partition;
import Alachisoft.NCache.Common.Extensibility.Client.RPC.PartitioningStrategy;

import java.util.HashMap;
import java.util.Map;

public class BroadcastingMethodArgumentPartitioner implements IMethodArgumentPartitioner {
    private static BroadcastingMethodArgumentPartitioner _instance;

    public static BroadcastingMethodArgumentPartitioner getInstance() {
        if (_instance == null) {
            _instance = new BroadcastingMethodArgumentPartitioner();
        }
        return _instance;
    }

    public final Iterable> PartitionArguments(Object[] arguments, PartitioningStrategy strategy) {
        Iterable allPartitions = strategy.GetAllPartitions();
        HashMap argumentPartitions = new HashMap<>();
        for (Partition partition : allPartitions) {
            argumentPartitions.put(partition, arguments);
        }
        return argumentPartitions.entrySet();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy