Examples of JedisPoolConfig


Examples of redis.clients.jedis.JedisPoolConfig

        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        pool = new JedisPool(new JedisPoolConfig(), "localhost");
        MainFrame mf = MainFrame.getInstance();
        mf.setVisible(true);
        Window.switchPanel(new Home());
    }
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

        }
        JedisShardInfo shardInfo = new JedisShardInfo(host, port, timeout);
        if (StrKit.notBlank(password)) {
            shardInfo.setPassword(password);
        }
        JedisPoolConfig poolConfig = new JedisPoolConfig();
        setPoolConfig(poolConfig);
        pool = new JedisPool(poolConfig, shardInfo.getHost(), shardInfo.getPort(), shardInfo.getTimeout(),
                shardInfo.getPassword());
        JedisKit.init(pool);
        return true;
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

public class RedisModule extends AbstractPersistenceModule {
  private final JedisPoolConfig config;
  private final String host;

  public RedisModule() {
    this(null, new JedisPoolConfig(), "localhost");
  }
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

    assertEquals("Jason", saver.find());
  }

//  @Test
  public final void storeAndRetrieveWithRedisUrl() {
    RedisModule redisModule = new RedisModule(new JedisPoolConfig(), "redis://localhost:6379");
    RedisSaver saver = Guice.createInjector(redisModule, new PersistAopModule(redisModule))
        .getInstance(RedisSaver.class);

    saver.make();
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

    }
  }

//  @Test
  public final void storeAndRetrieveTransactional() {
    RedisModule redisModuleOne = new RedisModule(StoreOne.class, new JedisPoolConfig(), "localhost");
    RedisModule redisModuleTwo = new RedisModule(StoreTwo.class, new JedisPoolConfig(), "localhost:6380");
    RedisTransactionalSaver saver = Guice.createInjector(redisModuleOne, redisModuleTwo,
        new PersistAopModule(redisModuleOne),
        new PersistAopModule(redisModuleTwo))
        .getInstance(RedisTransactionalSaver.class);
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

    assertEquals("Maxine", saver.findTwo());
  }

//  @Test
  public final void storeAndRetrieveWithoutAop() {
    JedisPoolConfig configOne = new JedisPoolConfig();

    Injector injector = Guice.createInjector(
        new RedisModule(StoreOne.class, configOne, "localhost"),
        new RedisModule(StoreTwo.class, new JedisPoolConfig(), "localhost:6380"));

    Persister persisterOne = injector
        .getInstance(Key.get(Persister.class, StoreOne.class));

    Persister persisterTwo = injector
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

            jedisPool.returnResource(jedis);
        }
    }

    public void init() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        // TODO optional parameterization
        jedisPool = new JedisPool(jedisPoolConfig, redisHost, redisPort);
    }
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

    private JedisPoolUtil() {
    }

    public static JedisPoolConfig createJedisPoolConfig() {
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxTotal(MAX_ACTIVE);
        config.setMaxIdle(MAX_IDLE);
        config.setMaxWaitMillis(MAX_WAIT);
        config.setTestOnBorrow(TEST_ON_BORROW);
        config.setTestOnReturn(TEST_ON_RETURN);
        return config;
    }
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

    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));
  }
View Full Code Here

Examples of redis.clients.jedis.JedisPoolConfig

  private int database = Protocol.DEFAULT_DATABASE;

  private int maxTotal = 500;

  public JedisPool build() {
    JedisPoolConfig config = new JedisPoolConfig();
    config.setMaxTotal(maxTotal);

    return new JedisPool(config, host, port, timeout, StringUtils.trimToNull(password), database);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.