Example usage for org.springframework.data.gemfire.client PoolFactoryBean PoolFactoryBean

List of usage examples for org.springframework.data.gemfire.client PoolFactoryBean PoolFactoryBean

Introduction

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

Prototype

PoolFactoryBean

Source Link

Usage

From source file:com.acmemotors.gf.Main.java

@Bean
PoolFactoryBean poolFactoryBean(@Value("${gf.server.port}") int serverPort,
        @Value("${gf.server.host}") String host) throws Exception {
    PoolFactoryBean factoryBean = new PoolFactoryBean();
    factoryBean.setName("my-pool");
    factoryBean.setServers(Collections.singletonList(new InetSocketAddress(host, serverPort)));
    factoryBean.afterPropertiesSet();/*from   w w  w . j  av a2 s. c  o  m*/
    return factoryBean;
}

From source file:com.acmemotors.rest.Main.java

@Bean
PoolFactoryBean poolFactoryBean(@Value("${gf.server.port}") int serverPort,
        @Value("${gf.server.host}") String serverHost) throws Exception {
    PoolFactoryBean factoryBean = new PoolFactoryBean();
    factoryBean.setName("my-pool");
    factoryBean.setServers(Collections.singletonList(new InetSocketAddress(serverHost, serverPort)));
    factoryBean.afterPropertiesSet();//from   w  ww . j  a va 2s.  com
    return factoryBean;
}

From source file:org.spring.data.gemfire.app.main.SpringGemFireClient.java

@Bean
PoolFactoryBean gemfirePool(@Value("${gemfire.client.server.host:localhost}") String serverHost,
        @Value("${gemfire.client.server.port:40404}") int serverPort,
        @Value("${gemfire.client.server.max-connections:50}") int maxConnections) {
    PoolFactoryBean gemfirePool = new PoolFactoryBean();

    gemfirePool.setFreeConnectionTimeout(intValue(TimeUnit.SECONDS.toMillis(30)));
    gemfirePool.setIdleTimeout(TimeUnit.MINUTES.toMillis(2));
    gemfirePool.setKeepAlive(false);/*from  w  ww  .  ja  v  a2s  .  c  o m*/
    gemfirePool.setMaxConnections(maxConnections);
    gemfirePool.setPingInterval(TimeUnit.SECONDS.toMillis(15));
    gemfirePool.setReadTimeout(intValue(TimeUnit.SECONDS.toMillis(20)));
    gemfirePool.setRetryAttempts(1);
    gemfirePool.setPrSingleHopEnabled(true);
    gemfirePool.setThreadLocalConnections(false);

    gemfirePool.addServers(new ConnectionEndpoint(serverHost, serverPort));

    return gemfirePool;
}

From source file:sample.ClientConfig.java

@Bean
PoolFactoryBean gemfirePool(// <3>
        @Value("${spring.session.data.gemfire.port:" + ServerConfig.SERVER_PORT + "}") int port) {

    PoolFactoryBean poolFactory = new PoolFactoryBean();

    poolFactory.setFreeConnectionTimeout(5000); // 5 seconds
    poolFactory.setKeepAlive(false);//from  ww  w .  j  a v  a 2s.co m
    poolFactory.setMaxConnections(ServerConfig.MAX_CONNECTIONS);
    poolFactory.setPingInterval(TimeUnit.SECONDS.toMillis(5));
    poolFactory.setReadTimeout(2000); // 2 seconds
    poolFactory.setRetryAttempts(2);
    poolFactory.setSubscriptionEnabled(true);
    poolFactory.setThreadLocalConnections(false);

    poolFactory
            .setServers(Collections.singletonList(new ConnectionEndpoint(ServerConfig.SERVER_HOSTNAME, port)));

    return poolFactory;
}

From source file:sample.client.Application.java

@Bean
PoolFactoryBean gemfirePool(@Value("${gemfire.cache.server.host:localhost}") String host,
        @Value("${gemfire.cache.server.port:12480}") int port) { // <4>

    PoolFactoryBean gemfirePool = new PoolFactoryBean();

    gemfirePool.setMaxConnections(MAX_CONNECTIONS);
    gemfirePool.setPingInterval(TimeUnit.SECONDS.toMillis(15));
    gemfirePool.setRetryAttempts(1);/*from  w  w w  .j a  v  a 2  s  .  c o m*/
    gemfirePool.setSubscriptionEnabled(true);
    gemfirePool.setServerEndpoints(Collections.singleton(newConnectionEndpoint(host, port)));

    return gemfirePool;
}