Posts

Showing posts with the label javaee

Serverlet flow

1. Ban đầu Có 1 thằng lắng nghe có request đến (Đánh chống, chuông vào cửa) --> Đưa nó đến ServerletContainer 2. Tiếp theo đia qua 1 số cửa Fiter để biết ông này thuộc loại nào (Người màu vàng, trắng đen, gầy béo, cao thấp) --> Thuộc serverlet Context 3. Gặp ông điều phối Dispatch Serverlet (Điều các kiểu loại người đi vào các Châu lục , phòng ban) 4. Gặp chị Lễ tân (Interceptor)để check thẻ ra vào phòng ban --->thuộc Spring Context 5. Sau khi hỏi chị lễ tân ok thì vào đúng phòng ban Controller làm việc với đúng thằng Serverlet https://qiita.com/kazuki43zoo/items/757b557c05f548c6c5db

Pessimistic Locking in JPA

PESSIMISTIC_READ – allows us to obtain a shared lock and prevent the data from being updated or deleted, Whenever we want to just read data and don’t encounter dirty reads, we could use PESSIMISTIC_READ (shared lock). We won’t be able to make any updates or deletes though. It sometimes happens that the database we use doesn’t support the PESSIMISTIC_READ lock, so it’s possible that we obtain the PESSIMISTIC_WRITE lock instead. PESSIMISTIC_WRITE – allows us to obtain an exclusive lock and prevent the data from being read, updated or deleted, Any transaction that needs to acquire a lock on data and make changes to it should obtain the PESSIMISTIC_WRITE lock. According to the JPA specification, holding PESSIMISTIC_WRITE lock will prevent other transactions from reading, updating or deleting the data. Please note that some database systems implement multi-version concurrency control which allows readers to fetch data that has been already blocked. entityManager.find(St...