/** * If set to <code>true</code> then the created pool will have server-to-client subscriptions * enabled. If set to <code>false</code> then all <code>Subscription*</code> attributes are * ignored at create time. * * @return a reference to <code>this</code> */ public ClientCacheFactory setPoolSubscriptionEnabled(boolean enabled) { getPoolFactory().setSubscriptionEnabled(enabled); return this; }
protected void startBridgeClientInVM(VM vm, final String group, final String host, final int port, final String... regions) throws Exception { PoolFactoryImpl pf = new PoolFactoryImpl(null); pf.addLocator(host, port).setServerGroup(group).setPingInterval(200) .setSubscriptionEnabled(true).setSubscriptionRedundancy(-1); startBridgeClientInVM(vm, pf.getPoolAttributes(), regions); }
protected void startBridgeClient(final String group, final String host, final int port, final String[] regions) throws Exception { PoolFactoryImpl pf = new PoolFactoryImpl(null); pf.addLocator(host, port).setServerGroup(group).setPingInterval(200) .setSubscriptionEnabled(true).setSubscriptionRedundancy(-1); startBridgeClient(pf.getPoolAttributes(), regions); }
f.setSubscriptionEnabled(parseBoolean(v));
poolFactory.setRetryAttempts(200); poolFactory.setMultiuserAuthentication(multiUserAuthMode); poolFactory.setSubscriptionEnabled(true);
try { PoolFactory poolFactory = PoolManager.createFactory(); addServers(poolFactory, h, ports).setSubscriptionEnabled(true).setThreadLocalConnections(true) .setReadTimeout(5000).setSocketBufferSize(32768).setMinConnections(3) .setSubscriptionRedundancy(1).setPingInterval(2000);
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)
pf.setSubscriptionEnabled(true); pf.setSubscriptionRedundancy(redundancy); pf.setSubscriptionAckInterval(1);
.thenAnswer(newSetter(subscriptionAckInterval, mockPoolFactory)); when(mockPoolFactory.setSubscriptionEnabled(anyBoolean())) .thenAnswer(newSetter(subscriptionEnabled, mockPoolFactory));
mockPoolFactory.setSubscriptionEnabled(invocation.getArgument(0)); return clientCacheFactorySpy; }).when(clientCacheFactorySpy).setPoolSubscriptionEnabled(anyBoolean());
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().set("log-level", "WARN").create(); final String poolName = "subscriptionPool"; PoolManager.createFactory().addLocator("127.0.0.1", 10334).setSubscriptionEnabled(true) .create(poolName); // create a local region that matches the server region final ClientRegionFactory<Integer, String> incomingRegionFactory = cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY); Region<Integer, String> incomingRegion = incomingRegionFactory.setPoolName(poolName).create(INCOMING_REGION_NAME); // create another local region that matches the server region final ClientRegionFactory<String, String> outgoingRegionFactory = cache.<String, String>createClientRegionFactory(ClientRegionShortcut.PROXY); Region<String, String> outgoingRegion = outgoingRegionFactory.setPoolName(poolName).create(OUTGOING_REGION_NAME); new Example().checkWords(incomingRegion, outgoingRegion, Arrays.asList(new String[] {"that", "teh", "wil", "i'"})); cache.close(); }
it.setStatisticInterval(this.statisticInterval); it.setSubscriptionAckInterval(this.subscriptionAckInterval); it.setSubscriptionEnabled(this.subscriptionEnabled); it.setSubscriptionMessageTrackingTimeout(this.subscriptionMessageTrackingTimeout); it.setSubscriptionRedundancy(this.subscriptionRedundancy);
it.setStatisticInterval(this.statisticInterval); it.setSubscriptionAckInterval(this.subscriptionAckInterval); it.setSubscriptionEnabled(this.subscriptionEnabled); it.setSubscriptionMessageTrackingTimeout(this.subscriptionMessageTrackingTimeout); it.setSubscriptionRedundancy(this.subscriptionRedundancy);