public interface ClientSession
ClientSession
represents a client connection on the server.
ClientSessions
can be used from the cache server to perform interest registrations
and unregistrations on behalf of clients. ClientSessions
are only available on the
cache server.
The ClientSession is often used in conjunction with a callback EntryEvent
as shown
below.
String durableClientId = ...; // Some part of the event's key or value would contain this id Cache cache = CacheFactory.getAnyInstance(); CacheServer cacheServer = (CacheServer) cache.getCacheServers().iterator().next(); ClientSession clientSession = cacheServer.getClientSession(durableClientId); clientSession.registerInterest(event.getRegion().getFullPath(), event.getKey(), InterestResultPolicy.KEYS_VALUES, true);
getClientSession
,
getClientSession
Modifier and Type | Method and Description |
---|---|
boolean |
isPrimary()
Returns whether this server is the primary for this client
|
void |
registerInterest(String regionName,
Object keyOfInterest,
InterestResultPolicy policy,
boolean isDurable)
Registers interest in a particular region and key
|
void |
registerInterest(String regionName,
Object keyOfInterest,
InterestResultPolicy policy,
boolean isDurable,
boolean receiveValues)
Registers interest in a particular region and key
|
void |
registerInterestRegex(String regionName,
String regex,
boolean isDurable)
Registers interest in a particular region and regular expression
|
void |
registerInterestRegex(String regionName,
String regex,
boolean isDurable,
boolean receiveValues)
Registers interest in a particular region and regular expression
|
void |
unregisterInterest(String regionName,
Object keyOfInterest,
boolean isDurable)
Unregisters interest in a particular region and key
|
void |
unregisterInterest(String regionName,
Object keyOfInterest,
boolean isDurable,
boolean receiveValues)
Unregisters interest in a particular region and key
|
void |
unregisterInterestRegex(String regionName,
String regex,
boolean isDurable)
Unregisters interest in a particular region and regular expression
|
void |
unregisterInterestRegex(String regionName,
String regex,
boolean isDurable,
boolean receiveValues)
Unregisters interest in a particular region and regular expression
|
void registerInterest(String regionName, Object keyOfInterest, InterestResultPolicy policy, boolean isDurable)
regionName
- The name of the region in which to register interestkeyOfInterest
- The key on which to register interestpolicy
- The InterestResultPolicy
. Note: For the special
token 'ALL_KEYS' and lists of keys, values are not pushed to the client.isDurable
- Whether the interest is durableIllegalStateException
- if this is not the primary server for the given clientvoid registerInterest(String regionName, Object keyOfInterest, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)
regionName
- The name of the region in which to register interestkeyOfInterest
- The key to on which to register interestpolicy
- The InterestResultPolicy
. Note: For the special
token 'ALL_KEYS' and lists of keys, values are not pushed to the client.isDurable
- Whether the interest is durablereceiveValues
- Whether to receive create or update events as invalidates similar to
notify-by-subscription false. The default is true.IllegalStateException
- if this is not the primary server for the given clientvoid registerInterestRegex(String regionName, String regex, boolean isDurable)
regionName
- The name of the region in which to register interestregex
- The regular expression on which to register interestisDurable
- Whether the interest is durableIllegalStateException
- if this is not the primary server for the given clientvoid registerInterestRegex(String regionName, String regex, boolean isDurable, boolean receiveValues)
regionName
- The name of the region in which to register interestregex
- The regular expression to on which to register interestisDurable
- Whether the interest is durablereceiveValues
- Whether to receive create or update events as invalidates similar to
notify-by-subscription false. The default is true.IllegalStateException
- if this is not the primary server for the given clientvoid unregisterInterest(String regionName, Object keyOfInterest, boolean isDurable)
regionName
- The name of the region in which to unregister interestkeyOfInterest
- The key on which to unregister interestisDurable
- Whether the interest is durableIllegalStateException
- if this is not the primary server for the given clientvoid unregisterInterest(String regionName, Object keyOfInterest, boolean isDurable, boolean receiveValues)
regionName
- The name of the region in which to unregister interestkeyOfInterest
- The key on which to unregister interestisDurable
- Whether the interest is durablereceiveValues
- Whether to receive create or update events as invalidates similar to
notify-by-subscription false. The default is true.IllegalStateException
- if this is not the primary server for the given clientvoid unregisterInterestRegex(String regionName, String regex, boolean isDurable)
regionName
- The name of the region in which to unregister interestregex
- The regular expression on which to unregister interestisDurable
- Whether the interest is durableIllegalStateException
- if this is not the primary server for the given clientvoid unregisterInterestRegex(String regionName, String regex, boolean isDurable, boolean receiveValues)
regionName
- The name of the region in which to unregister interestregex
- The regular expression on which to unregister interestisDurable
- Whether the interest is durablereceiveValues
- Whether to receive create or update events as invalidates similar to
notify-by-subscription false. The default is true.IllegalStateException
- if this is not the primary server for the given clientboolean isPrimary()