5. Lockless Shared Mode (top), CAS, Atomics
Contents of this Chapter
CAS and volatileAtomic IntegerAtomic ReferenceAtomic accumulatorUnsafe
1. Questions raised
There are requirements below to ensure accont. Thread security for withdraw withdraw method
public interface Account {
// Get Balance
Integer getBalance();
// Withdraw money
void withdraw(Integer amount);
...
Added by Azazeal on Wed, 09 Mar 2022 19:34:20 +0200
Handwriting a thread pool, take you to learn the implementation principle of ThreadPoolExecutor thread pool
Absrtact: starting from the handwriting thread pool, gradually analyze how these codes are implemented in the Java thread pool.
This article is shared from Huawei cloud community< Handwritten thread pool, compare and learn the implementation principle of ThreadPoolExecutor thread pool! >, author: Xiao Fu Ge.
Thanks for the plane, note ...
Added by brucensal on Mon, 14 Feb 2022 06:12:20 +0200
Java parallel atomic operation class parsing
Java parallel atomic operation class parsingprefaceThe JUC package provides a number of atomic operation classes, which are implemented using the non blocking algorithm CAS. Compared with the atomic operation using locks, the performance is greatly improved.Since the principles of atomic operations are roughly the same, this article only explai ...
Added by MrLister on Thu, 06 Jan 2022 00:04:49 +0200
CAS process analysis client user access request (carrying Ticket)
brief introduction
The user's request to access the client will first go through the filter chain configured by the client. The common filters are as follows:
CAS Single Sign Out Filter-SingleSignOutFilter
Realize single sign out and put it in the first position;CAS Validation Filter-Cas30ProxyReceivingTicketValidationFilter
Responsible ...
Added by !jazz on Thu, 23 Dec 2021 21:47:58 +0200
CAS process analysis server login (with Service)
Processing flow configuration of login request
/WEB-INF/web. The configuration of the welcome page in XML is as follows:
web.xml
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
index. The contents of the JSP are as follows:
<%@ page language="java" session="false" %>
<% ...
Added by FraggleRock on Wed, 22 Dec 2021 03:43:09 +0200
Easy to understand AQS source code
Explain the AQS source code hand in hand
1, Overview
This article will take ReentrantLock as an example to show you the source code of AQS. In fact, it is not difficult. The following is a small case of fair lock. You can run and feel it yourself. The following will take you to read the source code bit by bit. If you look at it carefully, you ...
Added by gabriel kent on Sat, 04 Dec 2021 02:19:20 +0200
JUC multithreading: Atomic class and CAS principle
1, Principle of Atomic atomic class:
Atomic atomic operation class is implemented based on lockless CAS + volatile, and all methods in the class are decorated with final to further ensure thread safety. The specific implementation of CAS algorithm lies in the Unsafe class. All methods of Unsafe ...
Added by Oxymen on Mon, 11 Oct 2021 04:00:18 +0300