Esempio n. 1
0
  private boolean hasValue(
      final PersistentHashMap<String, ?> map, Map<String, Boolean> cache, final String value) {
    Boolean res = cache.get(value);
    if (res == null) {
      res =
          doIndexTask(
                  new IndexTask<Boolean>() {
                    public Boolean doTask() throws Exception {
                      return map.tryEnumerate(value) != 0;
                    }
                  },
                  false)
              .booleanValue();

      cache.put(value, res);
    }

    return res;
  }
Esempio n. 2
0
 private static <T> void persist(Map<String, T> map, PersistentHashMap<String, T> persistentMap)
     throws IOException {
   for (Map.Entry<String, T> each : map.entrySet()) {
     persistentMap.put(each.getKey(), each.getValue());
   }
 }