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

New feature of JDK8: date time related API

New feature of JDK8: date time related API Problems with old version date time API: 1. Poor design: in java.tilogjava Sq| has date classes in its packages, java.util.Date Contains both date and time, and java.sql.Date Only. Contains the date. In addition, the classes used for formatting and pars ...

Added by Iceman18 on Wed, 17 Jun 2020 07:06:02 +0300

Spring series. AOP use

AOP introduction Using the object-oriented method can organize the code well, and also can realize code reuse in the way of inheritance. However, there will always be some duplicate code in the project, and it is not convenient to use inheritance methods to reuse and manage them, such as general log printing, transaction processing and security ...

Added by dessolator on Tue, 16 Jun 2020 05:58:28 +0300

Summary of WebService learning -- using JDK to develop webservice

Summary of WebService learning (2) -- using JDK to develop webservice 1, Development means of WebService When using Java to develop web services, you can use the following two development methods 1. Development with JDK (version 1.6 and above) 2. Develop with CXF framework (in work) 2, Using JDK to develop WebService 2.1 develop WebService s ...

Added by po on Mon, 15 Jun 2020 07:24:40 +0300

Visitor mode of behavior mode

1 General Visitor pattern is a behavior pattern, which is not commonly used. It can separate the algorithmic logic acting on the object from the object itself. 2 visitor mode When we need to operate on a group of similar types of objects, we can maintain the operation logic within each object separately, but this violates the principle of singl ...

Added by riyaz123 on Sun, 31 May 2020 12:54:46 +0300

New feature of JDK10: local variable type var

brief introduction java is remarkable in the world with its object-oriented nature and has developed vigorously.During the development of the language, in order to make the java language more concise and convenient to use, JDK is also constantly improving. Today, this article introduces the local variable type var introduced in JDK10. Why do we ...

Added by melittle on Sun, 17 May 2020 03:21:33 +0300

What about Java Concurrent Programming Actual 04 Deadlock?

Series of Java Concurrent Programming Articles Java Concurrent Programming Actual 01 Bug Source for Concurrent ProgrammingJava Concurrent Programming Practice 02 How Java Solves Visibility and Orderliness ProblemsJava Concurrent Programming Actual 03 Mutual Exclusion Lock Solves Atomic Problems premise In the final example of the third article, ...

Added by Thikho on Tue, 12 May 2020 06:08:58 +0300

ELKB 7.X log system construction

Catalog What is ELKB Building ELKB system Problems to be noticed during construction What is ELKB ELKB is a popular solution for log system, which is composed by a set of components. This set of components are ElasticSearch, LogStash, Kibana and FileBeat. The functions of each component are as follows: Elastic search (es): Based on Apa ...

Added by rmt123 on Tue, 05 May 2020 16:58:56 +0300