Example usage for org.springframework.data.gemfire.config.xml GemfireConstants DEFAULT_GEMFIRE_POOL_NAME

List of usage examples for org.springframework.data.gemfire.config.xml GemfireConstants DEFAULT_GEMFIRE_POOL_NAME

Introduction

In this page you can find the example usage for org.springframework.data.gemfire.config.xml GemfireConstants DEFAULT_GEMFIRE_POOL_NAME.

Prototype

String DEFAULT_GEMFIRE_POOL_NAME

To view the source code for org.springframework.data.gemfire.config.xml GemfireConstants DEFAULT_GEMFIRE_POOL_NAME.

Click Source Link

Usage

From source file:sample.GemFireClientServerReadyBeanPostProcessor.java

@SuppressWarnings("all")
private void validateCacheClientSubscriptionQueueConnectionEstablished() throws InterruptedException {
    boolean cacheClientSubscriptionQueueConnectionEstablished = false;

    Pool pool = defaultIfNull(this.gemfirePool.get(), GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME,
            GEMFIRE_DEFAULT_POOL_NAME);// ww w.java 2  s  . c  o m

    if (pool instanceof PoolImpl) {
        long timeout = (System.currentTimeMillis() + DEFAULT_TIMEOUT);

        while (System.currentTimeMillis() < timeout && !((PoolImpl) pool).isPrimaryUpdaterAlive()) {

            synchronized (pool) {
                TimeUnit.MILLISECONDS.timedWait(pool, 500L);
            }

        }

        cacheClientSubscriptionQueueConnectionEstablished |= ((PoolImpl) pool).isPrimaryUpdaterAlive();
    }

    Assert.state(cacheClientSubscriptionQueueConnectionEstablished,
            String.format(
                    "Cache client subscription queue connection not established; GemFire Pool was [%s];"
                            + " GemFire Pool configuration was [locators = %s, servers = %s]",
                    pool, pool.getLocators(), pool.getServers()));
}

From source file:org.springframework.data.gemfire.config.xml.GemfireDataSourceParser.java

/**
 * {@inheritDoc}// w w w  .ja  va 2 s .c o m
 */
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
    BeanDefinition clientCacheDefinition = new ClientCacheParser().parse(element, parserContext);

    parserContext.getRegistry().registerBeanDefinition(GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME,
            clientCacheDefinition);

    BeanDefinition poolDefinition = new PoolParser().parse(element, parserContext);

    MutablePropertyValues poolProperties = poolDefinition.getPropertyValues();

    if (!element.hasAttribute(SUBSCRIPTION_ENABLED_ATTRIBUTE_NAME)) {
        poolProperties.add(SUBSCRIPTION_ENABLED_PROPERTY_NAME, true);
    }

    parserContext.getRegistry().registerBeanDefinition(GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME,
            poolDefinition);

    if (log.isDebugEnabled()) {
        log.debug(String.format("Registered GemFire ClientCache bean [%1$s] of type [%2$s]%n",
                GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME, clientCacheDefinition.getBeanClassName()));
    }

    BeanDefinitionBuilder builder = BeanDefinitionBuilder
            .genericBeanDefinition(GemfireDataSourcePostProcessor.class);

    builder.addConstructorArgReference(GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME);

    BeanDefinitionReaderUtils.registerWithGeneratedName(builder.getBeanDefinition(),
            parserContext.getRegistry());

    return null;
}