- 博客(18)
- 收藏
- 关注
原创 1:两数之和
大整数加法:public int[] twoSum(int[] nums, int target) {Map<Integer,Integer> map = new HashMap<>();int[] result = new int[2];for (int i = 0; i < nums.length; i++) {if(map.containsKey(target - nums[i])){ //需要看有没有在map中。result[0] = i;result..
2022-08-10 14:48:18
160
原创 sentinel学习(6)——源码阅读----LogSlot.entry()
这个Slot的作用主要记录日志:@Override public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode obj, int count, boolean prioritized, Object... args) throws Throwable { try { fireEntry(context, resourceWrapper, obj
2022-03-31 23:15:32
157
原创 sentinel学习(5)——源码阅读----ClusterBuilderSlot.entry()(完)
这个的作用是什么?猜测:主要是构建集群的节点,并赋值给 当前节点的属性 node.setClusterNode(clusterNode);后续有可能会用到。public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode node, int count, boolean prioritized, Object... args) throws Thro
2022-03-31 23:11:50
115
原创 记一次redis操作在SessionCallback中开启事务operations.opsForValue().get(key)获取不到值的问题
BUG代码场景:String key ="ceshi1"; String newValue = "6"; String oldValue = "7"; //这里是能取到值的 String s = redisOperator.get(key); System.out.println(s); SessionCallback<List<Object>> sessionCallback = n
2022-03-16 22:36:51
1710
1
原创 sentinel学习(3)——源码阅读----NodeSelectorSlot.entry()(完)
1:这个slot的作用是什么?public void entry(Context context, ResourceWrapper resourceWrapper, Object obj, int count, boolean prioritized, Object... args) throws Throwable { DefaultNode node = map.get(context.getName()); if (node == n
2022-02-14 20:11:37
252
原创 sentinel学习(3)——源码阅读----SentinelWebInterceptor(完)
1:看下这个类实现了哪些接口跟类。关系...
2022-01-27 21:24:56
875
原创 sentinel学习(2)——源码阅读----SentinelWebAutoConfiguration
0:问题:sentinel是怎么拦截并进行限流,熔断,降级的。1:找自动配置类: 老规矩:直接搜索 spring.factories 文件,查询关键字 SentinelAuto,配置如下:com.alibaba.cloud.sentinel.SentinelWebAutoConfiguration,\com.alibaba.cloud.sentinel.SentinelWebFluxAutoConfiguration,\com.alibaba.cloud.sentinel.endpoint.S
2022-01-26 22:56:21
1364
原创 gateway学习——转发的过程 源码解读(4)完
问题:访问gateway的地址:localhost:8080/spring-nacos/user/info是如何转发到 localhost:8081/spring-nacos/user/info 项目的DispatcherHandler类就是gateway的请求入口,(怎么知道这是入口,大概是:http请求——>netty线程模型,处理read事件——>然后调用DispatcherHandler.hanlder方法。这一块没去研究,百度到的)。DispatcherHandler先介绍
2022-01-11 22:35:06
899
原创 gateway学习——源码解读3——之GatewayAutoConfiguration
GatewayAutoConfiguration:先粗略熟悉一部分相关的Bean的功能,对于后续的 源码整体流程阅读 会有一定的帮助,个人习惯。/** * @author Spencer Gibb * @author Ziemowit Stolarczyk */@Configuration(proxyBeanMethods = false)@ConditionalOnProperty(name = "spring.cloud.gateway.enabled", matchIfMissing
2022-01-10 23:24:49
914
原创 gateway学习——更多配置使用解读(2)
翻译至-官方文档:https://docs.spring.io/spring-cloud-gateway/docs/current/reference/html/#gateway-request-predicates-factories1:gateway的路由匹配:配置说明:spring: cloud: gateway: routes: - id: payment_routh #payment_routh #路由的ID,没有固定规则但要求唯一,简易配合服
2022-01-09 18:22:01
667
原创 gateway学习——基础使用(1)
1:gateway项目配置:pom.xml配置 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> <exclusions> <exclusion>
2022-01-09 17:06:41
609
转载 JAVA日志MDC追踪快速定位问题源头(转发)
https://blog.youkuaiyun.com/a183400826/article/details/101519219
2021-11-11 11:07:04
252
原创 @RefreshScope
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录前言一、@RefreshScope基础使用。二、@RefreshScope原理解析前言学习使用@RefreshScope注解,理解其原理提示:以下是本篇文章正文内容,一、@RefreshScope基础使用。基础使用方法这里不做介绍二、@RefreshScope原理解析转载该文章,写的很详细,向大佬学习http://www.jiagouc.com/refreshscope-detail/...
2021-11-10 18:56:45
345
原创 springboot整合nacos-config-源码分析3
上一篇讲了 spring-boot跟nacos-config整合的相关逻辑。(相当于前期准备工作)这里开始从springboot启动开始,看看nacos-config是怎么参与到springboot中的。springboot启动流程(只讲跟nacos-config相关的)1:SpringApplication.run()2:prepareContext该方法的applyInitializers()会去遍历ApplicationContextInitializer的实现类其中有一个类:Proper
2021-11-09 19:02:24
620
原创 springboot整合nacos-config-源码分析2
带着问题去读源码:问题1:springboot跟nacos-config是怎么整合的(主要关心:是用到了spring中的哪些扩展点)问题2:nacos-config是如何从服务器拉取配置的(怎么生成dataId,为何在application.yml中配置nacos.config的配置却无法生效)问题3:使用@RefreshScope注解以后,为什么会实时的拉取数据。1:springboot跟nacos-config的整合:整体大概思路:a:引入spring-cloud-starter-aliba
2021-11-09 15:20:23
976
原创 springboot整合nacos-config-源码分析1(基础使用)
1:springboot的整合:pom文件配置:父模块配置 <properties> <java.version>1.8</java.version> <spring-boot.version>2.2.6.RELEASE</spring-boot.version> <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
2021-11-09 11:28:53
392
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人