[Java Tutorial] detailed explanation of connection pool and DBUtils package

JDBC connection pool summary The creation and destruction of Connection objects for one-time use takes time. Connection pool can reuse connections and avoid waste. When the program initializes, it initializes multiple connections and puts them into the pool (Collection). Each time, it can be obtained directly from the connection pool. After u ...

Posted by .-INSANE-. on Fri, 10 Sep 2021 12:35:34 -0700

Java Anonymous Internal Class and Lambda Expression

1. Java Anonymous Internal Class There are several important points to remember when using anonymous internal classes: (1) Anonymous inner classes cannot have constructors. (Because anonymous inner classes have no class names) (2) Anonymous internal classes cannot define any static members, methods, and classes. (3) An anonymous internal c ...

Posted by mdj on Fri, 10 Sep 2021 10:06:55 -0700

Java advanced: multithreading 1, wake up

SecondThread sec = new SecondThread("zs"); SecondThread thr = new SecondThread("lsii"); //Set sec and thr threads as daemon threads sec.setDaemon(true); thr.setDaemon(true); //Start sec.start(); thr.start(); //When it is found that sec and thr are daemon threads, it will be interrupted * **Interrupt thread**: `public void interrupt()`: This ...

Posted by jllydgnt on Thu, 09 Sep 2021 19:36:43 -0700

In the actual battle of MySQL, the experience of using Insert statement is summarized, and Java development starts from scratch

======================================================================= []( )2-1. Three treatment methods []( )2-1-1. Single loop insertion We take 10w pieces of data for some tests. If the insertion method is program traversal loop, insert one by one. It is detected that the speed of inserting a message on mysql is between 0.01s and 0.0 ...

Posted by tmswenson on Thu, 09 Sep 2021 14:47:19 -0700

Using the plug-in mechanism of Hystrix, the world's hottest programmer learning route

Find expansion port Take a closer look and see when the thread pool was created? The entry is shown in the figure below. Each time a new HystrixCommand is created, the constructor of the parent class will be called: As shown in the figure above, the initThreadPool will create a thread pool. It should be noted that the first argument here, ...

Posted by tcarnes on Wed, 08 Sep 2021 13:41:13 -0700

Performance comparison between shallow and deep copies

Preface In daily development, object conversion is frequently used, which can be roughly divided into shallow copy and deep copy. If subdivided, deep copy can be subdivided into several types. This paper makes a series of tests based on several mainstream deep copy methods, and explores the principles and scenarios. Readers are welcome to d ...

Posted by wilorichie on Wed, 08 Sep 2021 10:36:46 -0700

[vernacular design pattern, uncover secrets

problem Suppose you are developing a logistics management application. The original version could only handle truck transportation, so most of the code was in a class called truck. After a while, this app became extremely popular. You can receive more than ten requests from shipping companies every day, hoping that the application can su ...

Posted by Xyphon on Mon, 06 Sep 2021 19:16:29 -0700

[source code analysis and design mode 2, heavy message

Like the factory method mode, the abstract factory mode is also composed of four elements: abstract factory, concrete factory, abstract product and concrete product. However, the number of methods in the abstract factory is different, so is the number of abstract products. The main roles of the abstract factory pattern are as follows: 1. Abst ...

Posted by tecdesign on Mon, 06 Sep 2021 17:44:24 -0700

[source code analysis and design pattern] 102021 is a significant year

The Adapter pattern converts the interface of a class into another interface that the customer wants. So that those classes that could not work together due to interface incompatibility can work together. The adapter pattern has two different forms: class adapter and object adapter. 2, Structure of adapter mode 1. Target Define a specific ...

Posted by andre_c on Mon, 06 Sep 2021 13:10:21 -0700

Spring MVC framework technology summary, Java learning route guide

@Controller public class UserController { @RequestMapping(value = "/users",method = RequestMethod.POST) public String insertUsers(@RequestBody List<User> users){ System.out.println("insertUsers"); System.out.println(users); return "/success.jsp"; } } 3.2.4 summary 🔥 If there are curly braces outside ...

Posted by al3x8730 on Sun, 05 Sep 2021 20:24:36 -0700