Example usage for org.springframework.data.gemfire.client Interest getKey

List of usage examples for org.springframework.data.gemfire.client Interest getKey

Introduction

In this page you can find the example usage for org.springframework.data.gemfire.client Interest getKey.

Prototype

public K getKey() 

Source Link

Document

Returns the key on which interest is registered.

Usage

From source file:org.springframework.data.gemfire.client.ClientRegionFactoryBean.java

protected void postProcess(Region<K, V> region) {
    if (!ObjectUtils.isEmpty(interests)) {
        for (Interest<K> interest : interests) {
            if (interest instanceof RegexInterest) {
                // do the cast since it's safe
                region.registerInterestRegex((String) interest.getKey(), interest.getPolicy(),
                        interest.isDurable(), interest.isReceiveValues());
            } else {
                region.registerInterest(interest.getKey(), interest.getPolicy(), interest.isDurable(),
                        interest.isReceiveValues());
            }/*  ww  w .  j ava2 s . c  o  m*/
        }
    }
}

From source file:org.springframework.data.gemfire.client.ClientRegionFactoryBean.java

public void destroy() throws Exception {
    Region<K, V> region = getObject();
    // unregister interests
    try {/*from ww  w .jav  a 2 s  .  c  om*/
        if (region != null && !ObjectUtils.isEmpty(interests)) {
            for (Interest<K> interest : interests) {
                if (interest instanceof RegexInterest) {
                    region.unregisterInterestRegex((String) interest.getKey());
                } else {
                    region.unregisterInterest(interest.getKey());
                }
            }
        }
        // should not really happen since interests are validated at start/registration
    } catch (UnsupportedOperationException ex) {
        log.warn("Cannot unregister cache interests", ex);
    }

    if (region != null) {
        if (close) {
            if (!region.getCache().isClosed()) {
                try {
                    region.close();
                } catch (CacheClosedException cce) {
                    // nothing to see folks, move on.
                }
            }
        } else if (destroy) {
            region.destroyRegion();
        }
    }
    region = null;
}