public interface PoolFactory
Pool
.
Every pool needs to have at least one locator
or server
added
to it. Locators should be added unless direct connections to
bridge servers are desired.
The setter methods are used to specify non-default values for the other pool properties.
Once it is configured create(java.lang.String)
will produce an instance.
The factory can be restored to its default
configuration by calling reset()
.
Instances of this interface can be created by calling
PoolManager.createFactory()
.
If a subscription is going to be made using a pool then subscriptions
must be enabled
on the pool.
Subscriptions are made using these APIs:
QueryService.newCq(String, CqAttributes)
QueryService.newCq(String, CqAttributes, boolean)
QueryService.newCq(String, String, CqAttributes)
QueryService.newCq(String, String, CqAttributes, boolean)
Region.registerInterest(Object)
Region.registerInterest(Object, boolean)
Region.registerInterest(Object, InterestResultPolicy)
Region.registerInterest(Object, InterestResultPolicy, boolean)
Region.registerInterestRegex(String)
Region.registerInterestRegex(String, boolean)
Region.registerInterestRegex(String, InterestResultPolicy)
Region.registerInterestRegex(String, InterestResultPolicy, boolean)
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FREE_CONNECTION_TIMEOUT
The default amount of time, in milliseconds, which we will wait for a free
connection if max connections is set and all of the connections are in use.
|
static long |
DEFAULT_IDLE_TIMEOUT
The default amount of time in milliseconds, to wait for a connection to become idle
Current value:
5000 . |
static int |
DEFAULT_LOAD_CONDITIONING_INTERVAL
The default interval in which 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.
|
static int |
DEFAULT_MAX_CONNECTIONS
The default maximum number of connections to create
Current value:
-1 . |
static int |
DEFAULT_MIN_CONNECTIONS
The default number of connections to initially create
Current value:
1 . |
static boolean |
DEFAULT_MULTIUSER_AUTHENTICATION
The default value for whether to use multiuser mode.
|
static long |
DEFAULT_PING_INTERVAL
The default frequency, in milliseconds, to ping servers.
|
static boolean |
DEFAULT_PR_SINGLE_HOP_ENABLED
The default value for whether to have single hop optimisations enabled.
|
static int |
DEFAULT_READ_TIMEOUT
The default amount of time, in milliseconds, to wait for a response from a server
Current value:
10000 . |
static int |
DEFAULT_RETRY_ATTEMPTS
The default number of times to retry an operation after a timeout or exception.
|
static String |
DEFAULT_SERVER_GROUP
The default server group.
|
static int |
DEFAULT_SOCKET_BUFFER_SIZE
Default size in bytes of the socket buffer on each connection established.
|
static int |
DEFAULT_STATISTIC_INTERVAL
The default frequency, in milliseconds, that client statistics
will be sent to the server.
|
static int |
DEFAULT_SUBSCRIPTION_ACK_INTERVAL
The default amount of time, in milliseconds, to wait before
sending an acknowledgement to the server about events
received from the subscriptions.
|
static boolean |
DEFAULT_SUBSCRIPTION_ENABLED
The default value for whether to establish a server to client subscription.
|
static int |
DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT
The default amount of time, in milliseconds, that messages sent from a
server to a client will be tracked.
|
static int |
DEFAULT_SUBSCRIPTION_REDUNDANCY
The default redundancy for servers holding subscriptions established by this
client
Current value:
0 . |
static boolean |
DEFAULT_THREAD_LOCAL_CONNECTIONS
The default value for whether connections should have affinity to the thread
that last used them.
|
Modifier and Type | Method and Description |
---|---|
PoolFactory |
addLocator(String host,
int port)
Add a locator, given its host and port, to this factory.
|
PoolFactory |
addServer(String host,
int port)
Add a server, given its host and port, to this factory.
|
Pool |
create(String name)
Create a new Pool for connecting a client to a set of GemFire Cache Servers.
|
PoolFactory |
reset()
Resets the configuration of this factory to its defaults.
|
PoolFactory |
setFreeConnectionTimeout(int connectionTimeout)
Sets the free connection timeout for this pool.
|
PoolFactory |
setIdleTimeout(long idleTimeout)
Set the amount of time a connection can be idle before expiring the connection.
|
PoolFactory |
setLoadConditioningInterval(int loadConditioningInterval)
Sets the load conditioning interval for this pool.
|
PoolFactory |
setMaxConnections(int maxConnections)
Set the max number of client to server connections that the pool will create.
|
PoolFactory |
setMinConnections(int minConnections)
Set the minimum number of connections to keep available at all times.
|
PoolFactory |
setMultiuserAuthentication(boolean enabled)
If set to
true then the created pool can be used by multiple
authenticated users. |
PoolFactory |
setPingInterval(long pingInterval)
How often to ping servers to verify that they are still alive.
|
PoolFactory |
setPRSingleHopEnabled(boolean enabled)
By default setPRSingleHopEnabled is
true
in which case the client is aware of the location of partitions on servers hosting
regions with
DataPolicy.PARTITION . |
PoolFactory |
setReadTimeout(int timeout)
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).
|
PoolFactory |
setRetryAttempts(int retryAttempts)
Set the number of times to retry a request after timeout/exception.
|
PoolFactory |
setServerGroup(String group)
Configures the group that all servers this pool connects to must belong to.
|
PoolFactory |
setSocketBufferSize(int bufferSize)
Sets the socket buffer size for each connection made in this pool.
|
PoolFactory |
setStatisticInterval(int statisticInterval)
How often to send client statistics to the server.
|
PoolFactory |
setSubscriptionAckInterval(int ackInterval)
Sets the interval in milliseconds
to wait before sending acknowledgements to the bridge server for
events received from the server subscriptions.
|
PoolFactory |
setSubscriptionEnabled(boolean enabled)
If set to
true then the created pool will have server-to-client
subscriptions enabled. |
PoolFactory |
setSubscriptionMessageTrackingTimeout(int messageTrackingTimeout)
Sets the messageTrackingTimeout attribute which is the time-to-live period, in
milliseconds, for subscription events the client has received from the server.
|
PoolFactory |
setSubscriptionRedundancy(int redundancy)
Sets the redundancy level for this pools server-to-client subscriptions.
|
PoolFactory |
setThreadLocalConnections(boolean threadLocalConnections)
Sets the thread local connections policy for this pool.
|
static final int DEFAULT_FREE_CONNECTION_TIMEOUT
Current value: 10000
.
static final int DEFAULT_LOAD_CONDITIONING_INTERVAL
Current value: 300,000
(which is 5 minutes).
static final int DEFAULT_SOCKET_BUFFER_SIZE
Current value: 32768
.
static final int DEFAULT_READ_TIMEOUT
Current value: 10000
.
static final int DEFAULT_MIN_CONNECTIONS
Current value: 1
.
static final int DEFAULT_MAX_CONNECTIONS
Current value: -1
.
static final long DEFAULT_IDLE_TIMEOUT
Current value: 5000
.
static final int DEFAULT_RETRY_ATTEMPTS
Current value: -1
.
static final long DEFAULT_PING_INTERVAL
Current value: 10000
.
static final int DEFAULT_STATISTIC_INTERVAL
Current value: -1
.
static final boolean DEFAULT_THREAD_LOCAL_CONNECTIONS
Current value: false
.
static final boolean DEFAULT_SUBSCRIPTION_ENABLED
Current value: false
.
static final int DEFAULT_SUBSCRIPTION_REDUNDANCY
Current value: 0
.
static final int DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT
Current value: 900000
.
static final int DEFAULT_SUBSCRIPTION_ACK_INTERVAL
Current value: 100
.
static final String DEFAULT_SERVER_GROUP
Current value: ""
.
static final boolean DEFAULT_PR_SINGLE_HOP_ENABLED
Current value: true
.
static final boolean DEFAULT_MULTIUSER_AUTHENTICATION
Current value: false
.
PoolFactory setFreeConnectionTimeout(int connectionTimeout)
AllConnectionsInUseException
. If max connections
is not set this setting has no effect.connectionTimeout
- the connection timeout in millisecondsthis
IllegalArgumentException
- if connectionTimeout
is less than or equal to 0
.setMaxConnections(int)
PoolFactory setLoadConditioningInterval(int loadConditioningInterval)
A value of -1
disables load conditioning
loadConditioningInterval
- the connection lifetime in millisecondsthis
IllegalArgumentException
- if connectionLifetime
is less than -1
.PoolFactory setSocketBufferSize(int bufferSize)
bufferSize
- the size of the socket buffers used for reading and
writing on each connection in this pool.this
IllegalArgumentException
- if bufferSize
is less than or equal to 0
.PoolFactory setThreadLocalConnections(boolean threadLocalConnections)
true
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.
If false
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.
threadLocalConnections
- if true
then enable thread local
connections.this
PoolFactory setReadTimeout(int timeout)
timeout
- number of milliseconds to wait for a response from a serverthis
IllegalArgumentException
- if timeout
is less than 0
.PoolFactory setMinConnections(int minConnections)
0
then connections will not be made until an actual operation
is done that requires client-to-server communication.minConnections
- the initial number of connections
this pool will create.this
IllegalArgumentException
- if minConnections
is less than 0
.PoolFactory setMaxConnections(int maxConnections)
maxConnections
- the maximum number of connections in the pool.
this pool will create. -1 indicates that there is no maximum number of connectionsthis
IllegalArgumentException
- if maxConnections
is less than minConnections
.setFreeConnectionTimeout(int)
PoolFactory setIdleTimeout(long idleTimeout)
setMinConnections(int)
, connections which have been idle
for longer than the idleTimeout will be closed.idleTimeout
- The amount of time in milliseconds that an idle connection
should live before expiring. -1 indicates that connections should never expire.this
IllegalArgumentException
- if idleTimout
is less than -1
.PoolFactory setRetryAttempts(int retryAttempts)
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 failingthis
IllegalArgumentException
- if retryAttempts
is less than -1
.PoolFactory setPingInterval(long pingInterval)
pingInterval
- The amount of time in milliseconds between
pings.this
IllegalArgumentException
- if pingInterval
is less than or equal to 0
.CacheServer.setMaximumTimeBetweenPings(int)
PoolFactory setStatisticInterval(int statisticInterval)
gfmon
to monitor clients.
A value of -1
disables the sending of client statistics
to the server.
statisticInterval
- The amount of time in milliseconds between
sends of client statistics to the server.this
IllegalArgumentException
- if statisticInterval
is less than -1
.PoolFactory setServerGroup(String group)
group
- the server group that this pool will connect to.
If null
or ""
then all servers will be connected to.this
PoolFactory addLocator(String host, int port)
host
- the host name or ip address that the locator is listening on.port
- the port that the locator is listening onthis
IllegalArgumentException
- if host
is an unknown host
according to InetAddress.getByName(String)
or if port is outside
the valid range of [1..65535] inclusive.IllegalStateException
- if a server has already been added
to this factory.PoolFactory addServer(String host, int port)
host
- the host name or ip address that the server is listening on.port
- the port that the server is listening onthis
IllegalArgumentException
- if host
is an unknown host
according to InetAddress.getByName(String)
or if port is outside
the valid range of [1..65535] inclusive.IllegalStateException
- if a locator has already been added
to this factory.PoolFactory setSubscriptionEnabled(boolean enabled)
true
then the created pool will have server-to-client
subscriptions enabled.
If set to false
then all Subscription*
attributes
are ignored at create time.this
PoolFactory setSubscriptionRedundancy(int redundancy)
0
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.redundancy
- the number of redundant servers for this client's subscriptions.this
IllegalArgumentException
- if redundancyLevel
is less than -1
.PoolFactory setSubscriptionMessageTrackingTimeout(int messageTrackingTimeout)
messageTrackingTimeout
- number of milliseconds to set the timeout to.this
IllegalArgumentException
- if messageTrackingTimeout
is less than or equal to 0
.PoolFactory setSubscriptionAckInterval(int ackInterval)
ackInterval
- number of milliseconds to wait before sending event
acknowledgements.this
IllegalArgumentException
- if ackInterval
is less than or equal to 0
.PoolFactory reset()
this
Pool create(String name)
name
- the name of the pool, used when connecting regions to itIllegalStateException
- if a pool with name
already existsIllegalStateException
- if a locator or server has not been added.PoolFactory setPRSingleHopEnabled(boolean enabled)
true
in which case the client is aware of the location of partitions on servers hosting
regions
with
DataPolicy.PARTITION
.
Using this information, the client routes the client cache operations
directly to the server which is hosting the required partition for the
cache operation using a single network hop.
This mode works best
when setMaxConnections(int)
is set
to -1
which is the default.
This mode causes the client to have more connections to the servers.
If setPRSingleHopEnabled is false
the client may need to do an extra network hop on servers
to go to the required partition for that cache operation.
The client will use fewer network connections to the servers.
Caution: for partition
regions
with
local-max-memory
equal to zero, no cache operations mentioned above will be routed to those
servers as they do not host any partitions.
this
PoolFactory setMultiuserAuthentication(boolean enabled)
true
then the created pool can be used by multiple
authenticated users. this
ClientCache.createAuthenticatedView(java.util.Properties)
Copyright © 1997-2017 Pivotal Software, Inc. All rights reserved.