You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/05/07 03:19:19 UTC

[GitHub] [skywalking] Allen0710 opened a new issue #2616: lettuce thorw npe

Allen0710 opened a new issue #2616: lettuce thorw npe
URL: https://github.com/apache/skywalking/issues/2616
 
 
   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [1 ] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - if i use spring data redis and lettuce client, thorw npe
   
   ___
   ### Bug
   - Which version of SkyWalking, OS and JRE?
   SkyWalking:6.1.0, os:linux, JRE:1.8
   - Which company or project?
   
   - What happen?
   If possible, provide a way for reproducing the error. e.g. demo application, component version.
   StringRedisTemplate template = new StringRedisTemplate();
           template.setConnectionFactory(
                   RedisConnectionFactoryUtil.lettuceRedisConnectionFactory(redisProperties.getBizClusterNode(),
                           redisProperties.getBizCommandTimeout(),
                           redisProperties.getBizMaxTotalNum(),
                           redisProperties.getBizMaxIdleNum(),
                           redisProperties.getBizMinTotalNum()));
           return template;
   
   public static RedisConnectionFactory lettuceRedisConnectionFactory(String cluster, int timeout, int maxActive, int
               maxIdle, int minIdle) {
           JedisPoolConfig config = new JedisPoolConfig();
           config.setMaxTotal(maxActive);
           config.setMaxIdle(maxIdle);
           config.setMinIdle(minIdle);
           config.setMaxWaitMillis(2000);
           config.setTestWhileIdle(true);
           config.setTimeBetweenEvictionRunsMillis(DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS);
   
           LettuceClientConfiguration.LettuceClientConfigurationBuilder builder = LettucePoolingClientConfiguration
                   .builder().poolConfig(config).readFrom(ReadFrom.SLAVE_PREFERRED);
           ClusterTopologyRefreshOptions
                   topologyRefreshOptions = ClusterTopologyRefreshOptions.builder().enablePeriodicRefresh().build();
           LettuceClientConfiguration clientConfig = builder.readFrom(ReadFrom.SLAVE_PREFERRED).clientOptions
                   (ClusterClientOptions.builder()
                           .autoReconnect(true).socketOptions(
                                   SocketOptions.builder().keepAlive(true).tcpNoDelay(true).connectTimeout(Duration.ofSeconds(5)).build()
                           ).topologyRefreshOptions(topologyRefreshOptions).build())
                   .commandTimeout(Duration.ofMillis(timeout)).shutdownTimeout(Duration.ofMillis(100)).build();
           RedisClusterConfiguration clusterConfiguration = new RedisClusterConfiguration(Arrays.asList(cluster));
           clusterConfiguration.setMaxRedirects(10);
           LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(clusterConfiguration, clientConfig);
           connectionFactory.afterPropertiesSet();
           return connectionFactory;
       }
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services