Writing and testing custom class loaders
1, Overview
1. The user-defined ClassLoader must inherit ClassLoader
2. loadClass method and findClass method
The findClass() method is generally overridden, which loads the class into the jvm itself. The loadClass() method does not need to be overridden. It is a complete process of calling the parent delegation mechanism.
3. defineClass ...
Posted by turboprop on Mon, 27 Apr 2020 08:09:41 -0700
Writing and testing custom class loaders
1, Overview
1. The user-defined ClassLoader must inherit ClassLoader
2. loadClass method and findClass method
The findClass() method is generally overridden, which loads the class into the jvm itself. The loadClass() method does not need to be overridden. It is a complete process of calling the parent delegation mechanism.
3. defineClass ...
Posted by micky1955 on Mon, 27 Apr 2020 07:58:24 -0700
What does synchronized lock as a pessimistic lock?
Continue with synchronized, last article What's the difference between having synchronized or not? We have learned that synchronized is used when multiple threads compete for the same resource concurrently. In this article, we will learn what is locked by synchronized as a pessimistic lock?
Lock instance object
In the last article, we have cod ...
Posted by webent on Sun, 26 Apr 2020 19:29:15 -0700
Performance comparison between wrapper class and basic type operation in Java (Integer i += 1)
This paper mainly introduces the influence of automatic unpacking and boxing on the performance of operation from the perspective of bytecode and memory occupation.
If you want to understand bytecode, you need to understand the structure of JVM virtual machine stack and code execution process. Please refer to "deep understanding of Java vi ...
Posted by varghesedxb on Sat, 25 Apr 2020 23:48:36 -0700
oom caused by Java Tomcat Max HTTP header size configuration
Max HTTP header size settings
server.max-http-header-size=999999999 //953m
JVM parameter configuration
-Xms800m -Xmx800m
Write a rest api
@RestController("action")
public class HttpHandler {
@PostMapping("/get")
public String get() {
return "get";
}
}
post access
Server OOM
java.lang.OutOfMemoryError: Java heap spa ...
Posted by dellwoodbu on Tue, 21 Apr 2020 08:21:49 -0700
Talk about JVM class loading
ClassLoader: A class loader responsible for loading a Class into the JVM and resolving the Class byte code into an object format that is universally required by the JVM.The entire life cycle consists of seven phases: loading, validating, preparing, parsing, initializing, using, and unloading.
1. How to load the class file
1.1, Loading
G ...
Posted by willsavin on Tue, 14 Apr 2020 20:21:47 -0700
Deep analysis of five "black magic" in Java
Nowadays, programming languages are becoming more and more complex. Despite a large number of documents and books, these learning materials can only describe the tip of the iceberg of programming languages. Many of the functions in these programming languages may be hidden in the dark forever. This article will explain the secrets hidden in fi ...
Posted by Warz on Mon, 13 Apr 2020 00:19:32 -0700
A time test for executing a for loop in java
Initially, I used this method of testing a million for loops
public class Main {
public static void main(String[] args) {
long start = System.currentTimeMillis();
for (int j = 0; j < 1000000; j++){
}
long stop = System.currentTimeMillis();
System.out.println(stop - start);
}
}
...
Posted by maheshb on Sat, 11 Apr 2020 09:21:11 -0700
Talk about the Prometheus service of canal
order
This paper focuses on the Prometheus service of canal
CanalMetricsService
canal-1.1.4/server/src/main/java/com/alibaba/otter/canal/spi/CanalMetricsService.java
public interface CanalMetricsService {
/**
* Initialization on canal server startup.
*/
void initialize();
/**
* Clean-up at canal server stop phase.
...
Posted by DataRater on Sat, 11 Apr 2020 07:29:43 -0700
Analysis of the reason why java takes up a lot of CPU resources in centos
Find thread PID
1. Use the top command to find the PID of the java process. The PID I found here is 13520
Locating thread
After finding the process, locate the specific thread or code. First, display the list of threads, and sort them according to the threads with high CPU consumption:
ps -mp 13017 -o THREAD,tid,time | sort -rn
root># ps -m ...
Posted by shivam0101 on Thu, 09 Apr 2020 11:15:10 -0700