/** * gets local data of colocated regions on a particular data store * * @param partitionedRegion * @return map of region name to local colocated regions * @since 5.8Beta */ public static Map<String, Region> getAllColocatedLocalDataSets( PartitionedRegion partitionedRegion, InternalRegionFunctionContext context) { Map<String, PartitionedRegion> colocatedRegions = getAllColocationRegions(partitionedRegion); Map<String, Region> colocatedLocalRegions = new HashMap<String, Region>(); for (Iterator itr = colocatedRegions.entrySet().iterator(); itr.hasNext();) { Map.Entry me = (Entry)itr.next(); final Region pr = (Region) me.getValue(); colocatedLocalRegions.put((String)me.getKey(), context.getLocalDataSet(pr)); } return colocatedLocalRegions; }
/** * gets local data of colocated regions on a particular data store * * @param partitionedRegion * @return map of region name to local colocated regions * @since 5.8Beta */ public static Map<String, Region> getAllColocatedLocalDataSets( PartitionedRegion partitionedRegion, InternalRegionFunctionContext context) { Map<String, PartitionedRegion> colocatedRegions = getAllColocationRegions(partitionedRegion); Map<String, Region> colocatedLocalRegions = new HashMap<String, Region>(); for (Iterator itr = colocatedRegions.entrySet().iterator(); itr.hasNext();) { Map.Entry me = (Entry)itr.next(); final Region pr = (Region) me.getValue(); colocatedLocalRegions.put((String)me.getKey(), context.getLocalDataSet(pr)); } return colocatedLocalRegions; }
/** * Given a RegionFunctionContext * {@linkplain RegionFunctionContext#getDataSet() for a partitioned Region}, * return a Region providing read access limited to the function context.<br> * Returned Region provides only one copy of the data although * {@link PartitionAttributes#getRedundantCopies() redundantCopies} configured * is more than 0. If the invoking Function is configured to have * {@link Function#optimizeForWrite() optimizeForWrite} as true,the returned * Region will only contain primary copy of the data. * <p> * Writes using this Region have no constraints and behave the same as a * partitioned Region. * * @param c * a functions context * @throws IllegalStateException * if {@link RegionFunctionContext#getDataSet()} returns something * other than a {@linkplain DataPolicy#PARTITION partitioned Region} * @return a Region for efficient reads * @since 6.0 */ public static <K, V> Region<K, V> getLocalDataForContext(final RegionFunctionContext c) { final Region r = c.getDataSet(); isPartitionedCheck(r); InternalRegionFunctionContext rfci = (InternalRegionFunctionContext)c; return rfci.getLocalDataSet(r); }
/** * Given a RegionFunctionContext * {@linkplain RegionFunctionContext#getDataSet() for a partitioned Region}, * return a Region providing read access limited to the function context.<br> * Returned Region provides only one copy of the data although * {@link PartitionAttributes#getRedundantCopies() redundantCopies} configured * is more than 0. If the invoking Function is configured to have * {@link Function#optimizeForWrite() optimizeForWrite} as true,the returned * Region will only contain primary copy of the data. * <p> * Writes using this Region have no constraints and behave the same as a * partitioned Region. * * @param c * a functions context * @throws IllegalStateException * if {@link RegionFunctionContext#getDataSet()} returns something * other than a {@linkplain DataPolicy#PARTITION partitioned Region} * @return a Region for efficient reads * @since 6.0 */ public static <K, V> Region<K, V> getLocalDataForContext(final RegionFunctionContext c) { final Region r = c.getDataSet(); isPartitionedCheck(r); InternalRegionFunctionContext rfci = (InternalRegionFunctionContext)c; return rfci.getLocalDataSet(r); }