/** * 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; }
/** * Sets the number of milliseconds to wait for a response from a server before timing out the * operation and trying another server (if any are available). * * @param timeout number of milliseconds to wait for a response from a server * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>timeout</code> is less than <code>0</code>. */ public ClientCacheFactory setPoolReadTimeout(int timeout) { getPoolFactory().setReadTimeout(timeout); return this; }
/** * Set the number of times to retry a request after timeout/exception. * * @param retryAttempts The number of times to retry a request after timeout/exception. -1 * indicates that a request should be tried against every available server before failing * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>idleTimout</code> is less than <code>-1</code>. */ public ClientCacheFactory setPoolRetryAttempts(int retryAttempts) { getPoolFactory().setRetryAttempts(retryAttempts); return this; }
public Region createProxyRegion(String regionPath) { return cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(regionPath); }
@Override public Object call() throws Exception { ClientRegionFactory factory = ((ClientCache) getCache()) .createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY); if (valueConstraint != null) { factory.setValueConstraint(valueConstraint); } factory.create(regionName); return true; } });
protected void executeQueryWithCheckForAccessPermissions(VM vm, String query, String regionName, String regexForExpectedExceptions) { vm.invoke(() -> { Region region = getClientCache().getRegion(regionName); assertExceptionOccurred(getClientCache().getQueryService(), query, regexForExpectedExceptions); Pool pool = PoolManager.find(region); assertExceptionOccurred(pool.getQueryService(), query, regexForExpectedExceptions); }); } }
/** * Configures the group that all servers this pool connects to must belong to. * * @param group the server group that this pool will connect to. If <code>null</code> or * <code>""</code> then all servers will be connected to. * @return a reference to <code>this</code> */ public ClientCacheFactory setPoolServerGroup(String group) { getPoolFactory().setServerGroup(group); return this; }
/** * If set to <code>true</code> then the created pool can be used by multiple users. <br> * <br> * Note: If set to true, all the client side regions must be {@link ClientRegionShortcut#PROXY * proxies}. No client side storage is allowed. * * @return a reference to <code>this</code> */ public ClientCacheFactory setPoolMultiuserAuthentication(boolean enabled) { getPoolFactory().setMultiuserAuthentication(enabled); return this; }
/** * Sets the interval in milliseconds to wait before sending acknowledgements to the cache server * for events received from the server subscriptions. * * @param ackInterval number of milliseconds to wait before sending event acknowledgements. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>ackInterval</code> is less than or equal to * <code>0</code>. */ public ClientCacheFactory setPoolSubscriptionAckInterval(int ackInterval) { getPoolFactory().setSubscriptionAckInterval(ackInterval); return this; }
/** * Set the minimum number of connections to keep available at all times. When the pool is created, * it will create this many connections. If <code>0</code> then connections will not be made until * an actual operation is done that requires client-to-server communication. * * @param minConnections the initial number of connections this pool will create. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>minConnections</code> is less than <code>0</code>. */ public ClientCacheFactory setPoolMinConnections(int minConnections) { getPoolFactory().setMinConnections(minConnections); return this; }
/** * Sets the redundancy level for this pools server-to-client subscriptions. If <code>0</code> then * no redundant copies will be kept on the servers. Otherwise an effort will be made to maintain * the requested number of copies of the server-to-client subscriptions. At most one copy per * server will be made up to the requested level. * * @param redundancy the number of redundant servers for this client's subscriptions. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>redundancyLevel</code> is less than <code>-1</code>. */ public ClientCacheFactory setPoolSubscriptionRedundancy(int redundancy) { getPoolFactory().setSubscriptionRedundancy(redundancy); return this; }
private PoolFactory getPoolFactory() { if (this.pf == null) { this.pf = PoolManager.createFactory(); } return this.pf; }
/** * Set the amount of time a connection can be idle before expiring the connection. If the pool * size is greater than the minimum specified by {@link #setPoolMinConnections(int)}, connections * which have been idle for longer than the idleTimeout will be closed. * * @param idleTimeout The amount of time in milliseconds that an idle connection should live * before expiring. -1 indicates that connections should never expire. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>idleTimout</code> is less than <code>-1</code>. */ public ClientCacheFactory setPoolIdleTimeout(long idleTimeout) { getPoolFactory().setIdleTimeout(idleTimeout); return this; }
private static PoolFactory addServers(PoolFactory factory, String h, int... ports) { for (int port : ports) { factory.addServer(h, port); } return factory; }
/** * Sets the messageTrackingTimeout attribute which is the time-to-live period, in milliseconds, * for subscription events the client has received from the server. It's used to minimize * duplicate events. Entries that have not been modified for this amount of time are expired from * the list * * @param messageTrackingTimeout number of milliseconds to set the timeout to. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>messageTrackingTimeout</code> is less than or equal * to <code>0</code>. */ public ClientCacheFactory setPoolSubscriptionMessageTrackingTimeout(int messageTrackingTimeout) { getPoolFactory().setSubscriptionMessageTrackingTimeout(messageTrackingTimeout); return this; }
/** * Sets the socket connect timeout for this pool. The number of milli seconds specified as socket * timeout when the client connects to the servers/locators. A timeout of zero is interpreted as * an infinite timeout. The connection will then block until established or an error occurs. * * @param socketConnectTimeout timeout in milliseconds when the client connects to the servers * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>socketConnectTimeout</code> is less than or equal to * <code>-1</code>. */ public ClientCacheFactory setPoolSocketConnectTimeout(int socketConnectTimeout) { getPoolFactory().setSocketConnectTimeout(socketConnectTimeout); return this; }
/** * Unconditionally destroys all created pools that are in this manager. */ public static void close() { close(false); } }
@Override protected Object executeOnServer(ServerLocation p_server, Op op, boolean accessed, boolean onlyUseExistingCnx) { throw new ServerConnectivityException(); } };
/** * * Create a new instance of ServerOperationException with a detail message * * @param message the detail message */ public ServerOperationException(String message) { super(getServerMessage(message)); }
/** * Create a new instance of ServerOperationException with a detail message and cause * * @param message the detail message * @param cause the cause */ public ServerOperationException(String message, Throwable cause) { super(getServerMessage(message), cause); }