private PoolFactory getPoolFactory() { if (this.pf == null) { this.pf = PoolManager.createFactory(); } return this.pf; }
public static Pool configureConnectionPoolWithName(AttributesFactory factory, String host, int[] ports, boolean establish, int redundancy, int connectionsPerServer, String serverGroup, String poolName, int pingInterval, int idleTimeout, boolean threadLocalCnxs, int lifetimeTimeout, int statisticInterval) { return configureConnectionPoolWithNameAndFactory(factory, host, ports, establish, redundancy, connectionsPerServer, serverGroup, poolName, PoolManager.createFactory(), pingInterval, idleTimeout, threadLocalCnxs, lifetimeTimeout, statisticInterval); }
public static Pool configureConnectionPoolWithName(AttributesFactory factory, String host, int[] ports, boolean establish, int redundancy, int connectionsPerServer, String serverGroup, String poolName) { return configureConnectionPoolWithNameAndFactory(factory, host, ports, establish, redundancy, connectionsPerServer, serverGroup, poolName, PoolManager.createFactory(), -1, -1, false, -2, -1); }
private PoolFactory createDefaultPF() { PoolFactory defaultPoolFactory = PoolManager.createFactory(); try { String localHostName = SocketCreator.getHostName(SocketCreator.getLocalHost()); defaultPoolFactory.addServer(localHostName, CacheServer.DEFAULT_PORT); } catch (UnknownHostException ex) { throw new IllegalStateException("Could not determine local host name", ex); } return defaultPoolFactory; }
public static void createPool(PoolAttributes poolAttr) throws Exception { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); DistributedSystem ds = new CacheServerTestUtil().getSystem(props);; PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.init(poolAttr); PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil"); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setPoolName(p.getName()); RegionAttributes attrs = factory.create(); pool = p; }
protected void startBridgeClient(final Pool pool, final String[] regions) throws Exception { Properties props = new Properties(); props.setProperty(MCAST_PORT, String.valueOf(0)); props.setProperty(LOCATORS, ""); DistributedSystem ds = getSystem(props); Cache cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setPoolName(POOL_NAME); PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.init(pool); LocatorDiscoveryCallback locatorCallback = new MyLocatorCallback(); remoteObjects.put(CALLBACK_KEY, locatorCallback); pf.setLocatorDiscoveryCallback(locatorCallback); pf.create(POOL_NAME); RegionAttributes attrs = factory.create(); for (int i = 0; i < regions.length; i++) { cache.createRegion(regions[i], attrs); } remoteObjects.put(CACHE_KEY, cache); }
public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception { new CacheServerTestUtil().createCache(dsProperties); IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException"); if (javaSystemProperties != null && javaSystemProperties.size() > 0) { Enumeration e = javaSystemProperties.propertyNames(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); System.setProperty(key, javaSystemProperties.getProperty(key)); } } PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.init(poolAttr); PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil"); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setPoolName(p.getName()); if (addControlListener.booleanValue()) { factory.addCacheListener(new ControlListener()); } RegionAttributes attrs = factory.create(); cache.createRegion(regionName, attrs); pool = p; }
PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.setPRSingleHopEnabled(false); if (this.locatorDiscoveryCallback != null) {
tmpInstance.openCache(); PoolFactory poolFactory = PoolManager.createFactory(); poolFactory.setRetryAttempts(200); poolFactory.setMultiuserAuthentication(multiUserAuthMode);
PoolImpl p; try { PoolFactory poolFactory = PoolManager.createFactory(); addServers(poolFactory, h, ports).setSubscriptionEnabled(true).setThreadLocalConnections(true) .setReadTimeout(5000).setSocketBufferSize(32768).setMinConnections(3)
void createClientCacheAndVerifyPingIntervalIsSet(String host, int port) throws Exception { PoolImpl pool = null; try { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); createCache(props); pool = (PoolImpl) PoolManager.createFactory().addServer(host, port) .setSubscriptionEnabled(true).setThreadLocalConnections(false).setReadTimeout(1000) .setSocketBufferSize(32768).setMinConnections(1).setSubscriptionRedundancy(-1) .setPingInterval(2000).create("test pool"); Region<Object, Object> region = cache.createRegionFactory(RegionShortcut.LOCAL) .setPoolName("test pool").create(REGION_NAME1); region.registerInterest(".*"); /** get the subscription connection and verify that it has the correct timeout setting */ QueueConnectionImpl primaryConnection = (QueueConnectionImpl) pool.getPrimaryConnection(); int pingInterval = ((CacheClientUpdater) primaryConnection.getUpdater()) .getServerQueueStatus().getPingInterval(); assertNotEquals(0, pingInterval); assertEquals(CacheClientNotifier.getClientPingInterval(), pingInterval); } finally { cache.close(); } }
public static void createCacheClient(Pool poolAttr, String regionName1, String regionName2) throws Exception { new CacheServerTestUtil().createCache(getClientProperties()); PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.init(poolAttr); PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil"); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setPoolName(p.getName()); RegionAttributes attrs = factory.create(); cache.createRegion(regionName1, attrs); cache.createRegion(regionName2, attrs); pool = p; }
Pool p = PoolManager.createFactory().addServer(host, PORT1).setSubscriptionEnabled(true) .setSubscriptionRedundancy(-1)
PORT1 = initServerCache(true); String host = NetworkUtils.getServerHostName(); Pool p = PoolManager.createFactory().addServer(host, PORT1).setSubscriptionEnabled(true) .setSubscriptionRedundancy(-1)
PoolFactory poolFactory = PoolManager.createFactory(); poolFactory.setRetryAttempts(200);
String host = NetworkUtils.getServerHostName(); PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, PORT1).setSubscriptionEnabled(true) .setThreadLocalConnections(true).setReadTimeout(1000).setSocketBufferSize(32768) .setMinConnections(3).setSubscriptionRedundancy(-1).setPingInterval(2000)
/** * 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()); }
if (!pools.isEmpty()) { for (final Pool cp : pools.values()) { PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory(); poolFactory.init(cp); poolFactory.create(cp.getName());
if (!pools.isEmpty()) { for (Pool pool : pools.values()) { PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory(); poolFactory.init(pool); poolFactory.create(pool.getName());
/** * Creates an instance of the {@link PoolFactory} interface to construct, configure and initialize a {@link Pool}. * * @return a {@link PoolFactory} implementation to create a {@link Pool}. * @see org.apache.geode.cache.client.PoolManager#createFactory() * @see org.apache.geode.cache.client.PoolFactory */ protected PoolFactory createPoolFactory() { return PoolManager.createFactory(); }