InfinispanPropertyCache implements PropertyService, ServiceLifecycle { @Override public void removeObserver(String tenantId, String id, Observer observer) { List<Observer> observers = eventListener.observersMap.get(id); if (observers != null) { observers.remove(observer); if (observers.isEmpty()) { eventListener.observersMap.remove(id); } } } InfinispanPropertyCache();  InfinispanPropertyCache(CacheContainer cacheContainer); @Override @PostConstruct void init(); @Override Property get(String tenantId, String id); @Override void store(String tenantId, List<Property<?>> properties); @Override void store(String tenantId, Property<?> property); @Override void remove(String tenantId, String id); @Override void addObserver(String tenantId, String id, Observer observer); @Override void removeObserver(String tenantId, String id, Observer observer);  }
@Test public void testRemoveObserver() throws CacheException { CountingObserver observer = new CountingObserver(); propertyCache.store(null, new Property<>("id1", 2)); propertyCache.addObserver(null, "id1", observer); propertyCache.store(null, new Property<>("id1", 34)); Assert.assertEquals(1, observer.updatedCounter.intValue()); propertyCache.removeObserver(null, "id1", observer); propertyCache.store(null, new Property<>("id1", 32)); Assert.assertEquals(1, observer.updatedCounter.intValue()); }