public interface CacheServer
Cache
to client VMs in another
distributed system via a socket. A cache server is used in conjunction with a client Pool
to connect two regions that reside in different distributed systems.Cache.addCacheServer()
,
Cache.getCacheServers()
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BIND_ADDRESS
The default ip address or host name that the cache server's socket will listen on for client
connections.
|
static String[] |
DEFAULT_GROUPS
Deprecated.
as of 7.0 use the groups gemfire property
|
static String |
DEFAULT_HOSTNAME_FOR_CLIENTS
The default ip address or host name that will be given to clients as the host this cache server
is listening on.
|
static long |
DEFAULT_LOAD_POLL_INTERVAL
The default frequency at which to poll the load probe for the load on this cache server.
|
static ServerLoadProbe |
DEFAULT_LOAD_PROBE
The default load balancing probe.
|
static int |
DEFAULT_MAX_CONNECTIONS
The default number of sockets accepted by a CacheServer.
|
static int |
DEFAULT_MAX_THREADS
The default limit to the maximum number of cache server threads that can be created to service
client requests.
|
static int |
DEFAULT_MAXIMUM_MESSAGE_COUNT
The default maximum number of messages that can be enqueued in a client-queue.
|
static int |
DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS
The default maximum amount of time between client pings.
|
static int |
DEFAULT_MESSAGE_TIME_TO_LIVE
The default time (in seconds ) after which a message in the client queue will expire.
|
static boolean |
DEFAULT_NOTIFY_BY_SUBSCRIPTION
The default notify-by-subscription value which tells the
CacheServer whether or
not to notify clients based on key subscription. |
static int |
DEFAULT_PORT
The default port on which a
CacheServer is configured to serve. |
static int |
DEFAULT_SOCKET_BUFFER_SIZE
The default socket buffer size for socket buffers from the cache server to the client.
|
static boolean |
DEFAULT_TCP_NO_DELAY
The default setting for outgoing tcp/ip connections.
|
Modifier and Type | Method and Description |
---|---|
Set<ClientSession> |
getAllClientSessions()
Returns a set of all
ClientSession s |
String |
getBindAddress()
Returns a string representing the ip address or host name that this cache server will listen
on.
|
ClientSession |
getClientSession(DistributedMember member)
Returns the
ClientSession associated with the DistributedMember |
ClientSession |
getClientSession(String durableClientId)
Returns the
ClientSession associated with the durable client id |
ClientSubscriptionConfig |
getClientSubscriptionConfig()
Get the ClientSubscriptionConfig for this cache server.
|
String[] |
getGroups()
Deprecated.
as of 7.0 use the groups gemfire property
|
String |
getHostnameForClients()
Returns a string representing the ip address or host name that server locators will tell
clients that this cache server is listening on.
|
Set<InterestRegistrationListener> |
getInterestRegistrationListeners()
Returns a read-only set of
InterestRegistrationListener s registered with this
notifier. |
long |
getLoadPollInterval()
Get the frequency in milliseconds to poll the load probe on this cache server.
|
ServerLoadProbe |
getLoadProbe()
Get the load probe for this cache server.
|
int |
getMaxConnections()
Returns the maximum allowed client connections
|
int |
getMaximumMessageCount()
Returns the maximum number of messages that can be enqueued in a client-queue.
|
int |
getMaximumTimeBetweenPings()
Returns the maximum amount of time between client pings.
|
int |
getMaxThreads()
Returns the maximum number of threads allowed in this cache server to service client requests.
|
int |
getMessageTimeToLive()
Returns the time (in seconds ) after which a message in the client queue will expire.
|
boolean |
getNotifyBySubscription()
Deprecated.
as of 6.0.1. This method is no more in use, by default notifyBySubscription
attribute is set to true.
|
int |
getPort()
Returns the port on which this cache server listens for clients.
|
int |
getSocketBufferSize()
Returns the configured buffer size of the socket connection for this
CacheServer . |
boolean |
getTcpNoDelay()
Get the outgoing connection tcp-no-delay setting.
|
boolean |
isRunning()
Returns whether this cache server is running
|
void |
registerInterestRegistrationListener(InterestRegistrationListener listener)
Registers a new
InterestRegistrationListener with the set of
InterestRegistrationListener s. |
void |
setBindAddress(String address)
Sets the ip address or host name that this cache server is to listen on for client connections.
|
void |
setGroups(String[] groups)
Deprecated.
as of 7.0 use the groups gemfire property
|
void |
setHostnameForClients(String name)
Sets the ip address or host name that this cache server is to listen on for client connections.
|
void |
setLoadPollInterval(long loadPollInterval)
Set the frequency in milliseconds to poll the load probe on this cache server
|
void |
setLoadProbe(ServerLoadProbe loadProbe)
Set the load probe for this cache server.
|
void |
setMaxConnections(int maxCons)
Sets the maximum number of client connections allowed.
|
void |
setMaximumMessageCount(int maxMessageCount)
Sets maximum number of messages that can be enqueued in a client-queue.
|
void |
setMaximumTimeBetweenPings(int maximumTimeBetweenPings)
Sets the maximum amount of time between client pings.
|
void |
setMaxThreads(int maxThreads)
Sets the maximum number of threads allowed in this cache server to service client requests.
|
void |
setMessageTimeToLive(int messageTimeToLive)
Sets the time (in seconds ) after which a message in the client queue will expire.
|
void |
setNotifyBySubscription(boolean b)
Deprecated.
as of 6.0.1. This method is no longer in use, by default notifyBySubscription
attribute is set to true.
|
void |
setPort(int port)
Sets the port on which this cache server listens for clients.
|
void |
setSocketBufferSize(int socketBufferSize)
Sets the buffer size in bytes of the socket connection for this
CacheServer . |
void |
setTcpNoDelay(boolean noDelay)
Configures the tcpNoDelay setting of sockets used to send messages to clients.
|
void |
start()
Starts this cache server.
|
void |
stop()
Stops this cache server.
|
void |
unregisterInterestRegistrationListener(InterestRegistrationListener listener)
Unregisters an existing
InterestRegistrationListener from the set of
InterestRegistrationListener s. |
static final int DEFAULT_PORT
CacheServer
is configured to serve.static final int DEFAULT_MAX_CONNECTIONS
static final int DEFAULT_MAX_THREADS
0
causes a thread to be bound to every
connection and to be dedicated to detecting client requests on that connection. A selector is
not used in this default mode. Current value: 0static final boolean DEFAULT_NOTIFY_BY_SUBSCRIPTION
CacheServer
whether or
not to notify clients based on key subscription.static final int DEFAULT_SOCKET_BUFFER_SIZE
static final int DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS
ClientHealthMonitor
to determine the health of this CacheServer
's
clients.static final int DEFAULT_MAXIMUM_MESSAGE_COUNT
static final int DEFAULT_MESSAGE_TIME_TO_LIVE
@Deprecated @Immutable static final String[] DEFAULT_GROUPS
@Immutable static final ServerLoadProbe DEFAULT_LOAD_PROBE
static final long DEFAULT_LOAD_POLL_INTERVAL
static final String DEFAULT_BIND_ADDRESS
static final String DEFAULT_HOSTNAME_FOR_CLIENTS
static final boolean DEFAULT_TCP_NO_DELAY
int getPort()
void setPort(int port)
port
- the port on which this cache server listens for clientsIllegalStateException
- If this cache server is runningString getBindAddress()
DEFAULT_BIND_ADDRESS
void setBindAddress(String address)
Setting a specific bind address will cause the cache server to always use this address and
ignore any address specified by "server-bind-address" or "bind-address" in the
gemfire.properties
file (see
DistributedSystem
for a description of these properties).
The value ""
does not override the gemfire.properties
. It will cause
the local machine's default address to be listened on if the properties file does not specify
and address. If you wish to override the properties and want to have your cache server bind to
all local addresses then use this bind address "0.0.0.0"
.
A null
value will be treated the same as the default ""
.
address
- the ip address or host name that this cache server is to listen onDEFAULT_BIND_ADDRESS
String getHostnameForClients()
DEFAULT_HOSTNAME_FOR_CLIENTS
void setHostnameForClients(String name)
Setting a specific hostname-for-clients will cause server locators to use this value when telling clients how to connect to this cache server. This is useful in the case where the cache server may refer to itself with one hostname, but the clients need to use a different hostname to find the cache server.
The value ""
causes the bind-address
to be given to clients.
A null
value will be treated the same as the default ""
.
name
- the ip address or host name that will be given to clients so they can connect to
this cache serverDEFAULT_HOSTNAME_FOR_CLIENTS
@Deprecated void setNotifyBySubscription(boolean b)
b
- whether this cache server should notify clients based on key subscription@Deprecated boolean getNotifyBySubscription()
void setSocketBufferSize(int socketBufferSize)
CacheServer
. The
default is 32768 bytes.socketBufferSize
- The size in bytes of the socket bufferint getSocketBufferSize()
CacheServer
.
The default is 32768 bytes.CacheServer
void setMaximumTimeBetweenPings(int maximumTimeBetweenPings)
ClientHealthMonitor
to determine the health of this CacheServer
's
clients. The default is 60000 ms.maximumTimeBetweenPings
- The maximum amount of time between client pingsint getMaximumTimeBetweenPings()
ClientHealthMonitor
to determine the health of this CacheServer
's
clients. The default is 60000 ms.void start() throws IOException
IOException
- If an error occurs while starting the cache serverboolean isRunning()
void stop()
CacheServer
can be reconfigured and
restarted if desired.int getMaxConnections()
void setMaxConnections(int maxCons)
maxCons
- the maximum number of client connections allowedDEFAULT_MAX_CONNECTIONS
int getMaxThreads()
0
causes the cache server to dedicate a thread for every client
connection.void setMaxThreads(int maxThreads)
0
causes the cache server to dedicate a thread for every client
connection.maxThreads
- the maximum number of threads allowed in this cache server to service client
requestsDEFAULT_MAX_THREADS
int getMaximumMessageCount()
void setMaximumMessageCount(int maxMessageCount)
maxMessageCount
- the maximum number of messages that can be enqueued in a client-queueDEFAULT_MAXIMUM_MESSAGE_COUNT
int getMessageTimeToLive()
void setMessageTimeToLive(int messageTimeToLive)
messageTimeToLive
- the time (in seconds ) after which a message in the client queue will
expireDEFAULT_MESSAGE_TIME_TO_LIVE
@Deprecated void setGroups(String[] groups)
groups
- possibly empty array of String
where each string is a server groups
that this cache server will be a member of.DEFAULT_GROUPS
@Deprecated String[] getGroups()
String
s where each string is a server group.
Modifying this array will not change the server groups that this cache server belongs
to.ServerLoadProbe getLoadProbe()
ServerLoadProbe
for details on the load
probe.void setLoadProbe(ServerLoadProbe loadProbe)
ServerLoadProbe
for details on how to
implement a load probe.loadProbe
- the load probe to use for this cache server.long getLoadPollInterval()
void setLoadPollInterval(long loadPollInterval)
loadPollInterval
- the frequency in milliseconds to poll the load probe. Must be greater
than 0.boolean getTcpNoDelay()
void setTcpNoDelay(boolean noDelay)
noDelay
- if false, sets tcp-no-delay to false on out-going connectionsClientSubscriptionConfig getClientSubscriptionConfig()
ClientSubscriptionConfig
for details on the client subscription configuration.ClientSession getClientSession(DistributedMember member)
ClientSession
associated with the DistributedMember
member
- a DistributedMember
ClientSession
associated with the DistributedMember
ClientSession getClientSession(String durableClientId)
ClientSession
associated with the durable client iddurableClientId
- a durable client idClientSession
associated with the durableSet<ClientSession> getAllClientSessions()
ClientSession
sClientSession
svoid registerInterestRegistrationListener(InterestRegistrationListener listener)
InterestRegistrationListener
with the set of
InterestRegistrationListener
s.listener
- The InterestRegistrationListener
to registervoid unregisterInterestRegistrationListener(InterestRegistrationListener listener)
InterestRegistrationListener
from the set of
InterestRegistrationListener
s.listener
- The InterestRegistrationListener
to unregisterSet<InterestRegistrationListener> getInterestRegistrationListeners()
InterestRegistrationListener
s registered with this
notifier.InterestRegistrationListener
s registered with this
notifier