@Override
 public void destroy() {
   if (nearCache != null) {
     removeInvalidationListener();
     nearCacheManager.destroyNearCache(nearCache.getName());
   }
   if (statisticsEnabled) {
     statistics.clear();
   }
   super.destroy();
 }
  protected void doListNearCaches() {
    NearCacheManager nearCacheManager = createNearCacheManager();

    Set<String> nearCacheNames = new HashSet<String>();

    Collection<NearCache> nearCaches1 = nearCacheManager.listAllNearCaches();
    assertEquals(0, nearCaches1.size());

    for (int i = 0; i < DEFAULT_NEAR_CACHE_COUNT; i++) {
      String nearCacheName = DEFAULT_NEAR_CACHE_NAME + "-" + i;
      createNearCache(nearCacheManager, nearCacheName);
      nearCacheNames.add(nearCacheName);
    }

    Collection<NearCache> nearCaches2 = nearCacheManager.listAllNearCaches();
    assertEquals(DEFAULT_NEAR_CACHE_COUNT, nearCaches2.size());

    for (NearCache nearCache : nearCaches2) {
      assertTrue(nearCacheNames.contains(nearCache.getName()));
    }
  }