/** * 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; }
/** * 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; }
/** * 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; }
/** * 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 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; }
/** * 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 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 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; }
/** * 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; }
/** * Sets the socket buffer size for each connection made in this pool. Large messages can be * received and sent faster when this buffer is larger. Larger buffers also optimize the rate at * which servers can send events for client subscriptions. * * @param bufferSize the size of the socket buffers used for reading and writing on each * connection in this pool. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>bufferSize</code> is less than or equal to * <code>0</code>. */ public ClientCacheFactory setPoolSocketBufferSize(int bufferSize) { getPoolFactory().setSocketBufferSize(bufferSize); return this; }
/** * 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 load conditioning interval for this pool. This interval controls how frequently the * pool will check to see if a connection to a given server should be moved to a different server * to improve the load balance. * <p> * A value of <code>-1</code> disables load conditioning * * @param loadConditioningInterval the connection lifetime in milliseconds * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>connectionLifetime</code> is less than * <code>-1</code>. */ public ClientCacheFactory setPoolLoadConditioningInterval(int loadConditioningInterval) { getPoolFactory().setLoadConditioningInterval(loadConditioningInterval); return this; }
/** * Set the max number of client to server connections that the pool will create. If all of the * connections are in use, an operation requiring a client to server connection will block until a * connection is available. * * @param maxConnections the maximum number of connections in the pool. this pool will create. -1 * indicates that there is no maximum number of connections * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>maxConnections</code> is less than * <code>minConnections</code>. * @see #setPoolFreeConnectionTimeout(int) */ public ClientCacheFactory setPoolMaxConnections(int maxConnections) { getPoolFactory().setMaxConnections(maxConnections); return this; }
/** * Sets the thread local connections policy for this pool. If <code>true</code> then any time a * thread goes to use a connection from this pool it will check a thread local cache and see if it * already has a connection in it. If so it will use it. If not it will get one from this pool and * cache it in the thread local. This gets rid of thread contention for the connections but * increases the number of connections the servers see. * <p> * If <code>false</code> then connections are returned to the pool as soon as the operation being * done with the connection completes. This allows connections to be shared amonst multiple * threads keeping the number of connections down. * * @param threadLocalConnections if <code>true</code> then enable thread local connections. * @return a reference to <code>this</code> */ public ClientCacheFactory setPoolThreadLocalConnections(boolean threadLocalConnections) { getPoolFactory().setThreadLocalConnections(threadLocalConnections); return this; }
/** * How often to send client statistics to the server. Doing this allows <code>gfmon</code> to * monitor clients. * <p> * A value of <code>-1</code> disables the sending of client statistics to the server. * * @param statisticInterval The amount of time in milliseconds between sends of client statistics * to the server. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>statisticInterval</code> is less than * <code>-1</code>. */ public ClientCacheFactory setPoolStatisticInterval(int statisticInterval) { getPoolFactory().setStatisticInterval(statisticInterval); return this; }
/** * How often to ping servers to verify that they are still alive. Each server will be sent a ping * every pingInterval if there has not been any other communication with the server. * <p> * These pings are used by the server to monitor the health of the client. Make sure that the * pingInterval is less than the maximum time between pings allowed by the cache server. * * @param pingInterval The amount of time in milliseconds between pings. * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>pingInterval</code> is less than or equal to * <code>0</code>. * @see CacheServer#setMaximumTimeBetweenPings(int) */ public ClientCacheFactory setPoolPingInterval(long pingInterval) { getPoolFactory().setPingInterval(pingInterval); return this; }
/** * Add a locator, given its host and port, to this factory. The locator must be a server locator * and will be used to discover other running cache servers and locators. Note that if the host is * unknown at the time of this call the locator 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 locator is listening on. * @param port the port that the locator 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 server has already been {@link #addPoolServer added} to this * factory. */ public ClientCacheFactory addPoolLocator(String host, int port) { getPoolFactory().addLocator(host, port); return this; }
/** * 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; }
/** * Sets the free connection timeout for this pool. If the pool has a max connections setting, * operations will block if all of the connections are in use. The free connection timeout * specifies how long those operations will block waiting for a free connection before receiving * an {@link AllConnectionsInUseException}. If max connections is not set this setting has no * effect. * * @param connectionTimeout the connection timeout in milliseconds * @return a reference to <code>this</code> * @throws IllegalArgumentException if <code>connectionTimeout</code> is less than or equal to * <code>0</code>. * @see #setPoolMaxConnections(int) */ public ClientCacheFactory setPoolFreeConnectionTimeout(int connectionTimeout) { getPoolFactory().setFreeConnectionTimeout(connectionTimeout); return this; }