コード例 #1
0
 private void createCache(Properties props) throws Exception {
   DistributedSystem ds = getSystem(props);
   assertNotNull(ds);
   ds.disconnect();
   ds = getSystem(props);
   cache = CacheFactory.create(ds);
   assertNotNull(cache);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 /**
  * 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;
 }
コード例 #4
0
 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");
   }
 }