CacheFactory.getAnyInstance can be used to get an existing and open cache instance. If one hasn't been created or has been closed, the method throws a CacheClosedException. This method is typically used to get access to the cache or distributed system instance (Cache.getAnyInstance().getDistributedSystem()), and detect its existence in the process. And, by the way, if the cache is closed, then the distributed system is closed as well, and vice versa.
↧