Controlling internal queues with Java
There are many reasons why you should use internal queues in your program.
There are many good reasons to use internal queues in a program. Most common patterns contain the same principle - divide the processing into two separate parts, each of which can then work autonomously. Queues are the best way to move objects from one thread to another ...
Added by freynolds on Fri, 20 Dec 2019 13:23:15 +0200
join method of Thread source code analysis
join method example 1
Source code
import java.util.concurrent.TimeUnit;
public class JoinWaitTest {
private static int a = 0;
private static int b = 100;
public static void main(String... args) throws InterruptedException{
Thread t = new Thread(new WaitThread());
t.start();
t.join();
...
Added by jotgabbi on Tue, 17 Dec 2019 19:25:02 +0200
Introduce the use of ForkJoinPool
ForkJoinPool is the thread pool provided by JDK 1.7. In order to solve the problem of unbalanced CPU load. For example, a large task is executed by one thread while other threads are idle.
ForkJoinTask represents a task. Among the subclasses of ForkJoinTask are RecursiveAction and RecursiveTask. There is no result returned from recursive ac ...
Added by a1ias on Wed, 11 Dec 2019 20:26:36 +0200
Lock of jdk source code parsing (juc) - lock ReetrentLock in java
Lock in jdk source code analysis (juc) - lock ReetrentLock in java Orange dead blog Please add this prompt for forwarding
Lock of jdk source code parsing (juc) - lock ReetrentLock in java
Lock interface
Before the appearance of Lock interface, java realized the Lock function through synchronized keyword. After javase5, the Lock interface was ad ...
Added by beta0x64 on Sun, 08 Dec 2019 19:02:10 +0200
Source code analysis -- ConcurrentHashMap and HashTable (JDK1.8)
Both ConcurrentHashMap and Hashtable are thread safe K-V containers. This article starts with the source code, and briefly explains the implementation principle and difference between them.
Similar to HashMap, the bottom layer of concurrent HashMap is also implemented by array + linked list + red black tree, and K-V and hash are encapsulated ...
Added by voidstate on Sat, 07 Dec 2019 16:08:25 +0200
Discussion: the difference between creating objects before and in a loop
Business scenario
The back end obtains data from the database and passes it to the front end.
Data format obtained by backend: List
Data format of front-end requirements: Json
[scenario analysis]
The data format obtained by the back end is List, while the data format required by the front end is Json. Therefore, the back end needs to reassemble ...
Added by fesan on Thu, 05 Dec 2019 15:31:56 +0200
Spring boot2 configures ssl to realize automatic transfer from HTTP access to HTTPS access
1. Generate a certificate. You can use self signed certificate or obtain it from SSL certificate authority center
In JDK, keytool is a certificate management tool, which can generate self signed certificates. Here, use the keytool provided by JDK to create certificate tests
Open cmd window, enter command
keytool -genkey -ali ...
Added by irishjohnny24 on Thu, 05 Dec 2019 06:36:58 +0200
dubbo source parsing remote call -- rmi protocol
Remote call rmi protocol
Objective: to introduce the design and implementation of rmi protocol and the source code of Dubbo RPC rmi.
Preface
dubbo supports RMI protocol, which is mainly implemented based on the org.springframework.remoting.rmi package encapsulated by spring. Of course, the most primitive is the java.rmi. * package that relies o ...
Added by Riddick on Tue, 03 Dec 2019 17:55:55 +0200
Learn factory mode from BWM production
Factory mode is widely used, and can be seen everywhere in JDK low-level source code and major mainstream frameworks. Classes usually named after Factory, such as SqlSessionFactory in Mybatis and BeanFactory in Spring, are typical examples of factory mode.
1. Simple Factory Mode
1.1 Concepts
Simple factory mode, also known as static factory mod ...
Added by adnan1983 on Tue, 03 Dec 2019 08:12:18 +0200
How to create and start Java threads?
There are four common ways to create threads in Java.
1. Override the run() method of the Thread class.
There are two forms of expression: 1) the new Thread object anonymously overrides the run() method
package constxiong.concurrency.a006;
/**
* new Thread Object anonymous override run() method, start thread
* @author ConstXiong
...
Added by jkmcgrath on Wed, 27 Nov 2019 16:39:13 +0200