Java Code Examples for redis.clients.jedis.Protocol#DEFAULT_TIMEOUT
The following examples show how to use
redis.clients.jedis.Protocol#DEFAULT_TIMEOUT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisConfig.java From springboot-learn with MIT License | 6 votes |
@Bean(name = "jedis.pool") @Autowired public JedisSentinelPool jedisPool(@Qualifier("jedis.pool.config") JedisPoolConfig config, @Value("${spring.redis.sentinel.master}") String clusterName, @Value("${spring.redis.sentinel.nodes}") String sentinelNodes, @Value("${spring.redis.timeout}") int timeout, @Value("${spring.redis.password}") String password) { logger.info("缓存服务器的主服务名称:" + clusterName + ", 主从服务ip&port:" + sentinelNodes); Assert.isTrue(StringUtils.isNotEmpty(clusterName), "主服务名称配置为空"); Assert.isTrue(StringUtils.isNotEmpty(sentinelNodes), "主从服务地址配置为空"); Set<String> sentinels = Sets.newHashSet(StringUtils.split(sentinelNodes, ",")); JedisSentinelPool sentinelJedisPool = new JedisSentinelPool(clusterName, sentinels, config, Protocol.DEFAULT_TIMEOUT, password); return sentinelJedisPool; }
Example 2
Source File: BaseTest.java From quartz-redis-jobstore with Apache License 2.0 | 6 votes |
@Before public void setUpRedis() throws IOException, SchedulerConfigException { port = getPort(); logger.debug("Attempting to start embedded Redis server on port " + port); redisServer = RedisServer.builder() .port(port) .build(); redisServer.start(); final short database = 1; JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setTestOnBorrow(true); jedisPool = new JedisPool(jedisPoolConfig, host, port, Protocol.DEFAULT_TIMEOUT, null, database); jobStore = new RedisJobStore(); jobStore.setHost(host); jobStore.setLockTimeout(2000); jobStore.setPort(port); jobStore.setInstanceId("testJobStore1"); jobStore.setDatabase(database); mockScheduleSignaler = mock(SchedulerSignaler.class); jobStore.initialize(null, mockScheduleSignaler); schema = new RedisJobStoreSchema(); jedis = jedisPool.getResource(); jedis.flushDB(); }
Example 3
Source File: RedisMessenger.java From LuckPerms with MIT License | 6 votes |
public void init(String address, String password, boolean ssl) { String[] addressSplit = address.split(":"); String host = addressSplit[0]; int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : Protocol.DEFAULT_PORT; this.jedisPool = new JedisPool(new JedisPoolConfig(), host, port, Protocol.DEFAULT_TIMEOUT, password, ssl); this.plugin.getBootstrap().getScheduler().executeAsync(() -> { this.sub = new Subscription(this); try (Jedis jedis = this.jedisPool.getResource()) { jedis.subscribe(this.sub, CHANNEL); } catch (Exception e) { e.printStackTrace(); } }); }
Example 4
Source File: RedisSinkFunction.java From alchemy with Apache License 2.0 | 5 votes |
@Override protected Jedis create(RedisProperties redisProperties) { this.pool = new JedisPool( redisProperties.getConfig(), redisProperties.getHost(), redisProperties.getPort(), redisProperties.getTimeout() == null ? Protocol.DEFAULT_TIMEOUT : redisProperties.getTimeout(), redisProperties.getPassword(), redisProperties.getDatabase()); return this.pool.getResource(); }
Example 5
Source File: RedisDataSet.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Override public void testStarted(String distributedHost) { JedisPoolConfig config = new JedisPoolConfig(); config.setMaxActive(getMaxActive()); config.setMaxIdle(getMaxIdle()); config.setMinIdle(getMinIdle()); config.setMaxWait(getMaxWait()); config.setWhenExhaustedAction((byte)getWhenExhaustedAction()); config.setTestOnBorrow(getTestOnBorrow()); config.setTestOnReturn(getTestOnReturn()); config.setTestWhileIdle(getTestWhileIdle()); config.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis()); config.setNumTestsPerEvictionRun(getNumTestsPerEvictionRun()); config.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis()); config.setSoftMinEvictableIdleTimeMillis(getSoftMinEvictableIdleTimeMillis()); int port = Protocol.DEFAULT_PORT; if(!JOrphanUtils.isBlank(this.port)) { port = Integer.parseInt(this.port); } int timeout = Protocol.DEFAULT_TIMEOUT; if(!JOrphanUtils.isBlank(this.timeout)) { timeout = Integer.parseInt(this.timeout); } int database = Protocol.DEFAULT_DATABASE; if(!JOrphanUtils.isBlank(this.database)) { database = Integer.parseInt(this.database); } String password = null; if(!JOrphanUtils.isBlank(this.password)) { password = this.password; } this.pool = new JedisPool(config, this.host, port, timeout, password, database); }
Example 6
Source File: StateConfiguration.java From chaos-lemur with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnProperty("vcap.services.chaos-lemur-persistence.credentials.hostname") JedisPool jedisPool(@Value("${vcap.services.chaos-lemur-persistence.credentials.hostname}") String hostname, @Value("${vcap.services.chaos-lemur-persistence.credentials.port}") Integer port, @Value("${vcap.services.chaos-lemur-persistence.credentials.password}") String password) { return new JedisPool(new JedisPoolConfig(), hostname, port, Protocol.DEFAULT_TIMEOUT, password); }
Example 7
Source File: RedisEntityStoreMixin.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public void activateService() throws Exception { configuration.refresh(); RedisEntityStoreConfiguration config = configuration.get(); String host = config.host().get() == null ? DEFAULT_HOST : config.host().get(); int port = config.port().get() == null ? Protocol.DEFAULT_PORT : config.port().get(); int timeout = config.timeout().get() == null ? Protocol.DEFAULT_TIMEOUT : config.timeout().get(); String password = config.password().get(); int database = config.database().get() == null ? Protocol.DEFAULT_DATABASE : config.database().get(); pool = new JedisPool( new JedisPoolConfig(), host, port, timeout, password, database ); }
Example 8
Source File: DefaultRedisConfiguration.java From spring-redis-plugin with Apache License 2.0 | 5 votes |
@Bean(name = "default", destroyMethod = "destroy") public JedisPool defaultJedisPool() { return new JedisPool(defaultJedisPoolConfig(), env.getProperty("redis.host", "127.0.0.1"), env.getProperty("redis.port", Integer.class, 6379), Protocol.DEFAULT_TIMEOUT, StringUtils.isEmpty(env.getProperty("redis.password")) ? null : env.getProperty("redis.password")); }
Example 9
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 5 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels, final GenericObjectPoolConfig poolConfig) { super(masterName, sentinels, poolConfig, Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE); this.tracingConfiguration = tracingConfiguration; }
Example 10
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 5 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels, final GenericObjectPoolConfig poolConfig) { super(masterName, sentinels, poolConfig, Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE); this.tracingConfiguration = tracingConfiguration; }
Example 11
Source File: JedisConfig.java From springboot-learn with MIT License | 5 votes |
@Bean(name = "jedis.pool") @Autowired public JedisPool jedisPool(@Qualifier("jedis.pool.config") JedisPoolConfig config, @Value("${spring.redis.host}") String host, @Value("${spring.redis.port}") int port, @Value("${spring.redis.timeout}") int timeout, @Value("${spring.redis.password}") String password) { logger.info("缓存服务器的地址:" + host + ":" + port); return new JedisPool(config, host, port, Protocol.DEFAULT_TIMEOUT, password); }
Example 12
Source File: RedisSentinelSinkFunction.java From alchemy with Apache License 2.0 | 5 votes |
@Override protected Jedis create(RedisProperties redisProperties) { Set<String> sentinelset = new HashSet<>(Arrays.asList(redisProperties.getSentinel().getSentinels().split(","))); this.pool = new JedisSentinelPool(redisProperties.getSentinel().getMaster(), sentinelset, redisProperties.getConfig(), redisProperties.getTimeout() == null ? Protocol.DEFAULT_TIMEOUT : redisProperties.getTimeout(), redisProperties.getPassword(), redisProperties.getDatabase()); return this.pool.getResource(); }
Example 13
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 4 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels, final GenericObjectPoolConfig poolConfig, final String password) { super(masterName, sentinels, poolConfig, Protocol.DEFAULT_TIMEOUT, password); this.tracingConfiguration = tracingConfiguration; }
Example 14
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 4 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels) { super(masterName, sentinels, new GenericObjectPoolConfig(), Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE); this.tracingConfiguration = tracingConfiguration; }
Example 15
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 4 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels, String password) { super(masterName, sentinels, new GenericObjectPoolConfig(), Protocol.DEFAULT_TIMEOUT, password); this.tracingConfiguration = tracingConfiguration; }
Example 16
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 4 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels, final GenericObjectPoolConfig poolConfig, final String password) { super(masterName, sentinels, poolConfig, Protocol.DEFAULT_TIMEOUT, password); this.tracingConfiguration = tracingConfiguration; }
Example 17
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 4 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels, String password) { super(masterName, sentinels, new GenericObjectPoolConfig(), Protocol.DEFAULT_TIMEOUT, password); this.tracingConfiguration = tracingConfiguration; }
Example 18
Source File: TracingJedisSentinelPool.java From java-redis-client with Apache License 2.0 | 4 votes |
public TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName, Set<String> sentinels) { super(masterName, sentinels, new GenericObjectPoolConfig(), Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE); this.tracingConfiguration = tracingConfiguration; }
Example 19
Source File: RedisClusterConfig.java From micro-service with MIT License | 4 votes |
private int getTimeout() { return redisProperties.getTimeout() > 0 ? redisProperties.getTimeout() : Protocol.DEFAULT_TIMEOUT; }
Example 20
Source File: JedisConfig.java From blog-sample with Apache License 2.0 | 4 votes |
@Bean public JedisPool jedisPool() { return new JedisPool(new GenericObjectPoolConfig(), STANDALONE_HOST, STANDALONE_PORT, Protocol.DEFAULT_TIMEOUT, STANDALONE_PASSWORD, Protocol.DEFAULT_DATABASE, null); }