Esempio n. 1
0
 protected <K, V> void unregisterMap(DefaultAsyncConsistentMap<K, V> map) {
   if (maps.remove(map.name()) != null) {
     clusterCommunicator.removeSubscriber(mapUpdatesSubject(map.name()));
   }
   if (map.applicationId() != null) {
     mapsByApplication.remove(map.applicationId(), map);
   }
 }
Esempio n. 2
0
  protected <K, V> DefaultAsyncConsistentMap<K, V> registerMap(
      DefaultAsyncConsistentMap<K, V> map) {
    DefaultAsyncConsistentMap<K, V> existing = maps.putIfAbsent(map.name(), map);
    if (existing != null) {
      // FIXME: We need to cleanly support different map instances with same name.
      log.info("Map by name {} already exists", map.name());
      return existing;
    } else {
      if (map.applicationId() != null) {
        mapsByApplication.put(map.applicationId(), map);
      }
    }

    clusterCommunicator.<MapEvent<K, V>>addSubscriber(
        mapUpdatesSubject(map.name()),
        map.serializer()::decode,
        map::notifyLocalListeners,
        eventDispatcher);
    return map;
  }