GemFire 7.0.1

com.gemstone.gemfire.cache
Interface ClientSession


public interface ClientSession

Class 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);
 

Since:
6.0
See Also:
getClientSession, getClientSession
Note: Early Access. Please consult GemStone technical support for assistance with this functionality.

Method Summary
 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
 

Method Detail

registerInterest

void registerInterest(String regionName,
                      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 interest
keyOfInterest - The key on which to register interest
policy - 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 durable
Throws:
IllegalStateException - if this is not the primary server for the given client

registerInterest

void registerInterest(String regionName,
                      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 interest
keyOfInterest - The key to on which to register interest
policy - 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 durable
receiveValues - Whether to receive create or update events as invalidates similar to notify-by-subscription false. The default is true.
Throws:
IllegalStateException - if this is not the primary server for the given client
Since:
6.5

registerInterestRegex

void registerInterestRegex(String regionName,
                           String regex,
                           boolean isDurable)
Registers interest in a particular region and regular expression

Parameters:
regionName - The name of the region in which to register interest
regex - The regular expression on which to register interest
isDurable - Whether the interest is durable
Throws:
IllegalStateException - if this is not the primary server for the given client

registerInterestRegex

void registerInterestRegex(String regionName,
                           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 interest
regex - The regular expression to on which to register interest
isDurable - Whether the interest is durable
receiveValues - Whether to receive create or update events as invalidates similar to notify-by-subscription false. The default is true.
Throws:
IllegalStateException - if this is not the primary server for the given client
Since:
6.5

unregisterInterest

void unregisterInterest(String regionName,
                        Object keyOfInterest,
                        boolean isDurable)
Unregisters interest in a particular region and key

Parameters:
regionName - The name of the region in which to unregister interest
keyOfInterest - The key on which to unregister interest
isDurable - Whether the interest is durable
Throws:
IllegalStateException - if this is not the primary server for the given client

unregisterInterest

void unregisterInterest(String regionName,
                        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 interest
keyOfInterest - The key on which to unregister interest
isDurable - Whether the interest is durable
receiveValues - Whether to receive create or update events as invalidates similar to notify-by-subscription false. The default is true.
Throws:
IllegalStateException - if this is not the primary server for the given client
Since:
6.5

unregisterInterestRegex

void unregisterInterestRegex(String regionName,
                             String regex,
                             boolean isDurable)
Unregisters interest in a particular region and regular expression

Parameters:
regionName - The name of the region in which to unregister interest
regex - The regular expression on which to unregister interest
isDurable - Whether the interest is durable
Throws:
IllegalStateException - if this is not the primary server for the given client

unregisterInterestRegex

void unregisterInterestRegex(String regionName,
                             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 interest
regex - The regular expression on which to unregister interest
isDurable - Whether the interest is durable
receiveValues - Whether to receive create or update events as invalidates similar to notify-by-subscription false. The default is true.
Throws:
IllegalStateException - if this is not the primary server for the given client
Since:
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

GemFire 7.0.1

Copyright © 1997-2013 VMware, Inc. All rights reserved.