@Override public void setUp() { // make it a loner this.cache = (GemFireCacheImpl) new CacheFactory() .set("mcast-port", "0") .setPdxReadSerialized(true) .create(); }
private Cache startWithGemFireApi(final Properties gemfireProperties ) { final CacheConfig cacheConfig = getCacheConfig(); final CacheFactory cacheFactory = new CacheFactory(gemfireProperties); if (cacheConfig.pdxPersistentUserSet) { cacheFactory.setPdxPersistent(cacheConfig.isPdxPersistent()); } if (cacheConfig.pdxDiskStoreUserSet) { cacheFactory.setPdxDiskStore(cacheConfig.getPdxDiskStore()); } if (cacheConfig.pdxIgnoreUnreadFieldsUserSet) { cacheFactory.setPdxIgnoreUnreadFields(cacheConfig.getPdxIgnoreUnreadFields()); } if (cacheConfig.pdxReadSerializedUserSet) { cacheFactory.setPdxReadSerialized(cacheConfig.isPdxReadSerialized()); } if (cacheConfig.pdxSerializerUserSet) { cacheFactory.setPdxSerializer(cacheConfig.getPdxSerializer()); } return cacheFactory.create(); }
public static Cache getCacheIfExists() { Cache cache; try { cache = CacheFactory.getAnyInstance(); } catch (CacheClosedException e) { //ignore & return null cache = null; } return cache; }
protected GemFireCacheImpl createCache() { return (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0").set("log-level", "info") .create(); } }
CacheFactory cf = new CacheFactory(); cf.set("cache-xml-file", "server-cache1.xml"); cf.set("mcast-port", "0"); cf.set("start-locator", "12345"); cf.set("locators","localhost[12345],localhost[6789]");
public void createCache(Properties prop) { if (null != prop && !prop.isEmpty()) { cache = new CacheFactory(prop).create(); } else{ cache = new CacheFactory().create(); } }
public Object call() throws Exception { //Make sure the type registry is persistent CacheFactory cf = new CacheFactory(); cf.setPdxPersistent(true); cf.setPdxDiskStore("store1"); Cache cache = getCache(cf); cache.createDiskStoreFactory() .setMaxOplogSize(1) .setDiskDirs(getDiskDirs()) .create("store1"); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); af.setDiskStoreName("store1"); createRootRegion("testSimplePdx", af.create()); return null; } };
public void run2() throws CacheException { if (CachedDeserializableFactory.preferObject()) { getCache(new CacheFactory().setPdxReadSerialized(true)); } configAndStartBridgeServer(true, false); } });
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer()); getCache(cf); return null; } };
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()) .setPdxPersistent(true); Cache cache = getCache(cf); RegionGenerator rgen = new RegionGenerator(); rgen.createRegion(cache, null, RegionType.REPLICATE, "snapshot-ops"); return null; } };
public Object call() throws Exception { Properties props = new Properties(); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, dsId); props.setProperty(DistributionConfig.LOCATORS_NAME, ""); getSystem(props); CacheFactory cf = new CacheFactory(); cf.setPdxPersistent(true); getCache(cf); return null; } };
/** * Creates the cache instance for the test * * @return the cache instance * @throws CacheException - * thrown if any exception occurs in cache creation */ private Cache createCache() throws CacheException { return CacheFactory.create(DistributedSystem.connect(new Properties())); }
@Override protected Cache createCache(InternalDistributedSystem system, Map<String, Object> options) { // Cache is already created for GemFireXD Cache cache = CacheFactory.getInstance(system); return cache; }
@Override protected Cache createCache() { CacheFactory cf = new CacheFactory().set("mcast-port", "0") .set("log-level", "info") .set("enable-time-statistics", "true") // .set("statistic-archive-file", "statArchive.gfs") ; cache = cf.create(); return cache; } }
protected Cache createCache() { cache = new CacheFactory(props).create(); ds = cache.getDistributedSystem(); return cache; }
public Object call() throws Exception { CacheFactory cf = new CacheFactory(); if(persistentPdxRegistry) { cf.setPdxPersistent(true) .setPdxDiskStore("store"); } // Cache cache = getCache(cf); cache.createDiskStoreFactory() .setDiskDirs(getDiskDirs()) .create("store"); AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); af.setDiskStoreName("store"); createRootRegion("testSimplePdx", af.create()); CacheServer server = getCache().addCacheServer(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); server.setPort(port); server.start(); return port; } };
public void run2() throws CacheException { if (CachedDeserializableFactory.preferObject()) { getCache(new CacheFactory().setPdxReadSerialized(true)); } configAndStartBridgeServer(true, false); } });
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()); Cache cache = getCache(cf); RegionGenerator rgen = new RegionGenerator(); rgen.createRegion(cache, null, RegionType.PARTITION, "test"); return null; } };
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory() .setPdxSerializer(new MyPdxSerializer()) .setPdxPersistent(true); Cache cache = getCache(cf); DiskStore ds = cache.createDiskStoreFactory() .setMaxOplogSize(1) .setDiskDirs(getDiskDirs()) .create("snapshotTest"); RegionGenerator rgen = new RegionGenerator(); for (final RegionType rt : RegionType.values()) { for (final SerializationType st : SerializationType.values()) { rgen.createRegion(cache, ds.getName(), rt, "test-" + rt.name() + "-" + st.name()); } } return null; } };
@Override public Object call() throws Exception { CacheFactory cf = new CacheFactory(); cf.set("mcast-port", "45934"); cf.set("conserve-sockets", "false"); getCache(cf).<Integer, Integer> createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT) .create(name); AbstractUpdateOperation.test_InvalidVersion = true; return null; } };