Deep understanding of Java enumeration mechanism
Before reading this article, you need to understand how to define enumeration and its simple use
enumeration
1, How the JVM handles enumerations
A simple enumeration class public enum Fruit{
APPLE(67),ORANGE(68),BANANA(69);
int code;
Fruit(int code){
this.code=code;
}
}
Decompile fruit. Using the Jad command C ...
Posted by rjs on Thu, 10 Feb 2022 00:41:37 +0100
Summary of basic Java knowledge points I
Understanding of Java loading and execution:
There are two very important stages of java programs: Compile phase: the source file will be java becomes a bytecode file class (compiling is essentially checking whether the syntax is correct) Run phase: the JVM will load the bytecode file and interpret the bytecode
Basic data type
Basic data ty ...
Posted by lnenad on Sun, 16 Jan 2022 20:49:35 +0100
JDK growth 21: what are ReentrantLock fair, unfair and reentrant locks?
After the previous three sections, I believe you have a clear understanding of the AQS principle at the bottom of ReentrantLock. Next, let's introduce some concepts in ReentrantLock:
The concept of fair and unfair lock
How does ReentrantLock achieve unfairness and fairness?
What is a reentrant lock?
Fair lock Vs non fair lock
Fair lock Vs ...
Posted by ErikTheViking on Tue, 04 Jan 2022 22:01:58 +0100
OpenJDK System. Analysis of loadlibrary source code
OpenJDK System. Analysis of loadlibrary source code
System.loadLibrary is used to inform the JVM to load Native so. After so is loaded successfully, you can see that so has been loaded into memory in / proc/self/maps. Students familiar with system layer development can guess that this is basically equivalent to dlopen/LoadLibrary call. Next, l ...
Posted by drkylec on Tue, 04 Jan 2022 16:36:38 +0100
Alicloud server installation and deployment (ubuntu)
Set root password for the first timesudo passwd root1, Installing nginx1. Apt get installation commandsudo apt-get install nginxError: "Unable to locate package nginx"Solution: execute the command before installation to update the software sourcesudo apt-get updateLocation of nginx files after installation:/usr/sbin/nginx: main progra ...
Posted by alliance on Sat, 01 Jan 2022 05:25:51 +0100
Core principle and practice of JDK ThreadPoolExecutor
1, Content summaryThis paper mainly focuses on the ThreadPoolExecutor in JDK. Firstly, it describes the construction process of ThreadPoolExecutor and the mechanism of internal state management. Then, it uses a lot of space to explore the process of ThreadPoolExecutor thread allocation, task processing, rejection policy, start and stop, and foc ...
Posted by crash4o4 on Tue, 21 Dec 2021 06:10:25 +0100
JDK source code -- LinkedHashMap class
abstract
This blog will introduce the LinkedHashMap class in detail
LinkedHashMap basic data structure
We know that HashMap is out of order, that is, the order of iterators has nothing to do with the insertion order. On the basis of HashMap, LinkedHashMap adds order: insert order and access order respectively. That is, when traversing Linked ...
Posted by voxanBoxer on Tue, 14 Dec 2021 10:34:34 +0100
Summary of the top ten classic sorting algorithms (including JAVA code implementation)
In recent days, I have studied sorting algorithm and read many blogs. I found that some articles on the Internet do not explain sorting algorithm thoroughly, and many codes are wrong. For example, some articles directly use the Collection.sort() function to sort each bucket in the "bucket sorting" algorithm, which can achieve results, ...
Posted by clem_c_rock on Tue, 30 Nov 2021 22:14:54 +0100
JDK source code -- Generic principle
abstract
After JDK1.8, generics have been introduced into the JDK source code, but many beginners, junior engineers and even intermediate engineers do not understand this generics deeply enough. This paper introduces the concept and use of java generics in detail.
What are generics?
Generic, or "parameterized type". When referring ...
Posted by gyash on Tue, 23 Nov 2021 04:13:58 +0100
HashTable Source Parsing
HashTable
Attribute members
//hash table array
private transient Entry<?,?>[] table;
//Number of elements
private transient int count;
//Expansion threshold
private int threshold;
//Load factor
private float loadFactor;
//Number of changes
private transient int modCount = 0;
Constructor
...
Posted by jjfletch on Tue, 09 Nov 2021 06:52:29 +0100