private void createCache(Properties props) throws Exception { DistributedSystem ds = getSystem(props); assertNotNull(ds); ds.disconnect(); ds = getSystem(props); cache = CacheFactory.create(ds); assertNotNull(cache); }
private void createClientCache(Properties props, ClientCacheFactory ccf) throws Exception { DistributedSystem ds = getSystem(props); assertNotNull(ds); ds.disconnect(); ClientCache cc = ccf.create(); setSystem(props, cc.getDistributedSystem()); cache = (Cache) cc; assertNotNull(cache); }
/** * create cache * * @return * @throws Exception */ private Cache createCache() throws Exception { Properties props = new Properties(); DistributedSystem ds = getSystem(props); ds.disconnect(); ds = getSystem(props); Cache cache = null; cache = CacheFactory.create(ds); if (cache == null) { throw new Exception("CacheFactory.create() returned null "); } return cache; }
public static void closeCache() { try { if (cache != null && !cache.isClosed()) { cache.close(); } } catch (Exception e) { e.printStackTrace(); } try { if (ds != null) ds.disconnect(); } catch (Exception e) { getLogWriter().fine("Error in disconnecting from Distributed System"); } }