String[] parts = host.split(":");
String server = parts[0];
int port = parts.length > 1 ? Integer.valueOf(parts[1]) : 6379;
// Create and set a JedisPoolConfig
JedisPoolConfig poolConfig = new JedisPoolConfig();
// Maximum active connections to Redis instance
poolConfig.setMaxActive(10);
// Tests whether connection is dead when connection
// retrieval method is called
poolConfig.setTestOnBorrow(true);
// Tests whether connection is dead when returning a
// connection to the pool
poolConfig.setTestOnReturn(true);
// Number of connections to Redis that just sit there and do nothing
poolConfig.setMaxIdle(5);
// Minimum number of idle connections to Redis
// These can be seen as always open and ready to serve
poolConfig.setMinIdle(1);
// Tests whether connections are dead during idle periods
poolConfig.setTestWhileIdle(true);
// Maximum number of connections to test in each idle check
poolConfig.setNumTestsPerEvictionRun(10);
// Idle connection checking period
poolConfig.setTimeBetweenEvictionRunsMillis(60000);
// Create the jedisPool
this.pools.put(host, new JedisPool(poolConfig, server, port));
}