private static PoolFactory addServers(PoolFactory factory, String h, int... ports) { for (int port : ports) { factory.addServer(h, port); } return factory; }
/** * @since GemFire 5.7 */ private void doServer(Attributes atts) { PoolFactory f = (PoolFactory) stack.peek(); String host = atts.getValue(HOST).trim(); int port = parseInt(atts.getValue(PORT)); f.addServer(host, port); }
/** * Add a server, given its host and port, to this factory. The server must be a cache server and * this client will directly connect to without consulting a server locator. Note that if the host * is unknown at the time of this call the server will still be added. When the pool is used for * an operation if the host is still unknown an exception will be thrown. * * @param host the host name or ip address that the server is listening on. * @param port the port that the server is listening on * @return a reference to <code>this</code> * @throws IllegalArgumentException if port is outside the valid range of [0..65535] inclusive. * @throws IllegalStateException if a locator has already been {@link #addPoolLocator added} to * this factory. */ public ClientCacheFactory addPoolServer(String host, int port) { getPoolFactory().addServer(host, port); return this; }
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; }
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(); } }
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)
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)
} else { for (int z = 0; z < ports.length; z++) { pf.addServer(host, ports[z]);
}); when(mockPoolFactory.addServer(anyString(), anyInt())).thenAnswer(invocation -> { servers.add(new InetSocketAddress(invocation.<String>getArgument(0), invocation.getArgument(1))); return mockPoolFactory;
mockPoolFactory.addServer(invocation.getArgument(0), invocation.getArgument(1)); return clientCacheFactorySpy; }).when(clientCacheFactorySpy).addPoolServer(anyString(), anyInt());
it.addServer(server.getHost(), server.getPort())); });
it.addServer(server.getHost(), server.getPort())); });