public String getDefaultPoolName() { String result = null; Map<String, Pool> pools = getPools(); if (pools.size() == 1) { Pool pool = pools.values().iterator().next(); result = pool.getName(); } else if (pools.isEmpty()) { result = "DEFAULT"; } return result; }
/** * This is called by {@link Pool#destroy(boolean)} * * @return true if pool unregistered from cache; false if someone else already did it */ public boolean unregister(Pool pool) { synchronized (this.poolLock) { Map<String, Pool> copy = new HashMap<String, Pool>(pools); String name = pool.getName(); // debugStack("unregister pool=" + name); Object rmPool = copy.remove(name); if (rmPool == null || rmPool != pool) { return false; } else { this.pools = Collections.unmodifiableMap(copy); this.itrForEmergencyClose = copy.entrySet().iterator(); return true; } } }
/** * This is called by {@link PoolImpl#create} * * @throws IllegalStateException if a pool with same name is already registered. */ public void register(Pool pool) { synchronized (this.poolLock) { Map<String, Pool> copy = new HashMap<String, Pool>(pools); String name = pool.getName(); // debugStack("register pool=" + name); Object old = copy.put(name, pool); if (old != null) { throw new IllegalStateException( String.format("A pool named %s already exists", name)); } // Boolean specialCase=Boolean.getBoolean("gemfire.SPECIAL_DURABLE"); // if(specialCase && copy.size()>1){ // throw new IllegalStateException("Using SPECIAL_DURABLE system property" // + " and more than one pool already exists in client."); // } this.pools = Collections.unmodifiableMap(copy); this.itrForEmergencyClose = copy.entrySet().iterator(); } }
private static RegionService createAuthenticatedCacheView(Pool pool, Properties properties) { if (pool.getMultiuserAuthentication()) { return ((PoolImpl) pool).createAuthenticatedCacheView(properties); } else { throw new IllegalStateException( "The pool " + pool.getName() + " did not have multiuser-authentication set to true"); } }
@SuppressWarnings("deprecation") private RegionAttributes<K, V> createRegionAttributes() { RegionAttributes<K, V> ra = this.attrsFactory.create(); if (isEmpty(ra.getPoolName()) || Objects.equals(GemFireCacheImpl.DEFAULT_POOL_NAME, ra.getPoolName())) { UserSpecifiedRegionAttributes<K, V> ura = (UserSpecifiedRegionAttributes<K, V>) ra; if (ura.requiresPoolName) { Pool dp = getDefaultPool(); if (dp != null) { this.attrsFactory.setPoolName(dp.getName()); ra = this.attrsFactory.create(); } else { throw new IllegalStateException("The poolName must be set on a client."); } } } return ra; } }
atts.addAttribute("", "", NAME, "", cp.getName()); if (this.version.compareTo(CacheXmlVersion.GEODE_1_0) >= 0) { if (generateDefaults() || cp
if (p.getName().equals("DEFAULT")) { m2Size = 0;
initClientDynamicRegionFactory(pool.getName());
/** * Create client regions */ public static void createCacheClients(Pool poolAttr, String regionName1, String regionName2, Properties dsProperties) throws Exception { new CacheServerTestUtil().createCache(dsProperties); // Initialize region1 PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.init(poolAttr); Pool p = pf.create("CacheServerTestUtil1"); AttributesFactory factory1 = new AttributesFactory(); factory1.setScope(Scope.LOCAL); factory1.setPoolName(p.getName()); cache.createRegion(regionName1, factory1.create()); // Initialize region2 p = pf.create("CacheServerTestUtil2"); AttributesFactory factory2 = new AttributesFactory(); factory2.setScope(Scope.LOCAL); factory2.setPoolName(p.getName()); cache.createRegion(regionName2, factory2.create()); }
factory.setPoolName(p.getName());
initClientDynamicRegionFactory(pool.getName());
PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory(); poolFactory.init(cp); poolFactory.create(cp.getName());
PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory(); poolFactory.init(pool); poolFactory.create(pool.getName());
public String getName() { return getDelegate().getName(); }
public String getName() { return getDelegate().getName(); }
@SuppressWarnings("all") private void init(Optional<Pool> existingPool) { if (existingPool.isPresent()) { this.pool = existingPool.get(); this.springManagedPool = false; logDebug(() -> String.format("A Pool with name [%s] already exists; Using existing Pool", this.pool.getName())); logDebug("PoolConfigurers will not be applied"); } else { logDebug("Pool [%s] not found; Lazily creating new Pool...", getName()); applyPoolConfigurers(); } }
@SuppressWarnings("all") private void init(Optional<Pool> existingPool) { if (existingPool.isPresent()) { this.pool = existingPool.get(); this.springManagedPool = false; logDebug(() -> String.format("A Pool with name [%s] already exists; Using existing Pool", this.pool.getName())); logDebug("PoolConfigurers will not be applied"); } else { logDebug("Pool [%s] not found; Lazily creating new Pool...", getName()); applyPoolConfigurers(); } }