VMware GemFire Java API Reference
Package org.apache.geode.cache
Interface ClientSession
-
public interface ClientSessionClassClientSessionrepresents a client connection on the server.ClientSessionscan be used from the cache server to perform interest registrations and unregistrations on behalf of clients.ClientSessionsare only available on the cache server.The ClientSession is often used in conjunction with a callback
EntryEventas 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);
- Since:
- GemFire 6.0
- See Also:
getClientSession,getClientSession
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisPrimary()Returns whether this server is the primary for this clientvoidregisterInterest(java.lang.String regionName, java.lang.Object keyOfInterest, InterestResultPolicy policy, boolean isDurable)Registers interest in a particular region and keyvoidregisterInterest(java.lang.String regionName, java.lang.Object keyOfInterest, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Registers interest in a particular region and keyvoidregisterInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable)Registers interest in a particular region and regular expressionvoidregisterInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable, boolean receiveValues)Registers interest in a particular region and regular expressionvoidunregisterInterest(java.lang.String regionName, java.lang.Object keyOfInterest, boolean isDurable)Unregisters interest in a particular region and keyvoidunregisterInterest(java.lang.String regionName, java.lang.Object keyOfInterest, boolean isDurable, boolean receiveValues)Unregisters interest in a particular region and keyvoidunregisterInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable)Unregisters interest in a particular region and regular expressionvoidunregisterInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable, boolean receiveValues)Unregisters interest in a particular region and regular expression
-
-
-
Method Detail
-
registerInterest
void registerInterest(java.lang.String regionName, java.lang.Object keyOfInterest, InterestResultPolicy policy, boolean isDurable)Registers interest in a particular region and key- Parameters:
regionName- The name of the region in which to register interestkeyOfInterest- The key on which to register interestpolicy- TheInterestResultPolicy. Note: For the special token 'ALL_KEYS' and lists of keys, values are not pushed to the client.isDurable- Whether the interest is durable- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client
-
registerInterest
void registerInterest(java.lang.String regionName, java.lang.Object keyOfInterest, InterestResultPolicy policy, boolean isDurable, boolean receiveValues)Registers interest in a particular region and key- Parameters:
regionName- The name of the region in which to register interestkeyOfInterest- The key to on which to register interestpolicy- TheInterestResultPolicy. 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.- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client- Since:
- GemFire 6.5
-
registerInterestRegex
void registerInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable)Registers interest in a particular region and regular expression- Parameters:
regionName- The name of the region in which to register interestregex- The regular expression on which to register interestisDurable- Whether the interest is durable- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client
-
registerInterestRegex
void registerInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable, boolean receiveValues)Registers interest in a particular region and regular expression- Parameters:
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.- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client- Since:
- GemFire 6.5
-
unregisterInterest
void unregisterInterest(java.lang.String regionName, java.lang.Object keyOfInterest, boolean isDurable)Unregisters interest in a particular region and key- Parameters:
regionName- The name of the region in which to unregister interestkeyOfInterest- The key on which to unregister interestisDurable- Whether the interest is durable- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client
-
unregisterInterest
void unregisterInterest(java.lang.String regionName, java.lang.Object keyOfInterest, boolean isDurable, boolean receiveValues)Unregisters interest in a particular region and key- Parameters:
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.- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client- Since:
- GemFire 6.5
-
unregisterInterestRegex
void unregisterInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable)Unregisters interest in a particular region and regular expression- Parameters:
regionName- The name of the region in which to unregister interestregex- The regular expression on which to unregister interestisDurable- Whether the interest is durable- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client
-
unregisterInterestRegex
void unregisterInterestRegex(java.lang.String regionName, java.lang.String regex, boolean isDurable, boolean receiveValues)Unregisters interest in a particular region and regular expression- Parameters:
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.- Throws:
java.lang.IllegalStateException- if this is not the primary server for the given client- Since:
- GemFire 6.5
-
isPrimary
boolean isPrimary()
Returns whether this server is the primary for this client- Returns:
- whether this server is the primary for this client
-
-