Four common thread pools in Java

Using thread pool in Java, you can use the constructor of ThreadPoolExecutor to directly create an instance of outlet pool. Please refer to the previous article for how to use it. Detailed explanation of Java thread pool construction parameters . However, in the Executors class, we are provided with a common method for creating thread pools. N ...

Posted by artweb on Sun, 27 Oct 2019 20:56:04 -0700

Problems in dubbo registering jvm to close hook

dubbo performs its elegant downtime by registering the jvm to close the hook during downtime. However, when dubbo runs with spring, because spring also closes the hook registration through the jvm: public abstract class AbstractApplicationContext: @Override public void registerShutdownHook() { if (th ...

Posted by Branden Wagner on Sun, 27 Oct 2019 02:24:49 -0700

Java Concurrent Programming practice reading notes -- Chapter 2 thread safety

Prompt (click jump) 2.1 what is thread safety? 2.2 atomicity 2.2.1 race conditions 2.2.2 race condition in delay initialization 2.2.3 composite operation 2.3 locking mechanism 2.3.1 built in lock 2.3.2 reentrant 2.4 use lock to protect state 2.5 activity and performance The ...

Posted by ngu_tri on Fri, 25 Oct 2019 22:47:12 -0700

Difference between stackSize of Thread and - Xss parameter

The stackSize and Xss parameters of Thread can control the stack memory size of a Thread. Do you know the difference between them? When these two configurations exist at the same time, which one shall prevail?If you don't know the answer, read on. stackSize of Thread What is the stackSize of Thread? The stackSize parameter can be passed in the ...

Posted by mcovalt on Fri, 25 Oct 2019 20:24:06 -0700

Multithreaded note 3 (Java)

#Class notes, only you can read them First, some states of threads:Thread control joint controlThird, background thread Note 1: /* * Deadlock: *It can't be solved, it can only be avoided *jvm does not detect and avoid, so program source should avoid deadlock. *Thread class: *suspend() *Both methods of r ...

Posted by homerjsimpson on Fri, 25 Oct 2019 14:36:28 -0700

A detailed explanation of synchronized in Java

I. concept synchronized is a key word in Java. It uses the lock mechanism to achieve synchronization. The locking mechanism has the following two characteristics: Mutex: that is, only one thread is allowed to hold a certain object lock at the same time. Through this feature, the coordination mechanism in multithreading is realized, so that ...

Posted by fil on Fri, 25 Oct 2019 02:07:21 -0700

Spring container and its initialization

1. Some concepts in spring When reading spring source code or related literature, we often encounter these nouns: webapplicationcontext - ApplicationContext - ServletContext - ServletConfig. These nouns are very similar but have different scope of application, which is easy to cause confusion in the understanding of spring's internal implement ...

Posted by buraks78 on Thu, 24 Oct 2019 07:13:34 -0700

Vi. explicit lock and AQS

Explicit locks and AQS I. explicit lock The Synchronized keyword combines with the monitor of the object. The JVM provides us with a kind of semantics of "built-in lock". This kind of lock is very simple. We don't need to care about the process of locking and releasing the lock. We just need to tell the virtual machine which code bloc ...

Posted by duhhh33 on Thu, 17 Oct 2019 15:28:40 -0700

Comparison between locks in Java

The difference between synchronized and java.util.concurrent.lock.Lock The implementation level is different. synchronized is a Java keyword, which implements locking and releasing at the JVM level; Lock is an interface, which implements locking and releasing at the code level Whether the Lock is released automatically. synchronized release ...

Posted by Rohlan on Wed, 16 Oct 2019 04:55:49 -0700

Scope of spring learning bean

scope It includes Singleton, Prototype, request, session, application and websocket. It mainly talks about the commonly used Singleton and Prototype. Singleton When a bean is defined as a singleton object, the IoC container creates only one instance of the bean object. The bean object is stored in the container's cache (map). Subsequent referen ...

Posted by dillonit on Tue, 15 Oct 2019 19:08:41 -0700