Iterator pattern of design pattern
The iterator pattern is defined by providing a way to sequentially access the elements in an aggregate object without exposing the internal representation in the aggregate object. The iterator pattern is designed for the "access" of aggregate objects (arrays, collections, linked lists). Aggregate objects are traversed by defining diff ...
Posted by nextman on Mon, 20 Dec 2021 17:47:15 +0100
jvm runtime data area
jvm runtime data area
Overview
The memory managed by java virtual machine will be divided into several areas when running. These areas have their own purposes, creation and destruction time. Some are created with the start of virtual machine process, and some are created and destroyed with the start and end of user thread. According to the vi ...
Posted by kevin777 on Mon, 20 Dec 2021 11:34:30 +0100
From the perspective of method call, the features of static multi dispatch and dynamic single dispatch of Java language
Method call
For virtual machines, method invocation is not only to execute a method, but also to determine the target method to be executed. For example, in the case of replication, it is necessary to know whether to call the method of the parent class or the method of the child class. In the case of overloading, select one of multiple methods ...
Posted by poizn on Fri, 17 Dec 2021 22:05:33 +0100
Read the JVM object creation and memory allocation mechanism
Dear friends, when we create a new object, how is the object produced? Let's talk about the object generation process and memory allocation mechanism. We can talk about it during the interview, which is definitely a bonus.
1. Check when loading class
During the execution of the virtual machine, Execute to new keyword (new keyword, object clo ...
Posted by caramba on Tue, 14 Dec 2021 22:29:51 +0100
1. Class loading mechanism of JVM
1. Flow chart of loading classes in java.Main steps:Load: find the bytecode file on the hard disk and read it through IO. It will be loaded only when the class is used. For example, call the main() method and new object of the class. In the loading stage, a java.lang.Class object representing the class will be generated in memory as the access ...
Posted by kybaker on Mon, 22 Nov 2021 23:15:28 +0100
Java GC Log analysis tool parsing
Understanding GC Log is not easy, at least for most technicians. After all, for this thing, we need to have an in-depth understanding of the working principle of the Java virtual machine and the memory usage of the application. In this article, we will skip the analysis of the application because it is different from the application of th ...
Posted by DMeerholz on Mon, 22 Nov 2021 15:40:37 +0100
Threadlocal for strong and weak references
Start with SimpleDateFormat
Let's first look at an example. When 20 threads are created, one thing is done in the thread, that is, the conversion time
public class ThreadLoaclExample {
//Non thread safe
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static Date parse(String strDat ...
Posted by ashly on Mon, 22 Nov 2021 00:39:25 +0100
[super hard core] interpretation of JVM source code: the Java method main is interpreted and executed on the virtual machine
This article is compiled and published by jiumo (Ma Zhi), chief lecturer of HeapDump performance communityChapter 1 - about the Java virtual machine HotSpot, the opening point is simpleStarting with the Java runtime, this article covers some simple contents. How is the main() method in our main class called by the Java virtual machine? Some met ...
Posted by amargharat on Thu, 11 Nov 2021 11:17:34 +0100
JVM garbage collection (object termination mechanism)
1. What is the object termination mechanism?
The Java language provides an object finalization mechanism to allow developers to provide custom processing logic before objects are destroyedWhen the garbage collector finds that no reference points to an object, it will clear the object in the garbage collection. Before the garbage collector ...
Posted by lostincoding on Sun, 07 Nov 2021 22:28:57 +0100
Soft reference test of JVM
Soft reference test
Test background
Test environment:
jdk8
windows
garbage collector
The default JVM parameter used by the command line viewer through PrintCommandLineFlags does not have UseParallelGC:
xxx>java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=16777216 -XX:MaxHeapSize=268435456 -XX:+PrintCommandLineFlags - ...
Posted by diggysmalls on Sat, 30 Oct 2021 14:57:30 +0200