SpringBoot中使用redis事务

}

启动后,我们使用RestClient发送请求http://localhost:8080/put,发送8次之后就会发现没有返回了。这个时候我们查看redis的链接数,发现已经超过8个,springboot对于jedis连接池默认的最大活跃连接数是8,所以看出来是连接池被耗光了。

127.0.0.1:6379> info clients

Clients

connected_clients:9

client_longest_output_list:0

client_biggest_input_buf:0

blocked_clients:0

127.0.0.1:6379>

还有查看程序的日志可以发现,RedisConnectionUtils只有Opening RedisConnection而没有close。

2018-08-11 11:00:48.889 [DEBUG][http-nio-8080-exec-8]😮.s.data.redis.core.RedisConnectionUtils [doGetConnection:126] Opening RedisConnection

2018-08-11 11:00:50.169 [DEBUG][http-nio-8080-exec-8]😮.s.w.s.m.m.a.RequestResponseBodyMethodProcessor [writeWithMessageConverters:249] Written [success key39] as “text/plain” using [org.springframework.http.converter.StringHttpMessageConverter@766a49c7]

2018-08-11 11:00:50.170 [DEBUG][http-nio-8080-exec-8]:org.springframework.web.servlet.DispatcherServlet [processDispatchResult:1044] Null ModelAndView returned to DispatcherServlet with name ‘dispatcherServlet’: assuming HandlerAdapter completed request handling

2018-08-11 11:00:50.170 [DEBUG][http-nio-8080-exec-8]:org.springframework.web.servlet.DispatcherServlet [processRequest:1000] Successfully completed request

2018-08-11 11:00:50.170 [DEBUG][http-nio-8080-exec-8]😮.s.boot.web.filter.OrderedRequestContextFilter [doFilterInternal:104] Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@c03b2d8

2018-08-11 11:00:53.854 [DEBUG][http-nio-8080-exec-9]😮.s.boot.web.filter.OrderedRequestContextFilter [initContextHolders:114] Bound request context to thread: org.apache.catalina.connector.RequestFacade@c03b2d8

2018-08-11 11:00:53.856 [DEBUG][http-nio-8080-exec-9]:org.springframework.web.servlet.DispatcherServlet [doService:865] DispatcherServlet with name ‘dispatcherServlet’ processing GET request for [/put]

2018-08-11 11:00:53.857 [DEBUG][http-nio-8080-exec-9]😮.s.w.s.m.m.a.RequestMappingHandlerMapping [getHandlerInternal:310] Looking up handler method for path /put

2018-08-11 11:00:53.857 [DEBUG][http-nio-8080-exec-9]😮.s.w.s.m.m.a.RequestMappingHandlerMapping [getHandlerInternal:317] Returning handler method [public java.lang.String com.github.springboot.demo.DemoController.redisSet()]

2018-08-11 11:00:53.858 [DEBUG][http-nio-8080-exec-9]😮.s.b.factory.support.DefaultListableBeanFactory [doGetBean:251] Returning cached instance of singleton bean ‘demoController’

2018-08-11 11:00:53.858 [DEBUG][http-nio-8080-exec-9]:org.springframework.web.servlet.DispatcherServlet [doD

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值