- 博客(20)
- 收藏
- 关注
原创 tomcat小记
Engine, Host, Context, Wrapper的标准实现类在实例化时都会创建StandardPipeline, 并为StandardPipeline初始化一个对应的Valve内嵌tomcat启动过程new Tomcat().start(), 内部会确保Server, Service, Connector的创建, tomcat默认的Server, Service, Container的实现类为Standard开头, 调用server.start(), Server, Service和C.
2021-03-20 10:06:28
65
原创 ForkJoinPool
ForkJoinWorkerThread 构造时, 会注册pool.registerWorker(this) -> 构造WorkerQueue, 放进pool的WorkerQueue[] 数组中 该线程的启动通过pool.signalWork方法 -> tryAddWorker -> createWorker -> 通过ForkJoinWorkerThreadFactory构造, 然后thread.start run方法-> pool.runWorke.
2020-06-03 11:13:02
130
原创 mybatis
mybatis 原理解析 先看mybatis的简单样例代码: DataSource ds = new DataSource(); JdbcTransactionFactory jtf = new JdbcTransactionFactory(); Environment env = new Environment("dev", jtf, ds); Configu...
2019-12-24 21:01:18
119
原创 springmvc 之 RequestCondition
spring RequestMappingHandlerMapping RequestCondition: 校验httpServletRequest 是否匹配对应的HandlerMethod(以RequestMapping提供的信息为依据, 也可以扩展自定义注解提供更多的信息进行匹配) RequestMappingHandlerMapping.getHandler 获取Hand...
2019-10-16 23:18:00
450
原创 spring OAuth2
SpringResourceServerTokenServices->TokenStore->vOAuth2AuthenticationProceessingFilter implemets Filterprotect resources,从请求中获取OAuth2 token,使用token 获取OAuth2Authentication 放入Security context...
2019-08-18 21:45:51
495
原创 java datastructure
ArrayList: 动态数组, 默认的扩容 oldCapacity + (oldCapacity >> 1), 通过System.arraycopy copy数组.AbstractList modCount fail-fast, 对于改变list capacity 的每次操作都会++modCount, 在AbstractList 迭代器迭代过程中如果modCount 发生改变, ...
2019-08-06 14:46:35
368
原创 redis实现分布式锁思路
redis 处理socket ready 事件是单线程执行的, 也就是说redis一次只会处理一个socket, 避免了并发所带来的资源竞争问题, 可以用来实现分布式锁. 具体实现思路: 通过SETNX尝试设值(currentTimestamp + timeout), 如果设置成功, 说明类似获取锁操作成功, 失败则获锁失败. 获锁成功的线程在处理完业务之后要手动释放锁DEL key...
2019-07-31 21:14:55
124
原创 rabbitmq
rabbitmq: exchange, routing, queue 客户端发送消息, 直接发送到exchange, 由exchange转发到符合条件的queue中, 因此要先存在queue, exchange才能发送message到queue. exchange的内置类型有fanout, direct, topic, headers, 参考BuiltinExchange...
2019-07-30 00:04:18
72
原创 red black tree
class RBTree<T extends Comparable<T>> { private RBNode root; public RBTree(RBNode root) { this.root = root; } public RBNode getRoot() { return root; ...
2019-07-29 11:37:11
67
原创 python type object
type是所有类的类型, 类似java中的Class, python中可以通过metaclass 指定新类的类型, object默认是所有类的父类,这个和java类似.python 创建新的类类型需要继承type, class NewClass(type), 并且通过 __new__(cls, name, bases, attrs) 来访问当前类的属性和方法, 以及动态添加(通过attrs 访问...
2019-07-25 16:25:23
139
原创 springboot actuator
WebMvcEndpointHandlerMapping: pulbic WebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes e...
2019-07-08 09:12:57
158
原创 spring cloud 相关
bootstrap application context 在 SpringApplication 的构造函数中通过SpringFactoriesLoader加载spring.factories 中ApplicationContextInitializer 和 ApplicationListener(BootstrapApplicationListener 位于spring-cloud-...
2019-07-05 17:37:39
117
原创 spring 笔记
spring ApplicationContext ApplicationContext extends ListableBeanFactory, HierarchicalBeanFactory, EnvironmentCapable, ResourcePatternLoader, MessageSource, ApplicationContextPublisher Lista...
2019-06-19 00:17:45
124
原创 ThreadPoolExecutor
Executor: execute(Runnable command) 普通的接口, 执行Runnable实现类 包括RunnableFuture 的实现类ExecutorService extends Executor: 多了submit(Callable task), shutdown() 等接口, 可以执行Callable Runnable 类AbstractE...
2019-05-10 17:53:57
78
原创 LinkedBlockingQueue
offer, poll 不会block, offer 时大于capacity插入失败 但线程不会阻塞, add 会抛出异常, poll 无元素时 获取失败 线程也不会阻塞, remove 会抛出异常.put, take 对应的方法会阻塞, offer put 方法都会唤醒 take 线程, poll take 方法也都会唤醒put 线程...
2019-05-08 15:08:11
93
原创 Lock Condition
Condition: include await, awaitUninterruptibly, awaitNanos, awaitUntil, signal, signalAll, correspond to Object wait, notify, notifyAll, but more flex, U can have more controlinvoke condition....
2019-05-08 10:22:14
94
原创 Lock 之ReentrantLock
Lock 只定义了 lock, unlock 的接口, 真正起到线程同步作用的为Sync, AQS 的实现类, 主要分析AQS的原理, lock分为 fairLock, nonfairLockAQS 中维护了state, 是否有线程持有lock, 0: 没有thread 持有锁, 1: thread持有锁, >1: thread 多次获取lock 重入锁, 当lock.lock, 首先尝...
2019-05-08 10:20:42
180
原创 shiro session管理和cache
shiro提供3个默认sessionManager:DefaultSessionManager,ServelteContainerManager,DefaultWebSessionManager,ServeltContainerManager是使用servlet容器的回话,以及servlet容器管理,DefaultSessionManager是DefaultSecurityManger使用
2018-01-06 17:39:17
1308
原创 spring security 个人学习笔记
重要的组件:Authentication(包含principal,authorities),Authority(角色),AuthenticationManager(认证管理),AuthenticationProvider,ProviderManager,UserDetailsService,UserDetails,User,AccessDecisionManager(权限管理),Af...
2018-01-06 17:25:51
346
原创 spring RequestMappingHandlerAdapter解析参数绑定到pojo过程
springmvc 请求参数绑定到javabean源码解析
2017-10-03 15:30:38
5598
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人