Farewell to complex flow closure

I. Introduction Maybe you have a lot of problems when using streams because they are not closed or not closed properly. In fact, java7 introduces the mechanism of automatically closing the flow, but we haven't used it. 2. Example of automatic flow closure public class AutoCloseTest {    public static void main(String[] args) throws IOExc ...

Posted on Thu, 14 Nov 2019 10:33:44 -0500 by zelot1980

Spring Boot 2.X: use and configuration of Spring Boot Actuator for application monitoring

About activator Activator is the self-examination and monitoring function of the application system provided by Spring Boot. Through the activator, we can use the data indicators to measure the operation of the application, such as checking the disk, memory, CPU and other information of the server, the thread, gc, running status of the system, ...

Posted on Wed, 13 Nov 2019 04:59:22 -0500 by Kifebear

[JVM] Explore the nature of Java constants and three constant pools

You can learn from other people's blogs and some books that constants are placed in a constant pool. The details are unknown. You can be sure that everyone will feel that what's in front of them is an almost complete black box and always uncomfortable. If you look through Understanding Java Virtual Machines, you will find that the introduction ...

Posted on Tue, 12 Nov 2019 22:31:51 -0500 by brent123456

[JVM] Explore the nature of arrays

I wrote a blog post about understanding arrays [Java Core Technology Volume] Deep understanding of Java arrays This article explores Java arrays from a theoretical perspective. This article explores the nature of arrays from a real-world perspective. Before the body begins, it is necessary to focus on the loading mechanism of classes: In Java ...

Posted on Tue, 12 Nov 2019 22:19:38 -0500 by spitfire_esquive

[Java Core Technology Volume] Deep understanding of Java interfaces

Interfaces are a very central part of Java, and I wrote a blog post with the name Understanding Java's memory logical object modelExcept Mark Word and Reflective Class Pointer did not say anything after the interface ended, everything else has already been said.The interface section corresponds to the interface offset table pointer and the inte ...

Posted on Tue, 12 Nov 2019 22:08:58 -0500 by cbailster

Exception - - Day21 (Write incorrectly, thank you)

The concept of exception Exception means abnormal.In life: Doctors say that a part of your body is abnormal and that part of your body is slightly different from normal, and that part's function will be affected. Note: In object-oriented programming languages such as Java, exceptions themselves are classes, creating an exception object and thro ...

Posted on Tue, 12 Nov 2019 16:34:19 -0500 by t3l

Do programmers really understand the reflex mechanism?

Catalog Preface 1. Overview of reflection 2. Class CLASS Class CLASS Class KINDS BEFORE FORMAL USE OF REFLECTION 3. Use of reflection Preface Many blog posts explaining reflection do not elaborate on the Class class, ~including me before of course,~. Such posts only make reflection superfici ...

Posted on Sun, 10 Nov 2019 19:42:35 -0500 by copernic67

What is java serialization? When is serialization required?

Serialization: the process of converting Java objects into byte streams. Deserialization: the process of converting a byte stream to a Java object.   Java objects need to be serialized when they need to be transferred on the network or stored in a file for persistence. Implementation of serialization: the class implements the Serializable i ...

Posted on Sun, 10 Nov 2019 10:07:23 -0500 by dirkadirka

Why do double check locks use volatile fields?

The origin of double lock In the singleton mode, there is a DCL (double lock) implementation. In Java programs, sometimes it may be necessary to delay some expensive object initialization operations, and only start initialization when these objects are used. Here is the instance code of the non thread safe delay initialization object. /** * @a ...

Posted on Sun, 10 Nov 2019 07:33:11 -0500 by wazo00

String.intern() could have been used that way (principles and applications)

1 Introduction String.intern() is a native method provided by JDK early on, not implemented by Java, but by the underlying JVM, which makes it more difficult for us to explore it.Especially after Oracle acquired Sun, the source code was not open source, let alone in-depth study.But we still need to explore as much as possible. This paper will m ...

Posted on Sun, 10 Nov 2019 02:23:07 -0500 by MiCR0