java design pattern - singleton pattern
java design pattern - singleton pattern
preface
Singleton Pattern is one of the simplest design patterns in Java. This type of design pattern is a creation pattern, which provides the best way to create objects. This pattern involves a single class that is responsible for creating its own objects while ensuring that only a single object ...
Added by name1090 on Tue, 08 Mar 2022 03:28:20 +0200
Quickly understand the three basic characteristics of object-oriented (encapsulation, inheritance and polymorphism) from [example]!
Three basic characteristics of Java object-oriented (encapsulation, inheritance and polymorphism)
The encapsulation of class is equivalent to a black box. You can't see anything in the black box. Inheritance is an important feature of classes. Relatively complex and advanced classes can be inherited from a simple class, which can greatl ...
Added by mikes127 on Tue, 08 Mar 2022 03:02:46 +0200
Implementation of delayed tasks based on message queue (RabbitMQ)
1, Preface
Delayed tasks are widely used. Typical application scenarios of delayed tasks include automatic cancellation of orders when they timeout; Payment callback retry. Among them, the order overtime cancellation has idempotent property, and there is no need to consider the problem of repeated consumption; Payment callback retry needs to co ...
Added by kye on Tue, 08 Mar 2022 02:42:02 +0200
Javase (day10: a simple algorithm for sorting and finding packages and arrays)
1. Package
Why do I need a bag 1. Managing classes through packages is similar to managing blockbusters through folders. 2. The emergence of package provides a multi-layer namespace for classes, that is, the complete class name is "package name + class name".Note: in different packages, we can define classes with the same name; Howev ...
Added by Tentious on Tue, 08 Mar 2022 02:28:11 +0200
What did Lombok do for us
What is lombok
Lombok project is a Java library, tool library, which will automatically generate code in the editor or construction tool, so as to make your Java code more concise. Instead of generating get, set and other methods for each variable, it will also generate a fully functional Builder, which has automatically logged variables, and ...
Added by serg4444 on Tue, 08 Mar 2022 02:12:37 +0200
JUC: 4_ 2. Concurrent collaboration model: producer consumer problem: if false wake-up, prevent false wake-up
How to alternate the communication between threads?
Threads A and B operate on the same variable numbe=0
/**
* How to alternate the communication between threads?
* Threads A and B operate on the same variable numbe=0
* A++
* B--
* <p>
* Question:
* 1.It is safe when there are only two threads, one more + + and one more
*/
...
Added by Erestar on Tue, 08 Mar 2022 02:01:46 +0200
Java constants, interfaces, multiple implementations, multiple inheritance, and permission modifiers
Learning objectives:
Understand Java constants, interface multiple implementations, multiple inheritance, and permission modifiers
Learning content:
1. Constants in Java 2. Multiple implementation of interface 3. Multiple inheritance of interfaces 4. Permission modifier
Learning steps
1. Constants in Java
In the interface, member v ...
Added by smc on Tue, 08 Mar 2022 01:50:21 +0200
Use of loger4j
brief introduction
Log4j consists of three important components: 1. Priority of log information (Loggers), 2. The output destination of log information (Appenders), 3. Output format of log information (Layouts).
The priority of log information from high to low includes ERROR, WARN, INFO and DEBUG, which are used to specify the importance of ...
Added by roba59 on Tue, 08 Mar 2022 01:23:55 +0200
Deep agent mode
Deep agent mode
Brief description of agency mode
Selling mobile phones
Xiaomi company has produced mobile phones and wants to sell them for profit.Now there are many Xiaomi homes (agents) that can help Xiaomi sell mobile phones.When selling mobile phones, Xiaomi home can provide services such as invoice, real machine demonstration and explan ...
Added by orlandinho on Tue, 08 Mar 2022 00:41:16 +0200
Maven knows more
Maven's role is as follows:
Maven manages all dependent packages in a unified and centralized manner, and programmers do not need to look for them.Corresponding to the common jar s used by third-party components, Maven automatically solves the problems of duplication and conflict.As an open architecture, Maven provides a public interface to fa ...
Added by ramus on Tue, 08 Mar 2022 00:01:18 +0200