class Bucket4jComputeTask <K> extends ComputeTaskAdapter<Bucket4jComputeTaskParams<K>, byte[]> {

    public static final String JOB_NAME = Bucket4jComputeTask.class.getName();

    @IgniteInstanceResource
    private Ignite ignite;

    @Override
    public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Bucket4jComputeTaskParams<K> params) throws IgniteException {<FILL_FUNCTION_BODY>}

    @Override
    public byte[] reduce(List<ComputeJobResult> results) throws IgniteException {
        return results.get(0).getData();
    }

}

        Bucket4jComputeJob<K> job = new Bucket4jComputeJob<>(params);

        ClusterNode primaryNodeForKey = ignite.affinity(params.getCacheName()).mapKeyToNode(params.getKey());
        for (ClusterNode clusterNode : subgrid) {
            if (clusterNode == primaryNodeForKey) {
                return Collections.singletonMap(job, clusterNode);
            }
        }

        // should never come here, but if it happen let's execute Job on random node
        int randomNode = ThreadLocalRandom.current().nextInt(subgrid.size());
        return Collections.singletonMap(job, subgrid.get(randomNode));
    
<no_super_class>