Interview must see - Java class loader (custom class loader)
1, Role of class loader
Java code cannot be run directly. It needs to be compiled into binary bytecode files recognized by the JVM through the compiler, and the function of class loader is to convert these binary bytecode files, namely The class file is loaded into the virtual machine so that the virtual machine can run the program.
2, Ja ...
Added by stevenszabo on Sun, 23 Jan 2022 15:28:43 +0200
java source code analysis - reflection SecurityManager class
java source code analysis - reflection SecurityManager class
In fact, the SecurityManager class is not a member of the reflection related class diagram, but when we view the reflection source code, we often see the following code:
checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true);
...
private void checkMemberAccess(int ...
Added by OLG on Sun, 23 Jan 2022 04:52:42 +0200
The cornerstone of concurrent programming understood by Tencent Architects -- the working principle of Thread class
1. Opening remarks
When it comes to concurrent programming, the first impression in your mind may be Thread, multithreading, JUC, Thread pool, ThreadLocal and so on. Indeed, concurrent programming is an indispensable part of Java programming. Mastering the core technology of concurrent programming will be a sharp weapon in job interviews. Toda ...
Added by evildobbi on Sun, 23 Jan 2022 03:53:55 +0200
Multithreaded ThreadLocal source code
Reference articles
1. What is ThreadLocal? And its general purpose
(1) Definition (2) function
ThreadLocal is used to provide local variables for internal use in threads. In other words, it uses a set of mechanisms to ensure that you create a new variable ThreadLocal. In a thread, set the ThreadLocal variable to an instance a of type A th ...
Added by ClosetGeek on Fri, 21 Jan 2022 10:30:13 +0200
[JDK source code] LinkedList source code analysis
LinkedList source code analysis
1. Introduction
Through the inheritance system, we can see that LinkedList not only implements the List interface, but also implements the Queue and Deque interfaces, so it can be used as a List, a double ended Queue, and of course, a stack.It can be seen from the inheritance system that LinkedList implem ...
Added by beboni on Sun, 02 Jan 2022 05:48:45 +0200
Exclusion lock analysis of AQS series
Catalogue of series articles
AbstractQueuedSynchronizer basic analysis of AQS series Exclusion lock analysis of AQS series
1, Get resources
1. acquire resource
public final void acquire(int arg) {
if (!tryAcquire(arg) &&
acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
selfInterrupt();
}
This method is th ...
Added by prime on Sun, 26 Dec 2021 09:55:52 +0200
jvm G1 log parsing
1. Background introduction
1.1 introduction to application background
1) Business features: the traffic peak is concentrated in the daytime, and the traffic is very low in the early morning.
2) Application features:
Many core business interfaces are provided externally. After 6 a.m., the traffic increases gradually.In the early morning, we ...
Added by indigo2k on Wed, 08 Dec 2021 05:39:05 +0200
The magic of strong and weak references in java
Preface
Under what circumstances might ThreadLocal have a memory leak?If you want to understand the context of this problem, it is essential to look at the source code. After looking at the source code, you find that static class Entry extends WeakReference <ThreadLocal<?> {} is actually used in ThreadLocal, and the puzzle is actually ...
Added by JoeZ on Sat, 27 Jun 2020 22:59:49 +0300
Java fork/join -- parallel execution of split tasks
concept
Starting from JDK 1.7, Java provides the ForkJoin framework for parallel task execution. Its idea is to divide a large task into several small tasks, and finally summarize the results of each small task to get the results of this large task. As a concurrency framework, it was added to our Java and issued in jdk7 java.util.concurrent And ...
Added by goldenei on Mon, 22 Jun 2020 08:13:24 +0300
[case demonstration] strong reference, soft reference, weak reference and virtual reference of JVM
1. background
To understand when objects are recycled, we need to understand the concept of object reference, so we have the following
2. Reference object structure chart in Java
3. Introduction
3.1. What is strong quotation
a. When there is not enough memory, the JVM starts to garbage collect. For a strongly referenced object, even if there i ...
Added by chris_2001 on Sun, 21 Jun 2020 08:56:41 +0300