Example #1
0
  public MapMergePolicy getMergePolicy(String mergePolicyName) {
    MapMergePolicy mergePolicy = mergePolicyMap.get(mergePolicyName);
    if (mergePolicy == null && mergePolicyName != null) {
      try {

        // check if user has entered custom class name instead of policy name
        mergePolicy =
            ClassLoaderUtil.newInstance(nodeEngine.getConfigClassLoader(), mergePolicyName);
        mergePolicyMap.put(mergePolicyName, mergePolicy);
      } catch (Exception e) {
        logger.severe(e);
        throw ExceptionUtil.rethrow(e);
      }
    }
    if (mergePolicy == null) {
      return mergePolicyMap.get(MapConfig.DEFAULT_MAP_MERGE_POLICY);
    }
    return mergePolicy;
  }