Mysterious veil of Java local thread variable ThreadLocal

There should be no one who hasn't used this thing! ThreadLocal Role: thread isolation 1. Methods provided get()set()remove() 2. Used in Java static ThreadLocal<ReqData> threadLocal = new ThreadLocal<ReqData>(){ @Override protected ReqData initialValue() { //Override the initialValue method to return the variabl ...

Added by EviL_CodE on Fri, 10 Dec 2021 05:52:14 +0200

CGLIB Dynamic Proxy

Summary CGLIB is a powerful and high performance code generation library. It is widely used in AOP frameworks (Spring, dynaop) to provide methods for intercepting operations. Hibernate, as a popular ORM framework, also uses CGLIB to proxy one-side (many-to-one and one-to-one) associations (another mechanism for delayed collection extractio ...

Added by LiLaaron on Thu, 09 Dec 2021 19:54:43 +0200

JDK dynamic proxy usage and related source code interpretation

Dynamic agent summary Previously, when implementing static Proxy, you need to define and generate Proxy classes according to the implemented interface. The JDK dynamic Proxy uses the methods in the java.lang.reflect.Proxy class. If you want to generate a class Proxy class, you only need to customize a handler that handles the logic before and ...

Added by RonDahl on Wed, 01 Dec 2021 16:50:01 +0200

Multithreading and threading source code analysis

What is multithreading Multithreading is the smallest unit that the operating system can schedule. It is included in the process and is the actual operation unit of the process. The number of hardware CPU cores corresponds to the number of threads that can be executed at the same time. Specific evolution path IO database interaction, disk br ...

Added by tomo11 on Tue, 30 Nov 2021 17:32:12 +0200

Handwritten spring Chapter 5 - simplify user operations and complete bean container initialization based on xml

preface Through the previous article, we completed the initialization of the bean container, but we can observe that the steps of completing one container initialization are very cumbersome. It's better to inject only a few beans. Once there is a scenario where dozens or hundreds of beans need to be injected, so that users need to add bean ...

Added by dotwebbie on Sat, 20 Nov 2021 07:25:28 +0200

[JDK source code] conditional lock of synchronous series AQS

brief introduction Condition lock refers to a lock that is used when you find that the current business scenario cannot be processed by yourself after obtaining the lock, but you need to wait for a condition to continue processing. Note that the condition here must wait after obtaining the lock. The condition lock corresponding to Reentra ...

Added by brucensal on Wed, 17 Nov 2021 06:03:10 +0200

Spring source code learning -- dependency injection source code analysis

resolveDependency() implementation     The previous article analyzed the working principle and source code of byname (bytype) and @ Autowired annotation in Spring. The @ Autowired annotation depends on injection, in which the injection point injection, whether attribute injection or method injection, has the same method org.springframew ...

Added by decypher on Wed, 10 Nov 2021 05:57:56 +0200

Look at the stock once in five minutes, and write a Python stock price report overnight.

preface       Today, I went to work happily, because I made a lot of money from the stocks I bought, so I was happy! There must be no state at work that day. My mind is on the stock! A few random increases are a month's salary, which must be more fragrant. So today, I paid special attention to the stock price information. I watc ...

Added by jateeq on Thu, 04 Nov 2021 11:27:01 +0200

Initialization of Spring----- refresh()

Initialization of Spring Surprisingly, Spring is no stranger to the core framework in Java, a point that interviewers often ask, and the source code is also the most beautiful framework. The core is IOC and AOP. IOC is simply a container that manages everything together. AOP is dynamic and adds some enhancements when you execute the methods in ...

Added by edkellett on Sun, 31 Oct 2021 22:34:23 +0200

Source code interpretation of ThreadLocal

Interpretation of ThreadLocal Basic test usage code public class ThreadLoaclDemo { static ThreadLocal<String> threadLocal = new ThreadLocal<>(); static String test = "hello"; public static void main(String[] args) { new Thread(() ->{ threadLocal.set("hello threadLocal1"); test += "1"; ...

Added by CGRRay on Wed, 27 Oct 2021 11:21:10 +0300