Design of Thread Safety Class: Reasonable Use of ThreadLocal

1. ThreadLocal Class DefinitionThreadLocal, which means thread local variables, can provide a copy of instance variables for each thread. Each thread accesses and changes its own copy independently to ensure that there is no variable conflict between threads. ThreadLocal is a way to achieve thread safety by isolating shared variables from threa ...

Posted by pooker on Sun, 06 Oct 2019 20:08:48 +0200

Addition, deletion and alteration of music management

Exceptions and errors 1. Runtime exceptions can be handled without jvm virtual machine processing 2. Compile exceptions must be handled Two ways to handle exceptions: 1.try catch handles it by itself 2.throws are handled by the user Custom exception Entity classes: with database objects 1. Construction ...

Posted by Restless on Fri, 04 Oct 2019 02:49:35 +0200

Java Agent-based Full Link Monitoring Three ByteBuddy Operational Monitoring Method Bytecode

Chapter list: pay attention to the public address, bugstack wormhole stack, reply to < JavaAgent based full link monitoring > get source code. Java Agent-based full-link monitoring JavaAgent " Java Agent-based Full Link Monitoring II "Increasing Monitoring Execution Time by Bytecode&quo ...

Posted by Malkavbug on Wed, 02 Oct 2019 18:45:12 +0200

Deep into jvm kernel - principle, diagnose and optimize -10. jvm bytecode execution

1. Bytecode javap Simple bytecode execution process Common bytecodes Generating Java bytecode with ASM JIT and its related parameters javap(class file disassembly tool) public class Calc { public int calc() { int a = 500; int b = 200; int c = 50; return (a + b) / c; } } javap –verbose Calc Simple bytecode executio ...

Posted by phpisawesome on Wed, 02 Oct 2019 16:46:01 +0200

Note the OOM exception resolution process on a single line

background Things are like this. This department has maintained an online report query service (referred to as report). For some time, users often feedback to their small partners. Report often fails to open the pages, and after a certain period of time, they recover. Although it is not a trading system, it also causes serious problems to users ...

Posted by jkatcher on Tue, 01 Oct 2019 13:04:51 +0200

[Dead Java Concurrency] - In-depth Analysis of CAS

Table of Contents CAS analysis CAS defect CAS, Compare And Swap, that is, compare and exchange. Doug lea uses CAS technology to implement concurrent operation of Java multithreading in synchronous components. The whole AQS synchronization components, Atomic atomic class operations, etc. are imple ...

Posted by dabnet on Thu, 26 Sep 2019 06:24:47 +0200

Common parameters, tools and exception detection on JVM line

Data area settings Xms: Initial heap size Xmx: Maximum heap size Xss: Stack size per thread in Java XX: NewSize=n: Set Younger Generation Size XX: New Ratio = n: Set the ratio of the younger generation to the older generation. For example, the ratio of the young generation to the old generation is 1: ...

Posted by ManWithNoName on Wed, 25 Sep 2019 14:08:10 +0200

A simple performance test for synchronized and Lock locks

For these two kinds of locks, the performance of synchronized before JDK1.6 is far inferior to that of Lock, because synchronized needs to call the functions of the operating system and operate the kernel to complete, which is time-consuming. After JDK1.6, Oracle has optimized synchronized a lot, and sy ...

Posted by medaswho on Mon, 23 Sep 2019 13:13:28 +0200

Deep understanding of JVM memory allocation strategies

Understanding JVM memory allocation strategies Three Principles + Guarantee Mechanism There are three main principles and guarantee mechanisms for JVM memory allocation mechanism Specifically as follows: Priority assigned to eden area Big object, directly into the older generation Distribution of long-term survivors to older generations Space ...

Posted by mimilaw123 on Sat, 21 Sep 2019 18:44:34 +0200

Custom Tool Class (Object to Collection Map)

java obtains object attribute type, attribute name, attribute value: https://www.cnblogs.com/gmq-sh/p/5942065.html Using java's reflection What is the role of Class classes? (1) Instances of Class classes represent classes and interfaces in running Java applications. One of the benefits of reflect ...

Posted by private_click on Sat, 21 Sep 2019 08:38:15 +0200